6 Commits
Author SHA1 Message Date
Carmen EstebanandClaude Opus 4.6 e9d830652e Phase 3: Speculative decoding with draft model
Add speculative decoding engine that uses a small draft model (e.g.
Qwen2.5-0.5B) to propose K candidate tokens, verified in one batch
by the target model (e.g. Qwen2.5-32B). Greedy mode (temp=0) only.

Key features:
- Fast-reject: skip target batch when d1 mismatches (saves ~40% of batches)
- KV cache rollback after verification (accepted prefix kept)
- Separate threadpools: target=high priority, draft=normal
- ar_forward_batch: new API for multi-token forward without cache reset

New files: src/ar-speculative.{h,cpp}
CLI flags: --draft, --spec-k, --draft-threads

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-05 18:42:33 +02:00
Carmen EstebanandClaude Opus 4.6 740e8366e9 Fix link: add ggml-cpu for threadpool symbols, remove unimplemented fn
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-05 18:25:15 +02:00
Carmen EstebanandClaude Opus 4.6 2b8ead2fb6 Add autoregressive inference engine for Qwen2.5/Llama models
- ar-cache.h: append-only KV cache (stores KV heads without GQA expansion)
- ar-graph.cpp: forward pass with causal mask (ggml_soft_max_ext) and KV cache
- ar-sampler.cpp: token-by-token generation with temp/top-p/top-k/repeat penalty
- ar-cli.cpp: CLI tool (diffuse-ar) for autoregressive inference
- diffuse-model.cpp: multi-arch GGUF loading (diffuse/qwen2/llama prefixes)
- diffuse.h: extended public API with ar_sampler_params and ar_generate()

Enables loading llama.cpp GGUF files directly (e.g. Thrombia-32B Q4_K_M).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-05 17:49:37 +02:00
iafiscal1212andClaude Opus 4.6 909dba237a Add diffuse-quantize tool: F16 → Q4_K_M/Q8_0/Q6_K quantization
Mixed quantization strategy (Q4_K_M):
- Attention weights: Q4_K
- FFN weights: Q4_K (Q6_K for first/last layers)
- Norms: F32
- Embeddings: F16 (preserved)
- Output head: Q6_K

Results: 15GB → 5.1GB (2.9x), 1.6x faster inference, quality preserved.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 06:48:00 +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