Add AGENTS.md
Browse files
AGENTS.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AGENTS.md: using tasksource-jev-typed-decisions
|
| 2 |
+
|
| 3 |
+
Notes for coding agents (and people) who load, filter, or train on this dataset.
|
| 4 |
+
|
| 5 |
+
## What a row is
|
| 6 |
+
|
| 7 |
+
One row is one **decision**: a `state` (the text), a `question`, and a
|
| 8 |
+
`target` over `options`.
|
| 9 |
+
|
| 10 |
+
| `kind` | `options` | `target` | loss that fits |
|
| 11 |
+
|---|---|---|---|
|
| 12 |
+
| `choice` | unordered answers, order shuffled per row | distribution over `options`, sums to 1 | cross-entropy against the distribution |
|
| 13 |
+
| `score` | ordered levels, lowest first | distribution over levels, sums to 1; its mean is the expected level | cross-entropy, or a distance on the expected level |
|
| 14 |
+
| `noul` | empty | `[p]`, the probability that the answer to the yes/no question is yes | binary cross-entropy with a soft target |
|
| 15 |
+
|
| 16 |
+
- Targets are often soft: annotator votes, or mean ratings split between the two
|
| 17 |
+
nearest levels. Don't argmax them unless you want hard labels.
|
| 18 |
+
- Never assume the gold answer is the first option: `choice` options are permuted per row.
|
| 19 |
+
- The same ordinal task appears as both `choice` and `score` (a per-row hash decides).
|
| 20 |
+
Treat `kind` as part of the request, not as a property of the source.
|
| 21 |
+
|
| 22 |
+
## Rows are flat; groups link them
|
| 23 |
+
|
| 24 |
+
Related decisions (several questions about one text, the variants of one source
|
| 25 |
+
example, the questions about one packed state) are separate rows sharing a
|
| 26 |
+
`group_id`. Groups are stored contiguously, and the whole group is always in one split.
|
| 27 |
+
|
| 28 |
+
To build multi-question requests, group by `group_id` **and** `state`: some
|
| 29 |
+
variants reformat the text, so a group can hold more than one state. Within one
|
| 30 |
+
`(group_id, state)` pair, `question_id`s are unique.
|
| 31 |
+
|
| 32 |
+
```python
|
| 33 |
+
from itertools import groupby
|
| 34 |
+
from datasets import load_dataset
|
| 35 |
+
|
| 36 |
+
ds = load_dataset("tasksource/tasksource-jev-typed-decisions", split="train", streaming=True)
|
| 37 |
+
|
| 38 |
+
def requests(rows):
|
| 39 |
+
for (group, state), members in groupby(rows, key=lambda r: (r["group_id"], r["state"])):
|
| 40 |
+
members = list(members)
|
| 41 |
+
yield {
|
| 42 |
+
"state": state,
|
| 43 |
+
"questions": {m["question_id"]: {"type": m["kind"], "instructions": m["question"],
|
| 44 |
+
**({"criteria": m["options"]} if m["options"] else {})}
|
| 45 |
+
for m in members},
|
| 46 |
+
"targets": {m["question_id"]: m["target"] for m in members},
|
| 47 |
+
"source": members[0]["source"],
|
| 48 |
+
}
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
`groupby` works on the stored order because groups are contiguous. Shuffle
|
| 52 |
+
requests, not rows, if you want to keep them together.
|
| 53 |
+
|
| 54 |
+
## Columns you will filter on
|
| 55 |
+
|
| 56 |
+
- `source`: the tasksource task a row comes from (`multilingual/...` for non-English,
|
| 57 |
+
`procedural-typed-decisions/...` for generated tasks). `sources.yaml` maps each
|
| 58 |
+
source to its Hub dataset, revision, original dataset and licenses.
|
| 59 |
+
- `license_use`: `commercial`, `non-commercial` or `unspecified`, the most restrictive
|
| 60 |
+
license found on the source's Hub cards and in Data Provenance Initiative annotations.
|
| 61 |
+
`license` lists them. Best effort, not legal advice.
|
| 62 |
+
- `variant`: `direct` (the source example as is), `label_verification` (a yes/no check of
|
| 63 |
+
one label), `criteria_permutation`, `instruction_paraphrase`, `paired_text_format`
|
| 64 |
+
(surface variations), `packed_derived` (questions over 2-4 packed items).
|
| 65 |
+
- `split`: the source's own split (`train`, `dev`, `test`); it matches the Hub split.
|
| 66 |
+
|
| 67 |
+
```python
|
| 68 |
+
ds = ds.filter(lambda use: use == "commercial", input_columns="license_use")
|
| 69 |
+
direct = ds.filter(lambda v: v == "direct", input_columns="variant") # e.g. a cleaner eval
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
## Evaluation caveats
|
| 73 |
+
|
| 74 |
+
- Validation and test rows whose text appears in train were removed.
|
| 75 |
+
- BIG-bench, MMLU and BLiMP are excluded, so they are clean for evaluation. GLUE,
|
| 76 |
+
SuperGLUE, HellaSwag, PIQA and many other public benchmarks are **in** the training
|
| 77 |
+
data (their train splits), so don't report zero-shot results on them after training here.
|
| 78 |
+
- Eval splits include variants and packed questions over the same examples; for a
|
| 79 |
+
per-example metric, keep `variant == "direct"`.
|
| 80 |
+
|
| 81 |
+
## Rebuilding
|
| 82 |
+
|
| 83 |
+
The dataset is built by `scripts/build_jev_dataset.py` in
|
| 84 |
+
[tasksource](https://github.com/sileod/tasksource); `build-manifest.json` and
|
| 85 |
+
`build-report.jsonl` record the settings, code commit and source revisions of this release.
|