Skip to content

[BUG]Support for repeat_interleave operation to enable Grouped Query Attention (GQA) #198

Open

Description

@Dignity-ghost

Description:

The PyTorchSim MLIR backend does not support the repeat_interleave
operation, which is required for Grouped Query Attention (GQA) used in
modern LLMs like Mixtral 8x7B and Llama 2. In GQA, the number of KV heads
(n_local_heads) is smaller than the number of Q heads (n_head), and
repeat_interleave is used to expand K/V tensors to match Q's head count
(e.g., k.repeat_interleave(n_head // n_local_heads, dim=1)).

The error occurs in PyTorchSimFrontend/mlir/mlir_common.py at line 682-683
in the extract_dividers function, which raises NotImplementedError("Not
supporting this view operation...!") when encountering index expressions
with multiple free symbols. The repeat_interleave operation generates a
FloorDiv indexing pattern (e.g., index // 4 for 4x repetition) that the
current implementation cannot handle.

Current workaround: Set n_local_heads = -1 (which defaults to n_head),
effectively disabling GQA and using standard Multi-Head Attention (MHA).
This loses the memory efficiency benefits of GQA (4-8x KV cache
reduction).

Affected models: Mixtral 8x7B, Llama 2 70B, and other models using GQA.

Activity

  1. added
    bug
    on Dec 17, 2025
  2. YWHyuk commented on Dec 22, 2025

    @YWHyuk
    Collaborator

    Hi @Dignity-ghost,

    Thank you very much for your interest and for providing such a detailed, high-quality bug report.
    We really appreciate the effort you put into identifying the specific cause in the MLIR backend.

    I wanted to let you know that our team is currently looking into this issue.
    We'll make sure to keep you updated on our progress.

    Thank you for your patience and for helping us improve PyTorchSim!

  3. added a commit that references this issue on Apr 25, 2026
  4. removed their assignment
    on Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Work in Progressbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions