Skip to content

[Bug]: doctor reports "no tensor fills these core roles: token embedding, output head" for a healthy DeepSeek V4 container #1593

Description

@pauloapoloni

Commit or version

v1.11.0 (HEAD a8f2ca6)

Environment

Ubuntu 24.04, gcc 13.3, 16 threads, 30 GB RAM, NVMe ext4. CPU-only build of the V4 engine (make deepseek-v4).
Model: puwaer/DeepSeek-V4-Flash-0731-reap-150b (REAP-pruned DeepSeek V4 Flash, 84.7 GB, 43 layers x 132 experts, official fp4 experts / fp8 dense, no conversion).
Python used by coli: the same interpreter that runs the launcher.

Reproduction steps

hf download puwaer/DeepSeek-V4-Flash-0731-reap-150b --local-dir /mnt/Data/models/DeepSeek-V4-Flash-reap-150b
cd /home/apoloni/repos/colibri
python3 c/coli doctor --model /mnt/Data/models/DeepSeek-V4-Flash-reap-150b --deep

Expected behavior

model.required passes: the checkpoint contains a token embedding and an output head, and the engine loads and generates with them.

Actual behavior and logs

$ python3 c/coli doctor --model /mnt/Data/models/DeepSeek-V4-Flash-reap-150b --deep
[fail] model.required     no tensor fills these core roles: token embedding, output head
[  ok] model.index        model index matches every scanned tensor
[skip] storage.mirror     no mirror directory is configured
...
result error

The checkpoint is not missing anything. Its index has 35,620 tensors, including exactly the two names the engine looks up:

$ python3 -c "import json;print([n for n in json.load(open('model.safetensors.index.json'))['weight_map'] if n.endswith('.weight') and ('embed' in n or 'head' in n)][:6])"
['embed.weight', 'head.weight', 'hc_head_base', 'hc_head_fn', 'hc_head_scale']

and c/deepseek_v4.c finds them by those names:

c/deepseek_v4.c:11515:  const ColiSafetensorsTensor *embed = coli_st_find(index, "embed.weight");
c/deepseek_v4.c:1196:   *head = coli_st_find(index, "head.weight");
c/deepseek_v4.c:11629:  const ColiSafetensorsTensor *head = coli_st_find(index, "head.weight");

The engine runs this container end to end (CPU path verified: prompt "Say hello in exactly one short sentence." produces Hello.<end_of_sentence>), so the doctor verdict disagrees with the engine that actually loads the file.

Root cause (in c/doctor.py)

The role predicates match on names taken from other families:

def _is_embedding(name):
    return name.endswith("embed_tokens.weight")

def _is_output_head(name):
    return name.endswith("lm_head.weight")

DeepSeek V4 names them embed.weight and head.weight, so both roles are reported missing while model.index — which scans the same tensors — is green. _is_final_norm happens to survive here only because the container has a matching norm.weight.

This is the same class of defect as the #1365 case documented in the comment directly above those predicates ("the doctor called a healthy model broken"). The comment says the fix was to match on the tail rather than a full prefix; these two still match on a full literal suffix that no DeepSeek V4 container uses.

Suggested fix

Either extend the two predicates with the DeepSeek V4 spellings (endswith("embed.weight") / endswith("head.weight"), with the existing exclusions kept so hc_head_* cannot stand in for an output head), or derive the required roles from what each engine actually looks up — deepseek_v4.c is the authority for this family and already states both names.

Happy to test a patch: I have this container locally and can run doctor --deep and a generation before and after.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions