# AI use cases for Ada Flash (ZinYY/AdaFlash)

Repo: [ZinYY/AdaFlash](https://github.com/ZinYY/AdaFlash) | Use cases: 3 | Page: https://dedupedai.com/use-cases/zinyy-adaflash/

AdaFlash is an open-source framework for faster speculative decoding that pairs Qwen3 target models with on-policy distilled diffusion drafters and an adaptive length head, served through a patched SGLang.

This file holds every use case of this repo. Each one starts with a "## " heading and ends with its URL.

- Measure Ada Flash decoding speed against baselines on GSM8K: https://dedupedai.com/use-cases/zinyy-adaflash/benchmark-adaflash-speedup-on-gsm8k/
- Serve Qwen3-8B with an Ada Flash drafter and test it over HTTP: https://dedupedai.com/use-cases/zinyy-adaflash/serve-qwen3-with-adaflash-drafter/
- Train an Ada Flash drafter on your own response data: https://dedupedai.com/use-cases/zinyy-adaflash/train-custom-adaflash-drafter/

## How to measure Ada Flash decoding speed against baselines on GSM8K with Ada Flash

Repo: [ZinYY/AdaFlash](https://github.com/ZinYY/AdaFlash) | Difficulty: Intermediate | Time: 1 hour | Basis: From the README

Run the one-command Ada Flash benchmark on a GSM8K split to get throughput numbers for your own GPUs.

**Who it is for:** An ML engineer deciding whether Ada Flash is worth adopting for a Qwen3-8B serving setup and needing numbers from their own hardware.

**The problem:** Published speedups may not match your hardware, batch sizes, or workload, so you need a repeatable local measurement before changing serving infrastructure.

**The outcome:** A benchmark run over 1024 GSM8K samples at concurrency 64 with the Ada Flash drafter, plus a documented protocol for comparing against other methods.

### Steps

1. Create the environment with `conda create -n adaflash python=3.12 -y` and then `conda activate adaflash`.
2. Install the patched SGLang with `pip install "sglang[all] @ git+https://github.com/sgl-project/sglang.git@refs/pull/34171/head#subdirectory=python"` and then `pip install -r requirements.txt`.
3. Prepare the benchmark split with `python bin/prepare_data.py --dataset gsm8k`.
4. Set `export MODEL_PATH=Qwen/Qwen3-8B`, `export DRAFT_MODEL_PATH=AdaFlash/Qwen3-8B-PerfectBlend`, `export DATASET=gsm8k`, `export NUM_SAMPLES=1024`, and `export CONCURRENCY=64`.
5. Run `bash scripts/tools/benchmark.sh` and read the results it writes, then follow docs/benchmark_experiments.md to run the other baselines under the same settings.

### Prompt to paste into your agent

```text
In the ZinYY/AdaFlash repo, set up the environment from the README, prepare the gsm8k split, and run scripts/tools/benchmark.sh with MODEL_PATH=Qwen/Qwen3-8B and DRAFT_MODEL_PATH=AdaFlash/Qwen3-8B-PerfectBlend for <your GPU machine>. Report the throughput output from the benchmark. Verify that the server started with the patched SGLang before trusting any number.
```

### Caveat

The README says a stock SGLang release may not work, so the patched SGLang PR must be installed before the benchmark will run.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/zinyy-adaflash/benchmark-adaflash-speedup-on-gsm8k/

## How to serve Qwen3-8B with an Ada Flash drafter and test it over HTTP with Ada Flash

Repo: [ZinYY/AdaFlash](https://github.com/ZinYY/AdaFlash) | Difficulty: Intermediate | Time: 1 hour 15 minutes | Basis: From the README

Launch an Ada Flash SGLang server for Qwen3-8B and send requests to its /generate endpoint.

**Who it is for:** A developer who runs a Qwen3-8B inference endpoint and wants lower latency from speculative decoding without changing the target model.

**The problem:** Plain autoregressive decoding is slow for an internal Qwen3-8B service, and the team needs a tested way to swap in a faster drafter.

**The outcome:** A running Ada Flash server for Qwen3-8B that answers requests on the /generate endpoint, with timings from the included benchmark client.

### Steps

1. Complete the environment setup with `conda create -n adaflash python=3.12 -y`, `conda activate adaflash`, the patched SGLang install, and `pip install -r requirements.txt`.
2. Launch the Ada Flash server with `scripts/serve/serve_thresh_head.sh`, which the README lists as the Ada Flash serving launcher.
3. Wait until the server reports ready, then run `python bin/benchmark.py` against its `/generate` endpoint.
4. Compare the output with the Vanilla launcher `scripts/serve/serve_sglang.sh` using the same benchmark client and settings.

### Prompt to paste into your agent

```text
In the ZinYY/AdaFlash repo, start the AdaFlash server with scripts/serve/serve_thresh_head.sh for Qwen/Qwen3-8B and then run python bin/benchmark.py against its /generate endpoint. Expected output is a benchmark summary from the client. Verify that the server is ready before sending requests and that the drafter is AdaFlash/Qwen3-8B-PerfectBlend.
```

### Caveat

The README does not document the serve script arguments, so check the script header or docs before changing its defaults for your model or GPUs.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/zinyy-adaflash/serve-qwen3-with-adaflash-drafter/

## How to train an Ada Flash drafter on your own response data with Ada Flash

Repo: [ZinYY/AdaFlash](https://github.com/ZinYY/AdaFlash) | Difficulty: Advanced | Time: 3 hours | Basis: From the README

Regenerate training data, initialize the adaptive length head, then run asynchronous on-policy training.

**Who it is for:** A researcher or ML engineer who wants a drafter tuned to a different dataset or target model than the released checkpoint.

**The problem:** The released Qwen3-8B drafter was trained on PerfectBlend, so a different domain may need its own drafter trained on matching target-model responses.

**The outcome:** A trained Ada Flash drafter with an initialized adaptive length head, saved as versioned weights that the async pipeline publishes for hot reloading.

### Steps

1. Prepare the base dataset with `python bin/prepare_data.py --dataset perfectblend`, then regenerate responses with `CUDA_VISIBLE_DEVICES=0 python bin/regenerate_dataset.py --model-path Qwen/Qwen3-8B --initial-draft-path z-lab/Qwen3-8B-DFlash-b16 --dataset-path cache/dataset/perfectblend_train.jsonl --num-samples 4096 --output-jsonl cache/dataset/perfectblend_qwen3_8b_regen_4096.jsonl`. (inferred, check the README)
2. Initialize the adaptive length head with the `torchrun --standalone --nproc_per_node=1 --module pipeline.offline.init_thresh_head` command in the README, pointing `--dataset-path` at your regenerated file. (inferred, check the README)
3. Export `MODEL_PATH`, `INITIAL_DRAFT_PATH`, `DRAFT_CONFIG_PATH`, `DATASET_PATH`, `SWAP_DIR`, and `LOG_DIR` as shown in the README training section.
4. Start training with `bash scripts/pipeline/run_async_pipeline_adaflash.sh "0" "1,2"`, where the first argument is the inference GPUs and the second is the training GPUs, then check the logs directory.

### Prompt to paste into your agent

```text
In the ZinYY/AdaFlash repo, prepare a dataset, regenerate responses with Qwen/Qwen3-8B, initialize the adaptive length head, and start scripts/pipeline/run_async_pipeline_adaflash.sh with inference GPU 0 and training GPUs 1,2. Expected output is versioned drafter weights written under the swap directory and logs under the log directory. Verify that the initialized draft path exists before starting the async run.
```

### Caveat

The README gives GPU counts only as examples, so the needed GPU setup and run length for a custom dataset are not documented and must be determined by the user.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/zinyy-adaflash/train-custom-adaflash-drafter/
