Skip to content

Add Qwen4-Exp EngramGate and NGramHashMapping support - #32285

Merged
kunal-vaishnavi merged 39 commits into
mainfrom
copilot/add-op-support-for-qwen-3-8-flash-next
Sep 15, 2026
Merged

kunal-vaishnavi merged 39 commits into
mainfrom
copilot/add-op-support-for-qwen-3-8-flash-next

Conversation

Copilot AI commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR expands com.microsoft contrib-op support needed by the Qwen4-Exp / Qwen3.8-Flash-Next text architecture, focused on Engram gating and n-gram hash mapping. The GatedRMSNorm activation-mode changes were removed from this PR and are now covered separately by #32512.

Changes include:

  • EngramGate: add optional conv_norm_scale input and optional gated_value_normed output for the normalized gated-value path.
  • NGramHashMapping: add autoregressive decode and packed-sequence support with optional past_ids, present_ids, head_offsets, eos_token_id, segment_ids, and reset_on_eos behavior.
  • CPU, CUDA, and WebGPU implementations for the retained EngramGate and NGramHashMapping behavior.
  • Generated contrib operator/kernel documentation for the retained schema and kernel changes.
  • Extended contrib-op tests covering CPU/CUDA/WebGPU behavior, in-place state handling, packed sequences, EOS reset behavior, and EngramGate normalized output.

Motivation and Context

Qwen4-Exp requires n-gram embeddings and Engram-style gating variants that were not fully covered by the existing contrib operators. This PR extends the relevant operators incrementally while preserving prior behavior by default.

GatedRMSNorm sigmoid/activation support is intentionally excluded here so that it can be reviewed and merged via #32512.

Copilot AI and others added 13 commits August 25, 2026 20:18
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
…eek-engram' into copilot/add-op-support-for-qwen-3-8-flash-next

Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

…ids, head_offsets

Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
This was referenced Nov 2, 2026
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.

5 participants