OpenFlowLM-Next icon indicating copy to clipboard operation
OpenFlowLM-Next copied to clipboard

`OFLM_OPEN_HOST_ATTN` runs on qwen3 models and skips their q/k norm instead of refusing

Open Cyronius opened this issue 1 month ago • 0 comments

@IvGeniy04, this one is in the host attention from #139.

The dense route's host attention implements one attention shape: K2's, with no q/k norm, full rotation, and no gate. It's opt-in, through OFLM_OPEN_HOST_ATTN=1 for prefill and OFLM_OPEN_HOST_ATTN_DECODE=1 for decode. Its guard (host_attn_layer in src/open_qwen36/core.cpp) checks head counts and the rotary width, and refuses anything else, which is the right idea. But it never checks whether the family normalizes q and k.

Qwen3 has exactly K2's geometry plus a q/k RMSNorm, so on a Qwen3 model the flag passes the guard and computes attention without the norm. On Qwen3-8B, with a 60-token chat prompt, the default route answers "Okay, the user wants me to summarize the given story…", and with OFLM_OPEN_HOST_ATTN=1 it answers "mar 2 . . sum sum sum sum…". Both exit cleanly. I only tried the prefill flag; the decode flag goes through the same guard.

Nothing breaks unless someone sets the flag. The risk is that whoever tries it on a model other than K2 gets wrong output instead of an error.

Done when

  • host_attn_layer refuses a layer type whose attention it doesn't implement, with a message that says why. That covers any family with a q/k norm (its consts carry q_norm / k_norm), a norm after the rotation, or a q/k/v bias. Alternatively, it implements the norm.
  • On Qwen3-8B, OFLM_OPEN_HOST_ATTN=1 either fails with that message or produces the same continuation as the default route.

Cyronius avatar Oct 06 '26 15:10 Cyronius