A deliberately flawed submission tested during development. This is a bounded grading fixture, not a candidate session or hiring-validity study.
The task
Input has a nonempty query vector q of depth D and a nonempty list k of key vectors of the same depth. Return key probabilities softmax(dot(q,k)/sqrt(D)). Use a maximum shift before exponentiation. All dot products are finite and within [-100,100]. Do not mutate input vectors.
Submitted work solution.py
1import math
2def solve(payload):
3 q, keys = payload["q"], payload["k"]
4 scale = 1.0
5 logits = [sum(a*b for a, b in zip(q, key)) / scale for key in keys]
6 maximum = max(logits)
7 exps = [math.exp(value - maximum) for value in logits]
8 total = sum(exps)
9 return [value / total for value in exps]
Captured reviewer findings
The implementation computes the required result for all stated inputs.
Contradicted
Scale is fixed at 1. For q=[1,0] and keys=[[1,0],[0,0]], logits are [1,0] instead of [1/sqrt(2),0], yielding different probabilities despite valid finite dot products. Line 3 ↗
Exponentials are normalized in key order, but normalization uses unscaled logits. The valid depth-two example therefore returns approximately [0.7311,0.2689], not [0.6698,0.3302]. Line 4 ↗
The implementation leaves caller-owned input lists, records and vectors unchanged.
Supported
The function only reads payload entries and iterates over vectors. It constructs new logits, exponentials, and result lists without assigning into caller-owned objects. Line 2 ↗
Review limit The reviewer inspected the source. It was not given execution records; the independent checks below were saved separately.
Independent execution checks
Saved Docker checks against the same constructed submission. These two cases describe their own scope.
holdout-ml-faulty. Original task, code, checks and finding excerpts are preserved. The downloadable extract omits provider payloads and local environment details.