# DCore

> Open-source code and research toolkit for training and evaluating speculative-decoding drafters, including DCore, on Qwen3 models.

DCore is an open-source repository from ERNIE Research that accompanies the paper "When Does Better Acceptance Pay? A Controlled Study of Speculative Decoding." It contains training, evaluation, and interactive demo code for seven speculative-decoding drafters (EAGLE-3, DFlash, DFlare, D-PACE, Domino, DSpark, and DCore) on Qwen3-4B and Qwen3-8B.

## What It Is

DCore is a research codebase for speculative decoding, where a lightweight drafter proposes tokens that a target model verifies in parallel. The repository's focus is throughput rather than acceptance length alone: it compares drafter recipes under a common training, inference, and evaluation protocol across ten benchmarks and two target models. DCore itself is a recipe combining DFlash's backbone, DFlare's target-layer context mixture, and the D-PACE objective.

## Training and Evaluation Workflow

Training is launched with a single `train.sh` command that takes a model, method, and verification budget (8 or 16) and maps them to tuned configs. Training data is OpenPerfectBlend with assistant turns regenerated by the target model; regenerated sets are on Hugging Face, and scripts are provided to regenerate them. Evaluation runs on SGLang through SpecBench, with single-request tests on ten benchmarks and a concurrent test on SpecMix, a 3,331-prompt mixed-traffic set. Results include acceptance length and tokens per second, written as results, responses, and a report.

## Demo and Released Checkpoints

A race-replay demo shows token-by-token generation across methods, with one method per GPU by default, served in a browser. Trained drafters are released in a Hugging Face collection, and the demo downloads them automatically.

## Setup Path

The environment is built with `build_env.sh`, which sets up a uv virtualenv, Rust/protoc, and sglang-kernel. Documented prerequisites are Python 3.12, CUDA 12.x or 13.x, uv, and at least 8 GPUs, since training is tuned for 8 GPUs. A modified SGLang is included as a submodule. The code is MIT-licensed and builds on SpecForge and SGLang.

## Features
- Training of seven speculative-decoding drafters via one-line train.sh
- Tuned configs for Qwen3-4B and Qwen3-8B at verification budgets 8 and 16
- Online speculative-decoding evaluation on SGLang with SpecBench
- Single-request evaluation on ten benchmarks
- High-concurrency evaluation on SpecMix mixed-traffic set
- Target-regenerated training data pipeline on OpenPerfectBlend
- Token-by-token race replay demo across methods
- Released drafter checkpoints on Hugging Face
- Experiment tracking via wandb, swanlab, tensorboard, or mlflow

## Integrations
SGLang, SpecForge, Hugging Face, Weights & Biases, SwanLab, TensorBoard, MLflow

## Platforms
LINUX, API, CLI

## Pricing
Open Source

## Links
- Website: https://github.com/ernie-research/DCore
- Documentation: https://github.com/ernie-research/DCore#getting-started
- Repository: https://github.com/ernie-research/DCore
- EveryDev.ai: https://www.everydev.ai/tools/dcore
