Skip to content

Distributed speculative decoding: GPU draft model over network #23982

Description

@7avgerenko

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:
    1. Gets K draft tokens from draft server
    2. Feeds prompt + K tokens to target server as extended prompt
    3. Measures acceptance by comparing where target continues from
    4. 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

  • Implement proxy server with OpenAI-compatible /completion endpoint
  • Add acceptance rate measurement
  • Benchmark: solo vs distributed spec speedup
  • Document setup for common configurations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions