Commit Graph
11 Commits
Author SHA1 Message Date
iafiscal1212andClaude Opus 4.6 d261e604af fix(gqa): use grouped repeat instead of interleaved for GQA heads
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>
2026-03-22 13:50:43 +01:00
iafiscal1212andClaude Opus 4.6 7eb999b09a fix: cast quantized biases to F32 in graph, keep biases unquantized
- diffuse-graph: ensure_f32() helper casts bias tensors before ggml_add
- quantize: classify .bias tensors as TC_NORM (always F32)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 13:37:13 +01:00
iafiscal1212andClaude Opus 4.6 531ef58222 fix(dream): add QKV bias support for Qwen2.5 backbone
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>
2026-03-22 13:28:50 +01:00
iafiscal1212andClaude Opus 4.6 3f6aa5597a feat: add Dream-7B model support (Qwen2.5 backbone, GQA)
- New converter: tools/convert-dream.py (Qwen2.5 tensor mapping)
- Multi-model loader: reads diffuse.model_type from GGUF metadata
- GQA support verified (28 query heads, 4 KV heads)
- New remasking strategies: maskgit_plus, topk_margin (from Dream paper)
- Updated CLI, benchmark, and generate.py with new remasking options
- README: supported models table, Dream conversion example
- Zero breaking changes for existing LLaDA GGUF files

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 13:03:30 +01:00
iafiscal1212andClaude Opus 4.6 8c10a8cb44 feat: inter-step KV cache + updated documentation (v0.2.0)
- Inter-step cache: 1.6x average speedup (15-28 tok/s on easy prompts)
- 6 of 8 prompts now outperform llama.cpp (up to 3.2x)
- New flags: --no-cache, --cache-refresh, --cache-keep-active
- Updated paper, README, RESULTS, .zenodo.json
- Cache improves quality on 3/8 prompts (regularization effect)
- New paper.tex source with cache results (Section 4.1, 6.7)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 12:20:32 +01:00
iafiscal1212andClaude Opus 4.6 054a80afda Fix compute buffer sizing for 128+ token generation
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>
2026-03-19 14:34:14 +01:00
iafiscal1212andClaude Opus 4.6 627b45891d Add entropy_exit semantic scheduler + research findings
- ENTROPY_EXIT remasking: unmask all low-entropy tokens early, spend
  steps only on difficult tokens. 5-8x speedup on structured tasks
  (translation, factual QA) with no quality loss.
- Add entropy_threshold parameter (default 1.5)
- Research doc: prior art survey (EAGS, Fast-dLLM, WavefrontDiffusion,
  DOS, LoPA) + empirical results on 5 prompts
- Python semantic_scheduler.py experiment framework

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 05:19:52 +01:00
iafiscal1212andClaude Opus 4.6 621e635224 Fix buffer calculation: account for FFN intermediates
Per-layer buffer now includes: 10×embd + 3×ff + 2×attn_score + norm casts
Plus 20% safety margin. Fixes OOM for 48+ token sequences.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 05:07:52 +01:00
iafiscal1212andClaude Opus 4.6 2bb4358450 Fix compute buffer sizing + add generate.py wrapper
- 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>
2026-03-19 05:06:32 +01:00
iafiscal1212andClaude Opus 4.6 4d6bd72d4e Fix forward pass for real LLaDA-8B F16 model
- 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>
2026-03-19 05:03:11 +01:00
iafiscal1212andClaude Opus 4.6 6022454e29 Initial scaffold: diffuse-cpp inference engine for Diffusion LLMs
- Project structure with CMake build system, GGML submodule
- Core library: model loader (GGUF), transformer forward pass, diffusion sampler
- CLI tools: diffuse-cli (generation) and diffuse-bench (benchmarks)
- Converter: convert-llada.py (SafeTensors → GGUF with tensor name mapping)
- Tests: unit tests, converter roundtrip test, end-to-end forward pass test
- Bidirectional attention (no causal mask, no KV cache)
- SwiGLU FFN, RoPE, RMSNorm — full LLaDA-8B Llama backbone
- Verified: compiles clean, forward pass produces valid logits on tiny model

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-18 21:43:36 +01:00