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>
Dream/Qwen2.5 uses biases on Q, K, V projections. Without them,
attention is fundamentally incorrect producing garbage output.
Changes:
- diffuse_layer: add optional bq, bk, bv bias tensor pointers
- diffuse-model: load bias tensors from GGUF (nullptr if absent)
- diffuse-graph: apply ggml_add after QKV projection in all 3 graph builders
- convert-dream.py: include QKV bias tensors instead of skipping them
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Increase safety margin from 1.2x to 1.5x. The previous margin was too
tight for 128 generated tokens (deficit of ~1.4 MB on a 2.76 GB buffer).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Increase base buffer from 256MB to 512MB for graph node overhead
- Better per-layer intermediate estimation (16× instead of 4×)
- Add generate.py: tokenize→diffuse-cli→detokenize pipeline
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add ggml_cast for norm weights (F16→F32) to fix ggml_mul type mismatch
- Switch RoPE from NORMAL to NEOX style (non-interleaved, matching LLaDA/OLMo)
- Use PyTorch framework in converter for BF16 safetensors support
- Add validation tools: validate-gguf.py, compare-logits.py, dump-logits
- Result: 100% argmax match vs PyTorch, cos_sim >0.993
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>