← All posts

Asking first fixes the decoys: Qwen3.5-4B multikey needle 5/5 at up to 709,596 tokens with the question before the document

The 4B kept giving a decoy's passcode at 512K and 704K when the question came only after the long document. Stating the question before the document too, a known prompting technique, made all five previously failing configs pass, including a 709,596-token prompt on a 10 GB RTX 3080.

ExperimentE21K
Date2026-10-29
BenchmarkRULER-style multikey needle: one target passcode sentence at 10%, 50% or 90% depth plus three decoy passcodes for other vault colors (near 25%, 60% and 80% depth), in shuffled paragraphs from the MATH training set. Greedy decoding, 512-token answer limit. A run passes only if the first code in the final answer, after any thinking block, is the target code.
ModelQwen3.5-4B, Q4_K_M GGUF, flash attention on, q4_0 K and V cache, ubatch 64
HardwareOne of my dedicated test rigs: RTX 3080 10 GB
VerdictBASELINE

What I tested

The E21j test with one prompt change: the question is also stated once before the document ("You will be asked: ... keep that question in mind"), as well as after it. Same haystack seeds as the earlier runs, so each result pairs with an earlier question-last run on the same text. 4B at 256K (native), 512K with YaRN x2 and 704K with YaRN x2.75, on llama.cpp built with upstream PR 29827. Prompts filled to the context size minus 1,500 tokens.

Pass bar, set before the run

None. Supporting measurement, plan written down before the run. A run passes if the target code is the answer.

Result

ContextDepthPrompt tokensQuestion last (E21i/E21j)Question first (this run)Peak VRAMSharedPrefillTime
256K (native)10%256,529green decoy (fail)blue code (pass)5,688 MiB114 MiB1,359 tok/s3.5 min
512K (YaRN x2)10%513,364red decoy (fail)blue code (pass)8,028 MiB146 MiB850 tok/s10.5 min
512K (YaRN x2)50%514,477orange decoy (fail)red code (pass)8,026 MiB146 MiB850 tok/s10.5 min
512K (YaRN x2)90%514,116green decoy (fail)orange code (pass)8,026 MiB146 MiB851 tok/s10.5 min
704K (YaRN x2.75)10%709,596red decoy (fail)blue code (pass)9,784 MiB170 MiB662 tok/s18.4 min

Five of five passed with the question first; the same five configs and haystack seeds had all failed with the question only at the end. One run per config, so this is a strong signal on a small sample, not a measured rate.

Stating the question before the document is a known technique for long-context prompts. The point here is how large the effect was for this small model at 512K and 704K.

After answering, the 4B still repeated its answer or copied math text from the haystack until the 512-token limit. The grader only reads the first code.

The embedding table stays in system RAM in this setup, so the runs are not fully on the GPU; shared memory stayed at 170 MiB or less.

Next round: a cache precision check (q8_0 vs q4_0 K and V cache at 256K, question last) to see whether the 4-bit cache contributes to the decoy picks.

What happened

In the last two rounds the 4B gave another vault's passcode in every run at 512K and in two of three at 704K. Putting the question in front of the long document as well as after it fixed every one of those cases in this round, up to a 709,596-token prompt that used 9,784 MiB of the 10 GB card. A likely reason is that the model reads the document already knowing which vault matters, instead of having to look back across half a million tokens at the end. The memory saving that makes these context sizes fit is upstream llama.cpp PR 29827, so credit goes to its authors.

How to rerun

powershell -ExecutionPolicy Bypass -File e21k_chain.ps1

Code

All code for E21K: README.md, e21k_chain.ps1, results.jsonl.

Prior work

No novelty claim. Question-before-document is a known prompting technique; this measures it on an existing upstream llama.cpp pull request with a standard RULER-style multikey needle test.

Written by Andrew Rose with help from AI tools. Every number comes from the run logs.

Questions or ideas? me@andrewroseit.com or @AndrewRoseIT.