Skip to content

Fix float8 filter_fqns to exclude lm_head, not output - #4008

Merged
shuhuayu merged 1 commit into
pytorch:mainfrom
shuhuayu:bob
Jul 29, 2026
Merged

shuhuayu merged 1 commit into
pytorch:mainfrom
shuhuayu:bob

Conversation

@shuhuayu

Copy link
Copy Markdown
Contributor

Float8LinearConverter.filter_fqns is an exclude-list: Linear modules whose FQN matches any entry are kept in bf16 and not quantized to fp8. The LM head module is named lm_head, but llama3 (405b) and deepseek_v3 (671b) filtered on output -- the old llama head name -- which matches no FQN in the current models. As a result the precision-sensitive LM head was silently quantized to fp8 instead of being left in bf16. Point the filter at lm_head so the head stays bf16 as intended.

Float8LinearConverter.filter_fqns is an exclude-list: Linear modules
whose FQN matches any entry are kept in bf16 and not quantized to fp8.
The LM head module is named `lm_head`, but llama3 (405b) and
deepseek_v3 (671b) filtered on `output` -- the old llama head name --
which matches no FQN in the current models. As a result the
precision-sensitive LM head was silently quantized to fp8 instead of
being left in bf16. Point the filter at `lm_head` so the head stays
bf16 as intended.

kimi_k2_5 has the same issue and is fixed separately in its own PR.
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 29, 2026
@shuhuayu
shuhuayu merged commit b3cf840 into pytorch:main Jul 29, 2026
22 of 25 checks passed
saforem2 added a commit to saforem2/torchtitan that referenced this pull request Jul 29, 2026
Replays upstream deepseek_v3 fix pytorch#4008 onto ezpz/moe per the sync protocol.
Float8LinearConverter.filter_fqns is an EXCLUDE-list: matched Linear FQNs stay
in bf16. Our 671B float8 config filtered on 'output' (the old head name), which
matches no module in the current model -- the head is 'lm_head' -- so the
precision-sensitive LM head was silently quantized to fp8 instead of kept bf16.
Point the filter at 'lm_head' (keeping 'router.gate') to match the head's
actual FQN. Only affects the float8 671B MoE path.
saforem2 added a commit to saforem2/torchtitan that referenced this pull request Jul 29, 2026
pytorch#4008 float8 filter_fqns -> replayed onto ezpz/moe (2db11d1).
pytorch#4012 FA4 Blackwell varlen -> CUDA-gated, XPU-inert, no replay.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/8gpu CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants