stable / dataset_upload /OUTPUT_SCHEMA.md
LucasLoading's picture
Upload 30 files
6f2ed01 verified
|
Raw
History Blame Contribute Delete
4.32 kB
# 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.