Skip to content

qwen3 cuda: refuse leftover checkpoint tensors at load - #4537

Open
ashhart wants to merge 3 commits into
mainfrom
lead/qwen3-cuda-leftovers
Open

ashhart wants to merge 3 commits into
mainfrom
lead/qwen3-cuda-leftovers

Conversation

@ashhart

@ashhart ashhart commented Nov 22, 2026

Copy link
Copy Markdown
Owner

What this changes

The Qwen3 CUDA loader checked the dtype and shape of every tensor it binds, but silently ignored any tensor it did not bind. It now ends the load with the checkpoint's leftover-tensor refusal, as GLM, DeepSeek, Nemotron and the other audited families already do; the host-read lm_head is marked as used. checkpoint.unused()'s naming log is skipped in tests, matching the other checkpoint readers, so a refusal test does not fail on the log line.

Part of a weight-loading audit of the CUDA and HIP families. Families with gaps that need per-family rules (layer-prefix loads, shared draft directories, custom trackers) are left for separate changes.

Checks

  • test-qwen3-cuda-host 21/21, including a leftover-tensor refusal case; fmt, ast-check.

Still to run

Load every Qwen3 checkpoint we list for CUDA on a GB10 and confirm none is refused and tokens are unchanged.

The Qwen3 dense CUDA loader bound the embeddings, norms and every
projection but never audited what was left: a stray tensor in the
checkpoint was silently ignored. The host-read lm_head rows are now
marked as consumed (names.readRows takes them later), and any remaining
name refuses the load with UnusedQwen3Tensors, matching the other CUDA
loaders' closeout.

Checkpoint.unused's naming log is gated on is_test, as its siblings in
checkpoint_coded/read_ahead/identity already do, so a test can exercise
the refusal without the runner counting error logs. weights.zig joins
the module test block and covers a complete tiny checkpoint and one
with a stray tensor.
@ashhart
ashhart force-pushed the lead/qwen3-cuda-leftovers branch from 4a6f6cc to ee2442c Compare November 23, 2026 17:28

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant