Adapt DFlash for llama.cpp, so DFlash speculative decoding can run against GGUF target models.
This repository is currently a planning and scaffolding repo. It intentionally does not claim to contain a working DFlash runtime yet.
DFlash is a block-diffusion draft-model speculative decoding approach. The goal of dflash-llama is to make that approach usable from the llama.cpp ecosystem:
- target model loaded as GGUF through llama.cpp
- DFlash draft model loaded as GGUF
- hidden-state capture from the target model
- DFlash draft generation over a fixed block
- target-model verification with exact-output speculative decoding
- eventual integration with llama.cpp speculative decoding APIs
The target GGUF remains the source of truth for tokens, embeddings, logits, and verification. The DFlash draft GGUF predicts a block of candidate tokens from:
- the last accepted token plus mask-token noise embeddings
- selected hidden states captured from the target model
- Qwen3-style DFlash transformer blocks
The target model verifies the candidate block and accepts the longest matching prefix, preserving exact greedy output.
The recommended implementation path is:
- Standalone
dflash-llamarepository withllama.cppas a pinned submodule. - Initial hidden-state capture through llama.cpp evaluation callbacks where possible.
- DFlash GGUF converter for upstream DFlash checkpoints.
- C++ DFlash graph/runtime built with ggml and llama.cpp backend support.
- End-to-end
llama-dflash-clifor prompt, draft, verify, accept, rollback. - Later upstream-friendly patches for generic auxiliary layer capture and
--spec-type dflash.
See docs/architecture.md for the full implementation plan.
- Project plan
- Repository scaffold
- DFlash GGUF metadata specification
- HF-to-GGUF converter
- C++ DFlash loader
- C++ graph builder
- Target hidden-state capture
- End-to-end speculative loop
- Benchmarks
- llama.cpp upstream patches
dflash-llama/
├── docs/
│ ├── architecture.md
│ ├── gguf_layout.md
│ ├── roadmap.md
│ └── upstream_status.md
├── include/
│ └── llama-dflash.h
├── src/dflash/
├── tools/
├── python/dflash_llama/
├── tests/
├── bench/
├── scripts/
├── patches/
└── third_party/llama.cpp/ # planned submodule
MIT for this repository's original code and documentation. Upstream projects and model weights retain their own licenses.