vllm - 💡(How to fix) Fix [Doc]: Fix misleading MLA attention docstring examples

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

The module-level docstring in vllm/model_executor/layers/attention/mla_attention.py appears to contain two misleading examples in the data-movement-friendly / forward_mqa section.

Current text around lines 97-118 includes:

q_nope   = (q_c @ W_UQ).view(-1, N, P)
ql_nope  = einsum("snh,lnh->snl", q, W_UK)
...
return o.view(-1, N * V) @ self.num_heads @ W_O

The variable q is not defined in the surrounding example; it looks like this should use q_nope. Also, @ self.num_heads @ W_O appears to be a typo in the documented return expression; based on the MHA example and the stated shape of W_O, it likely should be @ W_O.

Root Cause

This is a documentation/comment issue only; it does not affect runtime behavior. Because this may be too small for a standalone PR under the project contribution guidance, I am filing an issue first rather than opening a one-off typo PR.

Code Example

q_nope   = (q_c @ W_UQ).view(-1, N, P)
ql_nope  = einsum("snh,lnh->snl", q, W_UK)
...
return o.view(-1, N * V) @ self.num_heads @ W_O

---

ql_nope  = einsum("snh,lnh->snl", q_nope, W_UK)
...
return o.view(-1, N * V) @ W_O
RAW_BUFFERClick to expand / collapse

Description

The module-level docstring in vllm/model_executor/layers/attention/mla_attention.py appears to contain two misleading examples in the data-movement-friendly / forward_mqa section.

Current text around lines 97-118 includes:

q_nope   = (q_c @ W_UQ).view(-1, N, P)
ql_nope  = einsum("snh,lnh->snl", q, W_UK)
...
return o.view(-1, N * V) @ self.num_heads @ W_O

The variable q is not defined in the surrounding example; it looks like this should use q_nope. Also, @ self.num_heads @ W_O appears to be a typo in the documented return expression; based on the MHA example and the stated shape of W_O, it likely should be @ W_O.

Suggested fix

Update only the docstring example, likely to:

ql_nope  = einsum("snh,lnh->snl", q_nope, W_UK)
...
return o.view(-1, N * V) @ W_O

Duplicate check

I searched open issues and PRs for mla_attention ql_nope q_nope W_O self.num_heads comment and MLA attention docstring typo, and did not find an existing open issue or PR for this exact docstring problem.

Note

This is a documentation/comment issue only; it does not affect runtime behavior. Because this may be too small for a standalone PR under the project contribution guidance, I am filing an issue first rather than opening a one-off typo PR.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING