Skip to content

Conversation

@xiaoluomi
Copy link
Contributor

Motivation

开启SP时,LLM主模型的last norm和gather过程耦合在一起,不便于多步投机解码调用。故将此特殊的norm和gather进行解耦。

Modifications

修改各个moe模型的组网,在组网中将其解耦。

Usage or Command

Accuracy Tests

Checklist

  • Add at least a tag in the PR title.
    • Tag list: [[FDConfig],[APIServer],[Engine], [Scheduler], [PD Disaggregation], [Executor], [Graph Optimization], [Speculative Decoding], [RL], [Models], [Quantization], [Loader], [OP], [KVCache], [DataProcessor], [BugFix], [Docs], [CI], [Optimization], [Feature], [Benchmark], [Others], [XPU], [HPU], [GCU], [DCU], [Iluvatar], [Metax]]
    • You can add new tags based on the PR content, but the semantics must be clear.
  • Format your code, run pre-commit before commit.
  • Add unit tests. Please write the reason in this PR if no unit tests.
  • Provide accuracy results.
  • If the current PR is submitting to the release branch, make sure the PR has been submitted to the develop branch, then cherry-pick it to the release branch with the [Cherry-Pick] PR tag.

@paddle-bot
Copy link

paddle-bot bot commented Jan 6, 2026

Thanks for your contribution!

Comment on lines 592 to 597
out = self.norm(hidden_states, residual, forward_meta=forward_meta)[0]
hidden_states = hidden_states + residual

if self.norm.is_last_norm and self.norm.fd_config.parallel_config.use_sequence_parallel_moe:
hidden_states = self.norm.allgather(hidden_states, forward_meta.ids_remove_padding.shape[0])

out = self.norm(hidden_states, forward_meta=forward_meta)[0]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all_gather可以放在norm后吧 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

对,这个合理,done~

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

测了qwen 没啥问题

Comment on lines 452 to 460
if self.norm.is_last_norm and self.norm.fd_config.parallel_config.use_sequence_parallel_moe:
out = self.norm.allgather(out, forward_meta.ids_remove_padding.shape[0])

return out

if current_platform.is_iluvatar() and forward_meta.attn_backend.mixed:
out = forward_meta.attn_backend.reverse_transpose(out)

return out
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你这里return位置不太对

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修 done~

@codecov-commenter
Copy link

codecov-commenter commented Jan 7, 2026

Codecov Report

❌ Patch coverage is 15.78947% with 16 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (release/online/20251131@7aea651). Learn more about missing BASE report.

Files with missing lines Patch % Lines
fastdeploy/model_executor/models/gpt_oss.py 0.00% 4 Missing ⚠️
fastdeploy/model_executor/models/deepseek_v3.py 0.00% 1 Missing and 1 partial ⚠️
fastdeploy/model_executor/models/ernie4_5_moe.py 0.00% 1 Missing and 1 partial ⚠️
fastdeploy/model_executor/models/ernie4_5_mtp.py 50.00% 1 Missing and 1 partial ⚠️
...del_executor/models/ernie4_5_vl/ernie4_5_vl_moe.py 0.00% 1 Missing and 1 partial ⚠️
fastdeploy/model_executor/models/glm4_moe.py 0.00% 1 Missing and 1 partial ⚠️
fastdeploy/model_executor/models/qwen3moe.py 0.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@                    Coverage Diff                     @@
##             release/online/20251131    #5911   +/-   ##
==========================================================
  Coverage                           ?   58.46%           
==========================================================
  Files                              ?      320           
  Lines                              ?    39195           
  Branches                           ?     5916           
==========================================================
  Hits                               ?    22916           
  Misses                             ?    14436           
  Partials                           ?     1843           
Flag Coverage Δ
GPU 58.46% <15.78%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@yuanlehome yuanlehome changed the title Support lastnorm gather split [TSP] last_norm allgather move to model.py Jan 8, 2026
@yuanlehome yuanlehome merged commit 799bb56 into PaddlePaddle:release/online/20251131 Jan 8, 2026
12 of 16 checks passed
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.

4 participants