File size: 4,319 Bytes
6f2ed01
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# Output schema

What your model must emit for the shipped scorer and metrics to accept it. If
you use `runner/eval_run.py` you get this for free; this document exists so you
can plug in your own inference stack (vLLM, an API, a custom harness) instead.

## Generations — `outputs/evaluation/<model>.jsonl`

One JSON object per line, **44,416 lines**, one per `query_id`.

```json
{
  "query_id": "query_00000001",
  "fact_id": "fact_000602",
  "condition_family": "anchor",
  "model": "my-model",
  "prompt": "Question: Which jurisdiction does Agriculture and Agri-Food Canada have legal force in?\nAnswer with only the shortest correct answer.\nAnswer:",
  "raw_response": " Canada\nExplanation: Agriculture and Agri-Food Canada (AAFC) is a federal department of the Government of Canada",
  "generated_tokens": 24,
  "finish_reason": "length"
}
```

| field | required | notes |
|---|---|---|
| `query_id` | **yes** | the join key; must match the query bank exactly |
| `raw_response` | **yes** | continuation only, *not* including the prompt. Do not strip, lowercase, or truncate it — the scorer needs the raw span, and `finish_reason: "length"` mid-sentence output is normal and handled |
| `fact_id`, `condition_family` | recommended | `judge_run.py` groups by these; it can recover them from the query bank but the files are easier to audit with them present |
| `model` | recommended | copied onto scored rows |
| `prompt` | recommended | keeps each file self-documenting about the template used — the cheapest way for a reader to catch a protocol mismatch |
| `generated_tokens`, `finish_reason` | optional | diagnostics |

Order does not matter; the scorer joins on `query_id`. Extra fields are ignored.

### Prompt construction

Reproduce `runner/eval_run.py:build_prompt` exactly:

```python
PROMPT = "Question: {q}\nAnswer with only the shortest correct answer.\nAnswer:"

def build_prompt(row):
    if row["condition_family"] == "anchor":
        return PROMPT.format(q=row["query"])
    return f"{row['query']}\nAnswer:"
```

Anchor is the canonical question and gets the instruction wrapper. Every other
family already carries its own surface form — that *is* the perturbation — so
wrapping it would erase the manipulation; it gets only a bare `Answer:` cue.

**No chat template, for base and instruct models alike.** See the README.

### Decoding

Greedy, `num_beams=1`, `temperature=0.0`, `max_new_tokens=24`,
`max_prompt_len=192` (left truncation, left padding), `dtype=bfloat16`,
`seed=20260101`. From `configs/models.yaml:generation`.

## Scored output — `<model>.scored.jsonl`

Produced by `runner/scoring_full.py`. One line per generation:

```json
{
  "query_id": "query_00000001",
  "model": "my-model",
  "fact_id": "fact_000602",
  "relation": "applies_to_jurisdiction",
  "condition_family": "anchor",
  "language": "en",
  "target_slot": "object",
  "answer_type": "place",
  "answer_granularity": "entity",
  "answer_in_subject_surface": true,
  "use_for_main_forward": true,
  "use_for_reverse_analysis": false,
  "use_for_recognition_analysis": false,
  "raw_response": " Canada\nExplanation: ...",
  "span": "Canada",
  "flags": [],
  "label": "correct",
  "matched_alias": "Canada",
  "scorer": "exact_alias",
  "needs_manual_review": false
}
```

`label` is one of `correct` / `incorrect` / `ambiguous` / `abstain` /
`unparseable`. `scorer` names the rule that fired, which is what you inspect
when a label looks wrong. The per-query booleans are carried through so metric
code can filter without rejoining the query bank.

## Hidden states — `outputs/hidden/<model>/`

Only needed for ISS and KTS. Produced by `metrics/extract_hidden.py`.

```
L018.npy … L045.npy    float16 [n_main_forward_queries, d_model]
index.json             query order, layer list, checksums, `complete` flag
```

Rows are in the order given by `index.json`, aligned with the 39,260 queries
carrying `use_for_main_forward`. Layers stored are `{l : l/(L−1) ≥ 0.4}`, where
`l` indexes decoder blocks and the stored state is the **output** of block `l`
(`hidden_states[l+1]` in HuggingFace terms).

The probe position is the **last valid input token** — the model has read the
question but has not emitted an answer token. With left padding this is
position `-1` for every row in a batch.