Datasets:
id stringclasses 8
values | length_tokens int64 8.19k 8.19k | text stringclasses 8
values | qwen_ids listlengths 8.19k 8.19k | qwen_roundtrip bool 1
class | targets listlengths 8 8 | source dict |
|---|---|---|---|---|---|---|
facts-8k-00 | 8,192 | = Homarus gammarus =
Homarus gammarus, known as the European lobster or common lobster, is a species of clawed lobster from the eastern Atlantic Ocean, Mediterranean Sea and parts of the Black Sea. It is closely related to the American lobster, H. americanus. It may grow to a length of 60 cm (24 in) and a mass of 6 kil... | [
28,
12838,
48630,
8743,
5437,
350,
283,
198,
47970,
48630,
8743,
5437,
350,
11,
3750,
430,
279,
7277,
76969,
466,
4047,
76969,
11,
369,
264,
9140,
314,
54596,
290,
76969,
494,
279,
22426,
21678,
20915,
11,
36437,
14593,
321,
5306,
314,
... | false | [
{
"fact_index": 1,
"qwen_pos": [
5676,
5677,
5678,
5679,
5680,
5681,
5682
],
"qwen_answer_ids": [
220,
20,
22,
23,
24,
20,
13
],
"answer_char": [
22955,
22962
],
"answer": " 57895.",
"... | {
"dataset": "WikiText-103 (raw, validation split)",
"hf_id": "Salesforce/wikitext",
"config": "wikitext-103-raw-v1",
"license": "cc-by-sa-3.0",
"url": "https://huggingface.co/datasets/Salesforce/wikitext",
"attribution": "Text from English Wikipedia articles (Wikipedia contributors), via WikiText-103 (Meri... |
facts-8k-01 | 8,192 | its authorship and The invoice sent to Helena totals 48060 euros. idea that Lead Belly did not have a history of protest music before he was discovered by Lomax. Since the music that Lomax recorded was sold to northerners sympathetic to Civil Rights, it has been suggested that Lomax helped him write a song attractive ... | [
1141,
3049,
5102,
321,
561,
23839,
3106,
310,
69502,
42199,
220,
19,
23,
15,
21,
15,
31415,
13,
4374,
421,
28905,
93247,
1467,
524,
599,
264,
3712,
314,
8401,
4477,
1518,
551,
557,
10782,
539,
436,
315,
686,
13,
8439,
279,
4477,
421... | false | [
{
"fact_index": 5,
"qwen_pos": [
5533,
5534,
5535,
5536,
5537,
5538,
5539
],
"qwen_answer_ids": [
220,
17,
24,
24,
17,
16,
13
],
"answer_char": [
24587,
24594
],
"answer": " 29921.",
"... | {
"dataset": "WikiText-103 (raw, validation split)",
"hf_id": "Salesforce/wikitext",
"config": "wikitext-103-raw-v1",
"license": "cc-by-sa-3.0",
"url": "https://huggingface.co/datasets/Salesforce/wikitext",
"attribution": "Text from English Wikipedia articles (Wikipedia contributors), via WikiText-103 (Meri... |
facts-8k-02 | 8,192 | "an states in mainland Southeast Asia. The Tai-Shan people who came down with the Mongol invasions s(...TRUNCATED) | [276,5134,303,48331,34388,13229,13,561,21034,29274,276,1208,852,3571,1441,440,279,42003,335,1475,846(...TRUNCATED) | false | [{"fact_index":4,"qwen_pos":[5749,5750,5751,5752,5753,5754,5755],"qwen_answer_ids":[220,20,15,22,18,(...TRUNCATED) | {"dataset":"WikiText-103 (raw, validation split)","hf_id":"Salesforce/wikitext","config":"wikitext-1(...TRUNCATED) |
facts-8k-03 | 8,192 | " late 1995 and wrote an article in Der Spiegel, a widely-read weekly magazine, describing Scientolo(...TRUNCATED) | [3200,220,16,24,24,20,321,5947,449,4400,303,12376,203204,11,264,13177,27864,16556,14005,11,21988,676(...TRUNCATED) | false | [{"fact_index":0,"qwen_pos":[5572,5573,5574,5575,5576,5577,5578],"qwen_answer_ids":[220,24,15,19,17,(...TRUNCATED) | {"dataset":"WikiText-103 (raw, validation split)","hf_id":"Salesforce/wikitext","config":"wikitext-1(...TRUNCATED) |
facts-8k-04 | 8,192 | " of 1797 in preparation for the trip to Macau to load trade goods and join the China Fleet. To esco(...TRUNCATED) | [314,220,16,22,24,22,303,17439,364,279,8151,310,7166,2770,310,2706,6355,11228,321,4973,279,5440,4201(...TRUNCATED) | false | [{"fact_index":5,"qwen_pos":[5687,5688,5689,5690,5691,5692,5693],"qwen_answer_ids":[220,21,19,22,19,(...TRUNCATED) | {"dataset":"WikiText-103 (raw, validation split)","hf_id":"Salesforce/wikitext","config":"wikitext-1(...TRUNCATED) |
facts-8k-05 | 8,192 | " from Eastern Electricity Board. Thelnetham Windmill was chosen at the project to benefit from the (...TRUNCATED) | [494,17489,70859,8486,13,645,16937,744,308,21403,24220,557,11543,506,279,2313,310,8495,494,279,12878(...TRUNCATED) | false | [{"fact_index":5,"qwen_pos":[5638,5639,5640,5641,5642,5643,5644],"qwen_answer_ids":[220,22,21,16,15,(...TRUNCATED) | {"dataset":"WikiText-103 (raw, validation split)","hf_id":"Salesforce/wikitext","config":"wikitext-1(...TRUNCATED) |
facts-8k-06 | 8,192 | " Names as Mascots Harms Native Americans\".\nChurchill, Ward (November 1998). \"Smoke Signals: A Hi(...TRUNCATED) | [33718,430,85841,2333,5061,977,16213,8609,3158,198,80919,473,11,25788,318,32610,220,16,24,24,23,553,(...TRUNCATED) | false | [{"fact_index":6,"qwen_pos":[5779,5780,5781,5782,5783,5784,5785],"qwen_answer_ids":[220,18,20,21,17,(...TRUNCATED) | {"dataset":"WikiText-103 (raw, validation split)","hf_id":"Salesforce/wikitext","config":"wikitext-1(...TRUNCATED) |
facts-8k-07 | 8,192 | " moved to Switzerland after her release from prison in 1988. The assassination conspiracy was disco(...TRUNCATED) | [7481,310,28169,1238,1024,4722,494,9065,303,220,16,24,23,23,13,561,46706,24489,557,10782,1238,2838,8(...TRUNCATED) | false | [{"fact_index":6,"qwen_pos":[5692,5693,5694,5695,5696,5697,5698],"qwen_answer_ids":[220,19,20,23,17,(...TRUNCATED) | {"dataset":"WikiText-103 (raw, validation split)","hf_id":"Salesforce/wikitext","config":"wikitext-1(...TRUNCATED) |
Long-context agent benchmark: facts, tool calls and rules far back in the context
Does a language model still use information that lies far back in a long conversation? An agent that works for
hours gets its tools defined at the start, reads facts somewhere in the middle and is told rules ("don't use grep
here, use rg") long before the moment they matter. This benchmark measures exactly that, on real agent
transcripts and real text, at 8k and 32k tokens:
| config | what the model has to use from far back | language | licence |
|---|---|---|---|
facts |
numbers planted in a long Wikipedia text ("Fiona booked flight 48213."), asked for again thousands of tokens later | English | CC BY-SA 4.0 |
tool_calls |
the definitions of tools and documented commands at the start of an agent session, needed to call them correctly much later | English | CC BY 4.0 |
rules_en |
a policy rule given at the start (system prompt) or in a later user message, which should change what the agent does many turns later | English | CC BY 4.0 |
rules_cs |
the same rules written in Czech (the commands stay the English shell commands) | Czech | CC BY 4.0 |
rules_de |
the same rules written in German | German | CC BY 4.0 |
Every test is teacher-forced: the model reads the full text once, and its next-token prediction is checked at the target positions. Nothing is generated, so the scores are deterministic up to the model's numerical precision and do not depend on sampling or answer parsing.
Sizes
| config | split | items | targets | tokens per item (Qwen3.5 tokenizer) |
|---|---|---|---|---|
| facts | 8k | 8 | 64 queries | 8,193 |
| facts | 32k | 7 | 56 queries | 32,769 |
| tool_calls | 8k | 16 | 886 (414 far, 217 of them fresh) | 8,193 |
| tool_calls | 32k | 16 | 3,244 (2,038 far, 989 of them fresh) | 32,769 |
| rules_en / rules_cs / rules_de | 8k | 82 each | 155 each | 2 x 8,193 (without / with the rule) |
| rules_en / rules_cs / rules_de | 32k | 84 each | 605 each | 2 x 32,769 |
The 82 / 84 rule items per language are planted in 16 different agent sessions per length (each session carries
several rules, one per item: three rule families, each in the system prompt and in a later user message; items of
the same session share their context_id).
What an item looks like
All configs keep the full text the model reads, the target positions as character offsets into that text
(usable with any tokenizer) and, for reference, the token ids of the Qwen3.5 tokenizer with which the items were
built (qwen_* fields). The agent texts are written in the Qwen3.5 chat format (<|im_start|>system ... <|im_end|>,
tool definitions as JSON lines inside <tools>, calls as <tool_call><function=...> blocks), as one long session
followed by further documents.
facts:text;targets[]withanswer_char(the span of " 48213." after the query),answer,fact_char/fact(the planted fact sentence),distance_tokens;source(WikiText-103 and the titles of the Wikipedia articles the text comes from).tool_calls:text;definitions[](the tool definition or documented command and its span);targets[]withchar(the target token's span),target,kind(name,param,next,command),far,fresh,definition_id,distance_tokens;sources[].rules_*:text_without_rule,text_with_rule(the same session with one rule line added),rule,rule_char,family(substitution,redirect,required),placement(system: at the end of the system prompt;user: at the end of a later user message),lang,context_id;targets[]withchar_without_rule/char_with_rule(where the governed action starts),expected_text(the first token the rule implies, e.g. " rg"),original_text(what the session actually did, e.g. " grep"),distance_tokens,first,mentioned;sources[].sources[](agent configs): every source dataset in the item's text with itsdatasetid,revision,license, and thetokens/documentsthe item takes from it.
A target is far when the fact, tool definition or rule it needs ends 512 or more tokens before it (counted in
Qwen3.5 tokens; a fixed parameter of the benchmark). Every rules target is far; distance_tokens gives the exact
distance.
Metrics
- facts: query accuracy. A query counts as recalled when every token of the answer (the five-digit number and the final ".") is the model's top-1 prediction. Also reported: token accuracy.
- tool_calls: far accuracy. Top-1 accuracy of the next token at the far targets: the tool's exact name, its
parameter names, the token that closes them, which parameter or closing tag comes next, the name of a documented
command.
freshtargets are far targets of a tool with no earlier call in the 512 tokens before the target (the model cannot copy a recent call); also reported: fresh and near accuracy, mean log-probabilities. - rules: follow and retained. At each target, score = log p(the rule-implied first token). The effect of the rule is score(with rule) - score(without rule). A reference model decides which targets count: those where its own effect is at least 1 nat in absolute value (the reference reacts to the rule). Over these targets: follow = share of targets where the model's effect is at least half the reference's; retained = sum of the model's effects / sum of the reference's. Reported per placement and family. The reference is typically the original model a compressed, quantized or otherwise modified model was derived from (for the reference itself follow = retained = 1.00); with no reference given, the model is its own reference.
Headline rows as score.py prints them:
| row | definition |
|---|---|
| Facts recalled at 8k / 32k tokens | facts, query accuracy |
| Distant tool calls at 8k / 32k tokens | tool_calls, far accuracy |
| Rules followed at 8k / 32k tokens | rules_en, follow, rules in the system prompt, all families |
| Rules kept far back, worst case (1.00 = as the original) | rules_en, the lowest retained of 12 cells (3 families x 2 placements x 2 lengths) |
| Czech / German rules kept far back, worst case | rules_cs / rules_de, the same |
| Rules in Czech / German followed at 32k tokens | rules_cs / rules_de at 32k, follow, system prompt, all families |
Running it
score.py (in this repository) needs torch and transformers (pyarrow for the Parquet files) and scores any
Hugging Face causal language model that runs in transformers:
# a model on its own
python score.py --model Qwen/Qwen3.5-2B --data thinletter/longctx-agent-bench --out qwen35_2b.json
# a modified model against its original (the reference of the rules configs), saving the reference's scores once
python score.py --model Qwen/Qwen3.5-2B --data ./longctx-agent-bench --sets rules_en,rules_cs,rules_de \
--save_scores ref_2b.json.gz --out ref.json
python score.py --model my-org/my-compressed-2b --data ./longctx-agent-bench --reference_scores ref_2b.json.gz \
--out mine.json
# a quick test: the first item per config at 8k
python score.py --model Qwen/Qwen3.5-0.8B --data ./longctx-agent-bench --lengths 8k --limit 1
--mode auto(default) feeds the stored Qwen3.5 token ids when the model's tokenizer has the same vocabulary (exactly the evaluated sequences), and otherwise tokenizestextwith the model's own tokenizer and maps the targets by character offsets (--mode text). A target whose characters do not start at a token boundary of that tokenizer is skipped and counted asunalignedin the output. The rules configs need the model and its reference to use the same tokenization mode.- The texts use the Qwen3.5 chat markup verbatim. Other model families read it as plain text; their scores are comparable with each other within a family (model vs its reference), less so across families.
- Models that need their own runtime:
score_sets(backend, tokenizer, data)takes any object withread(ids, positions, tokens)(the top-1 token and the log-probabilities of given tokens at given positions). ThinCtx models run on thethinctxruntime and are scored with--backend thinctxthrough itsEngine.score: thinctx 1.1 (upcoming) addsEngine.score; thinctx 1.0.x cannot score ThinCtx models teacher-forced. - Cost: about 12 million tokens of forward passes per model for all configs (the rules configs are most of it), one sequence at a time, at most 32,769 tokens long.
- Output:
rows(the headline rows above),sets(every metric per config and length),reference,mode.
Licence
| config | licence | why |
|---|---|---|
facts |
CC BY-SA 4.0 | an adaptation of WikiText-103 (Wikipedia text, CC BY-SA 3.0): ShareAlike |
tool_calls, rules_en, rules_cs, rules_de |
CC BY 4.0 | the choice of texts, the planted rules and the target annotations |
The third-party text inside every config stays under the licence of its source (below), which you must also respect: attribution, the licence notices of the code, and the terms its sources name for model outputs.
Sources and licences
facts. Salesforce/wikitext, config wikitext-103-raw-v1,
validation split (revision main), licence CC BY-SA 3.0 (and GFDL): text of English Wikipedia articles by Wikipedia
contributors, via WikiText-103 (Merity et al., 2016, "Pointer Sentinel Mixture Models"). Each item names its articles
in source.articles. Changes: 8 fact sentences and their 8 queries were written over parts of the article text.
tool_calls and rules_*. Agent sessions and documents from the datasets below, rendered in the Qwen3.5 chat format
and concatenated; the rules configs add one rule line to the system prompt or to a user message. Each item's
sources names the datasets in it.
| dataset | revision | licence | content |
|---|---|---|---|
| nebius/SWE-agent-trajectories | 68195a1450865274106246d0d0296a1d6807b88e | CC BY 4.0 | agent runs on GitHub issues |
| Kwai-Klear/SWE-smith-mini_swe_agent_plus-trajectories-66k | 750b2c11239fd5e32f97e6cfb9bf80fb9a9a2983 | MIT | agent runs on SWE-smith repositories |
| NousResearch/hermes-function-calling-v1 (configs func_calling, json_mode_agentic) | dae3e1d28cfbcf4b915c04ea1e072030529b4bda | Apache-2.0 | function-calling conversations |
| glaiveai/glaive-function-calling-v2 | e7f4b6456019f5d8bcb991ef0dd67d8ff23221ac | Apache-2.0 | function-calling conversations |
| minpeter/xlam-function-calling-60k-parsed, a parse of Salesforce/xlam-function-calling-60k (APIGen, Liu et al., 2024) | c6a0d61d66c5ac769c5c8c7de007322fa24f1825 | CC BY 4.0 | single-turn parallel tool calls |
| codeparrot/github-code-clean | c48d40f9e70f0196f8236901ee35807f7d6c44c0 | Apache-2.0 (dataset card); files used: MIT, Apache-2.0, BSD-2-Clause, BSD-3-Clause, ISC, Unlicense or CC0-1.0 | GitHub source files |
| AmanPriyanshu/random-python-github-repositories | 53690024aaa0f56f81700bf504d9d5e16ec81a4d | ODC-By; repositories used: MIT, Apache-2.0, BSD or Unlicense | Python repositories |
| HuggingFaceFW/fineweb-edu (config sample-10BT) | 87f09149ef4734204d70ed1d046ddc9ca3f2b8f9 | ODC-By (and the Common Crawl terms of use) | educational web text |
- Code excerpts. The source files and repositories come from repositories whose files are licensed MIT,
Apache-2.0, BSD-2-Clause, BSD-3-Clause, ISC, Unlicense or CC0-1.0 according to the source datasets' metadata; only
such files were used. The repository name stands inside the text before its files (
<|repo_name|>owner/name,<|file_sep|>path); the copyright of the code belongs to its authors under those licences. - Agent sessions. The nebius card states that the licence of each repository an instance is based on must be respected (the repositories' code appears in the sessions' observations) and that users of the model outputs in these trajectories must comply with the Llama 3.1 License. The SWE-smith sessions likewise show code of the repositories they work on.
Attribution: Wikipedia contributors (via WikiText-103, Merity et al. 2016; Salesforce); Nebius (SWE-agent-trajectories); Kwai-Klear (SWE-smith mini-swe-agent-plus trajectories); NousResearch (Hermes function-calling v1); Glaive AI (glaive-function-calling-v2); Salesforce (APIGen / xlam-function-calling-60k) and minpeter (its parse); codeparrot (github-code-clean) and AmanPriyanshu (random-python-github-repositories), and the authors of the GitHub repositories named in the texts; Hugging Face (FineWeb-Edu).
Limitations
- The rule targets are English shell commands in English agent sessions, also in the Czech and German configs: those test rules given in Czech or German, not agents working in those languages.
- Teacher forcing reads the model's belief at each target given the true history; it does not measure whether a generated session would go the same way.
- The rules metrics are relative to a reference model; the absolute effect sizes are reported too (
eff,eff_ref). - 7 to 16 contexts per config and length: differences of a few points are within noise.
Results of models evaluated with this benchmark: https://thinletter.io/thinctx/
- Downloads last month
- 66