Skip to content

The shipped oracle fixture does not match a container built by a default conversion #7

Description

@isenbek

engine → engine matches the PyTorch oracle fails against a Kimi-Linear container converted with current defaults. The engine and the fixture agree on the answer and disagree on precision, which does not look like an engine error — but I cannot rule one out from the fixture alone, which is why this is an issue rather than a PR.

Measurement

tests/fixtures/oracle_kimilinear_16tok.bin (655 360 bytes = 163 840 floats = vocab), against test_forward on the same 16 ids tests/run.sh uses:

lengths:      engine 163840   oracle 163840
argmax agree: True
correlation:  0.964251
max |diff|:   3.2840          mean |diff|: 0.5484      (check threshold: 1e-3)

engine top-5 ids [318, 5243, 387, 14509, 10484]
oracle top-5 ids [318, 5243, 14509, 387, 10484]

Same argmax, same top-5 set with two middle ranks swapped, correlation 0.96. That is the signature of the same computation over differently-quantized weights, not of a wrong one. A genuine engine bug would not track the reference this closely across 163 840 logits.

Why I think it is the fixture

The fixture has not changed since 0d9c995 (git diff --stat ce96e38..HEAD -- tests/fixtures/ is empty; md5 e4b19db9c9abb503fcee46bc97cfe747). tools/kimi_ref.py computes its logits from a WASTE container, so a fixture is only comparable to a container quantized the same way. My container is a plain tools/convert.py --src ... --out ... with no flags, giving a Q4G/Q8G/F32 trunk.

The README's 3.6e-06 agreement is only achievable when the oracle and the engine read the same weights. Nothing records which conversion settings this fixture corresponds to, so a contributor converting from the released shards today gets a failure with no way to tell whether the engine or the fixture is at fault.

What would settle it

Regenerating the oracle from the container under test with tools/kimi_ref.py and re-diffing. That is a pure-PyTorch 48 B forward pass on CPU, and I can run it and report the number if that is useful — it is the only version of this check that means anything on a locally-converted container.

Possible resolutions, all yours to choose

  • record the conversion settings the fixture was generated under, and have tests/run.sh skip with that reason when the container's trunk formats differ;
  • ship the fixture for the default conversion instead, and regenerate it when the default moves;
  • make the check generate its own oracle when uv and the source weights are present, and skip otherwise.

Reproduced on

v0.6.1 (c4d45c5), Linux x86_64 / AVX2. Identical numbers on 0.6.0, so it is not a flake. The same container passes dequantized weights match the source — the round-trip against the original 91.5 GB of safetensors — and C tokenizer matches Python tiktoken.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions