mirror of
https://github.com/iafiscal1212/diffuse-cpp.git
synced 2026-12-04 00:28:08 +00:00
ggml_repeat with K[d,4,N]→[d,28,N] gives round-robin head assignment (kv0,kv1,kv2,kv3,kv0,...) but GQA expects grouped assignment (kv0×7, kv1×7, kv2×7, kv3×7). Fix: reshape to 4D, repeat the inner dimension, reshape back. K[d,kv,N] → K[d,1,kv,N] → repeat → K[d,rep,kv,N] → K[d,head,N] This was the root cause of garbage output on Dream-7B (GQA 28/4). LLaDA (MHA 32/32) is unaffected since the GQA path is never taken. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>