Instead of memcpy-ing the entire KV cache history into new GGML tensors
each decode step (~52MB at 100 tokens for Qwen2.5-32B), point the GGML
tensor data pointer directly at the cache's host memory.
The cache memory is long-lived (persists across steps) and contiguous,
so GGML can read it directly during graph computation without copying.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Infer n_vocab from token_embd tensor when not in metadata
- Fix default rope_theta (1e6) and rms_norm_eps (1e-6) for Qwen2.5
- vocab_size key is optional (absent in llama.cpp GGUF files)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- LICENSE: Apache-2.0 (enables commercial use and community contributions)
- README: updated badges, Zenodo DOI, expanded contributing section,
removed SEDD/MDLM planned (inviable), fixed author name in citation
- paper.tex: updated license line to Apache-2.0
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Side-by-side performance comparison of both supported models with
entropy_exit + inter-step KV cache. Dream excels at factual/math (21.6
tok/s), LLaDA at translation (25.7 tok/s). Both beat llama.cpp on
easy prompts. Added HuggingFace GGUF download links.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The extractable graph builder (used for step 0 when cache is ON) was
still using the old 3D ggml_repeat which produces interleaved head
ordering. This caused cached K,V to have wrong head assignments,
producing garbage output when cache was enabled with GQA models (Dream).
Applied the same 4D reshape→repeat→reshape pattern already used in the
basic and cached graph builders.
Dream-7B Q4_K_M with cache: 22.5 tok/s (2.6x llama.cpp) on easy prompts.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Dream (Qwen2.5 backbone) outputs logits where position i predicts
token at position i+1 (autoregressive convention). The original
Dream code applies: logits = cat([logits[:,:1], logits[:,:-1]], dim=1)
We implement this as: for position i, read logits from max(i-1, 0).
Only active for model_type=="dream"; LLaDA is unaffected.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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>
Benchmark shows 2.7-3x throughput improvement per token (sub-linear
time scaling), with entropy_exit reaching 4.82 tok/s at n=256.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Replace benchmark JSONs with rigorous 6.5h results (288 configs, 3 reps each)
- Update README and RESULTS.md with verified numbers
- Remove research/fase4.2/ (internal notes)
- Sanitize server paths in run-benchmark.sh and JSON files
- Add real_prompts.txt used in benchmarks
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>
- Change license from MIT to AGPL-3.0 with commercial licensing option
- Expand README with full benchmarks, API docs, and entropy_exit documentation
- Fix build instructions (DIFFUSE_BUILD_TOOLS, not BUILD_BENCH)
- Remove TODO comment from main-cli.cpp
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Supports: steps/threads/schedulers sweep, JSON+markdown output,
warmup runs, actual step counting for entropy_exit.
Add run-benchmark.sh wrapper for F16/Q8_0/Q4_K_M comparison.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
55% of real-world prompts benefit (>20% speedup), with ~1.8x weighted
average across typical chatbot traffic. Classification (2.84x),
instruction following (3.86x), and translation (2.71x) are the
biggest winners. Creative writing shows 0% speedup as expected.
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>