Repository navigation
Conversation
Build the model's actual Transformers class on meta (honouring remote code and revisions) and trace its forward to find the output head: any transform before the output embeddings, the output embeddings themselves, and any soft cap or scale applied to the logits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
2 of 6 tasks
ThoreKoritzius
added a commit
to ThoreKoritzius/diffusion-llm
that referenced
this pull request
Oct 14, 2026
…ed before training The GPU no longer idles through setup and the upload: venvs install in parallel with uv while models and data prefetch, then vllm-project/vllm#61276 is checked on the Ettin decoders 17M-1B (its tests, HF-vs-vLLM greedy agreement, speed), then the baseline latency runs alone before the training tracks start. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G6Bm8s1uyizXtz9t5ZCZAw
…_scaling Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Contributor
|
This pull request has merge conflicts that must be resolved before it can be |
Replace the fx trace with the model's `ForCausalLM` class itself: its base model is stubbed to return `inputs_embeds` and its output embeddings call `lm_head`, so whatever it applies after the base model runs as written. Heads that are only the projection are detected at init and use `lm_head` directly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
…d-output-head Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> # Conflicts: # tests/models/transformers/test_backend.py # vllm/model_executor/models/transformers/base.py
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
6 tasks done
Contributor
|
This pull request has merge conflicts that must be resolved before it can be |
6 tasks done
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
The Transformers modeling backend assumes every causal LM's output head is
lm_head, pluslogit_scale/final_logit_softcappingfrom the config. This PR runs the model's ownForCausalLMhead instead, generalising #61246 (Ettin / ModernBERT decoder). Depends on #65446.Claims
ForCausalLMclass (from Transformers or remote code) is built on meta with its base model stubbed to returninputs_embedsand its output embeddings calling vLLM'slm_head, so whatever it applies after the base model (scale, soft cap, dense -> act -> norm transform) runs as written.lm_headpath, unchanged frommain.main(Granite, GraniteMoe, HyperCLOVAXlogits_scaling; greedy output was unaffected), and lets heads with a transform (Ettin / ModernBERT decoder, Roberta-likes) load.lm_headLoRA work.lm_head.weight.dtype) raise at init instead of producing wrong logits.Validation
Max |logprob difference| vs HF float32 (bf16, 4 prompts x 32 greedy tokens, B200), and throughput with
--model-impl transformers:mainmain-> PRibm-granite/granite-3.3-2b-instruct(scale)google/gemma-2-2b-it(soft cap)bf16 noise is ~0.1; throughput is one run each, so the gain is noise rather than a speedup.
Tests: all 58
test_backend.pytests pass on B200 (including 17 output head tests) with thewrapper.pyfix from #65446, whichtest_output_head_transform(Ettin) needs.TODO before merge: once #66545 (
compute_logits_localfor batch-sharded sampling) lands, hidecompute_logits_localwhen the kept head needs the full vocab (the runner checkshasattr, so a property raisingAttributeError). Elementwise heads (scale, soft cap) can run on the local shard and keep it.TODO before merge: once #66413 lands (
Base.embedding_modulesnames the input embeddings fromget_input_embeddings()), check LoRA adapters that target the model's own output embedding name (e.g. GPT-NeoXembed_out, Roberta-likedecoder). This PR maps those checkpoint names tolm_headfor weight loading, butCausalMixin.embedding_modulesonly listslm_head, so such adapters are probably rejected. The name can come fromget_output_embeddings()of theForCausalLMthis PR builds.Pull Request Checklist
I used vLLM's
/pr-checklistskill. (Mandatory for agents, optional for humans).AI assistance was used during the creation of this PR.
Design Fit: Minimizes impact on core components, reuses existing functionality, and justifies added complexity.
Testing and Validation: Validates the change and ensures any added tests are meaningful and reliable, with CI coverage or documented CI resource constraints and validation performed outside CI.
Code Quality and Style: Keeps code and comments clear and concise, and updates relevant documentation and examples.
Pull Request Contents: Includes a brief summary and relevant links, supports claims with evidence, explains root causes and implementation trade-offs, and follows the contributing guide.
🤖 Generated with Claude Code