refused method

Future<Map<String, Object?>> refused(
  1. String name,
  2. List<EvalRow> rows
)

Opening-refusal rates without and with the vector.

Implementation

Future<Map<String, Object?>> refused(String name, List<EvalRow> rows) async {
  var without = 0, withVector = 0, toComply = 0, toRefuse = 0;
  for (final (i, row) in rows.indexed) {
    final ids = _promptIds(row.prompt);
    final a = _refuses(await _greedy(ids, null, refusalTokens));
    final b = _refuses(await _greedy(ids, vector, refusalTokens));
    if (a) without++;
    if (b) withVector++;
    if (a && !b) toComply++;
    if (!a && b) toRefuse++;
    _progress(name, i, rows.length);
  }
  return {
    'kind': 'refused',
    'prompts': rows.length,
    'refusal_without': _rate(without, rows.length),
    'refusal_with': _rate(withVector, rows.length),
    'refuse_to_comply': toComply,
    'comply_to_refuse': toRefuse,
  };
}