Problem
Speculative decoding with --spec-draft-model requires the draft model file to be local. This prevents using a GPU-accelerated draft model running on a separate machine (e.g., a laptop GPU drafting for a server CPU target).
Proposed solution
A lightweight HTTP proxy (Layer 2 approach) that orchestrates distributed spec decoding between two existing llama.cpp instances:
Client → proxy:8080 → laptop:8081 (draft, GPU, generates K tokens)
→ server:8080 (target, CPU, validates in 1 pass)
The proxy uses only the existing /completion API from both instances. No internal llama.cpp changes required.
Architecture
- Draft server: llama-server on GPU machine (e.g.,
-m 4B.gguf -ngl 99)
- Target server: llama-server on CPU machine (e.g.,
-m 122B.gguf -ngl 0)
- Proxy: thin Python/Go layer that:
- Gets K draft tokens from draft server
- Feeds prompt + K tokens to target server as extended prompt
- Measures acceptance by comparing where target continues from
- Loops until generation complete
Key design constraints
- Works with unmodified llama.cpp instances
- Draft and target can run different models, different hardware, different locations
- Network overhead is <1% of total latency for targets slower than ~50 t/s
- Tokenizer compatibility (same vocab) required between draft and target
Tasks
Problem
Speculative decoding with
--spec-draft-modelrequires the draft model file to be local. This prevents using a GPU-accelerated draft model running on a separate machine (e.g., a laptop GPU drafting for a server CPU target).Proposed solution
A lightweight HTTP proxy (Layer 2 approach) that orchestrates distributed spec decoding between two existing llama.cpp instances:
The proxy uses only the existing
/completionAPI from both instances. No internal llama.cpp changes required.Architecture
-m 4B.gguf -ngl 99)-m 122B.gguf -ngl 0)Key design constraints
Tasks
/completionendpoint