[ BENCHMARKS / v5.0 / TASKS / 40_attention ]
Scaled dot-product attention (single head) in Python.
Single-head scaled dot-product attention over plain lists, with a softmax that stays exact for scores in the thousands, without numpy or torch.
- Unit
40_attention- Category
- LLM / MLAttention
- Language
- Python
- Difficulty
- Medium600 s wall clock (10 min)
- Origin
- From v4, upgraded
- Ranked rows passed
- 7/7single seed each
The prompt
The agent receives exactly this text as its task, verbatim. The harness adds its own system prompt and, in some campaign arms, guidance of its own; the harness chapter describes those. The task’s setup also writes the files its working directory starts with (a worked sample, a repository or a service, where the prompt names them); they are not reproduced here.
Create /tmp/eval_attn/attention.py with a function attention(Q, K, V) that implements single-head scaled dot-product attention. Inputs are 2D lists of floats: Q is (n_q x d_k), K is (n_k x d_k), V is (n_k x d_v). Return a 2D list (n_q x d_v) of floats: softmax(Q @ K^T / sqrt(d_k)) @ V, where softmax is taken along each row of the n_q x n_k score matrix. The softmax must be numerically stable: scores with magnitudes in the thousands, positive or negative, must still give the correct result with no overflow or division by zero. Graded on hidden inputs with a tolerance of 1e-6 (relative for values above 1). Use only the Python standard library (math); do not use the numpy or torch libraries.What it tests and why it is in the suite
What it asks. Single-head scaled dot-product attention over plain lists, with a softmax that stays exact for scores in the thousands, without numpy or torch.
Why it is here. From v4, upgraded for v5: seeded hidden tests inside the validator and no expected-output files for them. With autograd and the stable softmax it covers LLM / ML.
In the suite README: evals/README.md:134 · evals/README.md:148
How it is graded
The validator holds its test cases where the agent cannot read them, and runs them against what the agent left on disk once it stops. Since the upgrade its cases are generated from a seed and no expected output for them is in the agent’s directory (the worked sample the prompt names is only a sample); a mismatch reports only the failing case’s index. The unit was proven like the new ones (reference passes; wrong, empty, leaking and, where timed, slow solutions fail) and passed the same adversarial review.
- Time. The agent has 600 s of wall clock (medium tier) before an arm’s scaling; at the wall it is stopped and whatever is on disk is validated. Any time limit in the prompt applies to the program itself.
- Verdict. Pass or fail, from the validator alone. A unit the integrity scan finds contaminated is withheld and counts as not passed; a unit lost to infrastructure is rerun, and one still lost counts as not passed.
- Scoring. SCORE is 0.75 × SOLVE + 0.25 × LANG over the whole suite, with hard problems weighted above medium ones. Scoring and ranking
Upstream: the prover’s controls · one unit’s life cycle · why v5 is built this way
How each ranked run did
One run per board row, the DGX Spark pair first, then the RTX 5090, then the gold standard. Each is a single seed: a pass or a fail on one unit is one draw, and a difference between two rows on one unit says little on its own. Claude Opus 5.5 is the unranked reference, in its own scaffold.
DGX Spark pair
- DeepSeek-V4.1-Flash#1 on the boardPassedPassed the validator.
- Hy4-flash#2 on the boardPassedPassed the validator.
- GLM-5.3-Flash#3 on the boardPassedPassed the validator.
One RTX 5090
- Inkling 2 Mini#4 on the boardPassedPassed the validator.
- Inkling 2 Mini Derisked#5 on the boardPassedPassed the validator.
- Inkling 2 Mini SC117 abliterated#6 on the boardPassedPassed the validator.
- Qwen3.8 27B Uncensored MTP#7 on the boardPassedPassed the validator.
Gold standard · unranked
- Claude Opus 5.5Claude Code tools, no turn cap, 2× wallPassedPassed the validator.