Datasets:
|
Download data_guidelines.md from LidaSafety/incidentbench-silver-training: direct link, hf CLI and curl.
- Browser
- Download file 9.07 kB
-
https://huggingface.co/datasets/LidaSafety/incidentbench-silver-training/resolve/main/data_guidelines.md
- Command line
-
hf download hf://datasets/LidaSafety/incidentbench-silver-training/data_guidelines.md
-
curl -L -o data_guidelines.md https://huggingface.co/datasets/LidaSafety/incidentbench-silver-training/resolve/main/data_guidelines.md
9.07 kB
| # How to use this data | |
| `README.md` says what each file is and which published number it belongs to. This file says how to | |
| run it: the record format, how to train, how to predict, how to score, and the mistakes that have | |
| actually cost this project results. Paths are relative to this folder. | |
| ## 1. Record format | |
| Every task file is JSON Lines with the same two fields a trainer needs, plus provenance: | |
| ```json | |
| {"incident_id": "aiid:616", "date": "2023-11-27", | |
| "prompt": "An AI system was built and put into use. These conditions were already in place ...", | |
| "completion": "...", "y": {...}} | |
| ``` | |
| `prompt` is the model input and holds **only conditions recorded before the incident's designated | |
| trigger**. `completion` is the training target as a string, which is what the trainer consumes. | |
| `y` is the same target parsed, which is what scorers read. Keep them consistent if you rebuild | |
| anything: a scorer reading `y` and a trainer reading `completion` will silently disagree otherwise. | |
| Targets by task: | |
| | task | `completion` shape | | |
| |---|---| | |
| | classification (`incident_mit8_lt*`) | `{"class": "Misinformation", "trigger_kind": ..., "severity": ...}` — `class` is the eight-class label, one of seven MIT domains or the no-incident class | | |
| | description (`incident_gen*`) | plain prose, one or two sentences. **Not JSON.** | | |
| | policy generation (`policy_gen_lt*`) | `{"controls": [{"control": "...", ...}, ...]}`, up to three controls | | |
| | stage/RMF (`policy_category_lt*`) | `{"stage": ["detect","prevent"], "rmf": ["govern","measure"]}`, multi-label | | |
| Golden files differ, because they carry a contrastive pair: `incident_gen_gold.jsonl` has | |
| `gold_event` and `decoy_event`; `policy_gen_gold.jsonl` has `gold_policies` and `decoy_policies`. | |
| The label store `multilabel_domains/*.jsonl` is `{incident_id, model, domains, date}` — the raw | |
| labeller output before any task shape. | |
| ## 2. Pick the cutoff and the backbone together | |
| The three cutoffs are the experiment, not a convenience. `<2024` trains on records dated before | |
| 2024, and so on; all three are scored on the same fixed test split, which is why the columns are | |
| comparable. | |
| **A backbone released after a cutoff leaks.** The whole Qwen3 family postdates 2025-04-27, so no | |
| Qwen3 model is admissible below `<2026`; Qwen2.5 (2024-09-16) is the last pre-2025 option. This is | |
| why Table 8's Qwen3 cells at the earlier cutoffs are blank rather than empty for lack of effort. | |
| Check a candidate's release date against the cutoff before you train, not after. | |
| ## 3. Train | |
| The trainer is `datasets/train_incident_forecast_lora.py` in this repository. It is configured | |
| entirely by environment variables: | |
| ```bash | |
| env BASE="Qwen/Qwen2.5-7B-Instruct" \ | |
| TRAIN_FILE="paper_silver_training/output/incident_gen_lt2026/train.jsonl" \ | |
| ADAPTER_DIR="out/adapter_incgen_lt2026" \ | |
| MAXLEN=384 BATCH=8 ACCUM=1 EPOCHS=3 SEED=42 GRAD_CKPT=0 \ | |
| BALANCE_HEADS= BALANCE_ALPHA=0 \ | |
| python datasets/train_incident_forecast_lora.py | |
| ``` | |
| Published settings are LoRA r=16, alpha=32, dropout 0.05, 3 epochs, seed 42. Other useful variables: | |
| `INIT_ADAPTER` continues from an existing adapter, `LORA_TARGETS` changes the target modules, | |
| `DEVICE_MAP` shards across GPUs, `LIMIT` truncates for a smoke test. | |
| **Measure `MAXLEN` with the backbone's own tokenizer before every run.** A length verified for one | |
| backbone does not transfer: on the same text the Qwen3-8B tokenizer gives a median of 151 tokens | |
| where Qwen2.5-7B gives 173. Across all the task files here the longest sequence is 325 tokens under | |
| its own tokenizer, so 384 truncates nothing — but verify rather than inherit: | |
| ```python | |
| L = [len(tok(tok.apply_chat_template([{"role":"user","content":r["prompt"]}], | |
| tokenize=False, add_generation_prompt=True) + r["completion"])["input_ids"]) for r in rows] | |
| assert max(L) <= MAXLEN, f"p100 {max(L)} exceeds {MAXLEN}" | |
| ``` | |
| A truncated run does not fail. It scores a model that never saw the end of its own target. | |
| **Memory.** 7B and 8B at batch 8 and 384 tokens fits a 48 GB card for the shorter tasks but OOMs on | |
| policy generation with Qwen3-8B. Drop to `BATCH=4 ACCUM=2 GRAD_CKPT=1` for the same effective batch. | |
| ## 4. Predict | |
| ```bash | |
| env BASE="Qwen/Qwen2.5-7B-Instruct" ADAPTER="out/adapter_incgen_lt2026" \ | |
| FORECAST_DIR="paper_silver_training/output/incident_gen_lt2026" \ | |
| SET=test OUTPATH="out/preds.jsonl" MAXPROMPT=384 MAXNEW=256 BATCH=16 \ | |
| python datasets/predict_incident_forecast.py | |
| ``` | |
| `MAXPROMPT` is a second, independent cap: a generation budget verified while an input cap is | |
| inherited is still a void run. Decoding is greedy. | |
| **Prose answers land in `raw`, not `pred`.** The predictor parses the completion as JSON when it | |
| looks like JSON and always keeps the untouched text. For the description task there is no JSON to | |
| find, so a scorer reading only the parse scores every row empty and reports the task as degenerate. | |
| Read `raw` first, fall back to `pred`. | |
| ## 5. Score | |
| Use the scorer that belongs to the task. They are not interchangeable and they do not agree. | |
| | task | scorer | cohort | | |
| |---|---|---| | |
| | detection and category | `datasets/score_two_heads.py` | 416 incidents; 261 of them for category | | |
| | description | `results_incident_gen_common_cohort/score_incident_gen_common_cohort.py` | 338 | | |
| | policy generation | `datasets/score_gen_prose.py` | 187 | | |
| | stage and RMF | `datasets/score_policy_golden_boundaries.py` | 187 | | |
| The evaluation cohorts are **intersections, not samples**: golden incidents dated 2026 onward that | |
| appear in none of the three boundary training splits. Assert the count before reporting, because a | |
| cohort that silently changes size invalidates every comparison against a published cell. | |
| Three rules for the generation metrics: | |
| **Report masked.** The score is a contrastive win rate: does the generated text resemble its own | |
| target more than a same-class decoy, with input content words removed from all three. Unmasked | |
| numbers reward repeating the prompt — echoing the input back scores 94.78 cosine unmasked and 63.33 | |
| masked on description. Chance is 50.00. | |
| **Never average cosine and Jaccard.** They disagree systematically, and the disagreement is the | |
| finding. On policy generation the unadapted backbone has the best Jaccard of any arm and the worst | |
| cosine, which means the adapters produce text that is semantically closer while sharing fewer | |
| literal tokens. An average hides exactly that. | |
| **Two scorers exist for description and they differ by about two points** on identical prediction | |
| files, because one takes the maximum over candidate texts and masks with the condition text while | |
| the other scores a single text and masks with the prompt. The published table uses the | |
| common-cohort scorer. Never compare a number from one against a number from the other. | |
| ## 6. Replicating one number, end to end | |
| Table 8's `<2026` description cell, 81.95 cosine / 66.12 Jaccard: | |
| 1. Train on `output/incident_gen_lt2026/train.jsonl` (8,413 rows) with the settings in section 3. | |
| 2. Predict on `output/incident_gen_lt2026/test.jsonl` (2,672 rows). | |
| 3. Score with the common-cohort scorer against `output/golden_human/incident_gen_gold.jsonl`, | |
| restricted to the 338 ids in `output/golden_human/incident_gen_scored_338.txt`. | |
| 4. Expect the same within run-to-run variance, which is a few points: retraining these arms on | |
| different hardware and library versions moved `<2024` from 76.92 to 81.66 and `<2025` from 81.95 | |
| to 84.02 at identical seed and hyperparameters. **Variance here is of the same size as the | |
| differences between cutoffs**, so a single run is not evidence that one cutoff beats another. | |
| ## 7. Mistakes that have cost results here | |
| **Treating silver as ground truth.** These labels are Claude Opus 5's output. Used directly as a | |
| prediction the silver label scores 79.33% accuracy against the golden judgement, above every model | |
| trained on it — because it was assigned from the full report while models see only the antecedent | |
| conditions. It is a reference point, not a ceiling, and never a target to evaluate against. | |
| **Reporting a number from a dead arm.** An API arm whose calls failed returns empty completions that | |
| score like a confident wrong answer. Check `no_completion` in the arm's manifest before quoting it: | |
| two arms in the working tree are entirely dead that way, at 2,076 of 2,076 and 1,453 of 2,076 calls. | |
| A scorer should print `NO ANSWER` rather than a number. | |
| **Counting a malformed answer as a drop.** An unparseable answer is wrong, not absent. Dropping those | |
| rows inflates every score. | |
| **Using `policy_gen/preds_lora.jsonl`.** It is the pre-fix contaminated arm, byte-identical to the | |
| copy in `policy_gen_leaky_backup/`, and it scores about five points high: 69.52 masked cosine | |
| against the published 64.17. It is excluded from this folder. The published arm is | |
| `polgen_gold_lt2024/preds_pgg.jsonl`. | |
| **Assuming an id overlap check is enough.** Zero shared ids between train and test does not make a | |
| split clean. Check dates against the cutoff too, and check that the backbone predates it. | |