Repository navigation
Share MoE FFN and Gated DeltaNet graph construction - #1293
Merged
Merged
Conversation
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.
Summary
Consolidate repeated MoE feed-forward and Gated DeltaNet graph construction into shared framework modules, reducing model-local duplication while preserving each model's mathematical configuration and execution ownership.
MoeFeedForwardModulefor routed/shared expert composition, external routing, latent projections and staged output combination. Migrate Drama3, Nemotron Transcribe, Ming3 Audio, Zonos2 and Zonos3.GatedDeltaNetModulefor Drama3 and Zonos3, with explicit projection layouts, Q/K normalization and BF16 rounding boundaries.Validation
Compared main
0a71e38bawith production revision8ab2001a6on an RTX 5090, using matching Debug builds, gcc 13.3.0, CUDA 12.9, OpenMP, CUDA graphs and eight inference threads.Each persistent-server configuration warms a short and long input, then measures both twice. TTS includes a multi-sentence long input; Zonos2 and Zonos3 produce six chunks. ASR uses approximately 28 and 60 seconds of real speech. Staged dispatch is confirmed by expert-load/cache activity, and Ming hybrid execution by CPU-assignment logs.
RTF uses
session.wall_ms, excluding load/warmup, divided by audio duration. Peak VRAM is process memory sampled every 20 ms across load, warmup and measured requests. Positive RTF delta means slower. All measured repetitions contribute to the table.Performance results
Drama3 defaults retain four CPU expert layers. Fused FFN enables only
fish_drama3.fused_moe=true. Staged configurations use eight cache slots; Ming hybrid usesmoe_cpu_share=0.5. Settings are identical between baseline and refactor.Small positive timing deltas are within observed repeat variation. The larger Zonos2 staged improvement has noticeable timing variability and should not be interpreted as a guaranteed speedup. Memory sampling can miss peaks shorter than 20 ms.
Scope and remaining API limitation
Validation covers one checkpoint per model and the listed execution paths. Metal, HIP, WebGPU and separate streaming TTFA were not measured.
The new gated FFN API currently accepts
fused_swiglu=truetogether withround_activation=true, but fusion skips the requested intermediate activation rounding. This combination should be rejected, consistent withMoeModule. Current migrated callers avoid it, so it does not affect the validated existing model paths.