Skip to content

Refactor Conformer blocks to reuse shared feed-forward modules - #1309

Merged
0xShug0 merged 1 commit into
mainfrom
refactor/conformer-feed-forward
Nov 16, 2026
Merged

0xShug0 merged 1 commit into
mainfrom
refactor/conformer-feed-forward

Conversation

@0xShug0

@0xShug0 0xShug0 commented Nov 16, 2026

Copy link
Copy Markdown
Owner

Summary

Refactor all four Conformer block variants to compose the shared FeedForwardModule instead of maintaining their own FFN implementations. Normalization, half-scaled residuals, attention/convolution ordering and streaming cache ownership remain with the Conformer blocks.

  • Add SiLU to the existing shared FFN activation enum; preserve SiLU as the Conformer default.
  • Make the offline relative-position layout configurable through the existing attention implementation.
  • Migrate the ROSVOT caller to the shared block and embedding modules, retaining its explicit ReLU activation, tensor reshapes and positional layout. Remove duplicate mask construction and unused normalization-weight uploads.
  • Add an independent scalar FFN/residual reference to the encoder module tests. No GGML changes.

Validation

An independent NumPy reference exercises complete blocks with nonzero attention, convolution and FFN weights, masks, biases, multiple batches and streaming caches. All four block variants pass 12 default-path cases on each of CPU, CUDA and Vulkan. Before/after outputs and returned caches are numerically identical; graph signatures and workspace sizes also match. Changed-input and original-input restoration checks pass.

Sequential warmed block benchmarks found no reproducible material regression: CPU +0.74%, CUDA −0.51%. Vulkan initially measured +3.10%; a longer reverse-order check measured −1.72%. These are component measurements, not end-to-end model RTF.

Caller A/B validation on CPU, CUDA and Vulkan produced identical outputs across 120 measured requests, unchanged sampled peak VRAM, and passed short-input, supplied-word, long→short→long and error-recovery checks.

Known numerical limitation: the additional squared-ReLU Vulkan diagnostic exceeds its absolute-error gate (0.000844 versus 0.0005), although cosine is 0.9999999924. This reproduces exactly with the unchanged main FFN implementation; default Conformer cases pass without relaxing tolerances. The existing Vulkan pitch-logit parity shortfall is likewise unchanged by this refactor.

On the updated main base, the parallel Debug build of the server and encoder module test passed, and the encoder module suite passed again.

@0xShug0
0xShug0 merged commit 2872e36 into main Nov 16, 2026
7 checks passed
@0xShug0
0xShug0 deleted the refactor/conformer-feed-forward branch November 16, 2026 06:37
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.

1 participant