Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: gemma
|
| 3 |
+
base_model: google/gemma-3-27b-it
|
| 4 |
+
tags:
|
| 5 |
+
- eagle3
|
| 6 |
+
- speculative-decoding
|
| 7 |
+
- sglang
|
| 8 |
+
- draft-model
|
| 9 |
+
- rtx-5090
|
| 10 |
+
language:
|
| 11 |
+
- en
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# gemma-3-27b-eagle3-drafter
|
| 15 |
+
|
| 16 |
+
an EAGLE-3 speculative-decoding draft head for [google/gemma-3-27b-it](https://huggingface.co/google/gemma-3-27b-it), trained from scratch on a single RTX 5090 (32GB) over four unattended nights.
|
| 17 |
+
|
| 18 |
+
pair it with Gemma-3-27B-it in sglang and generation gets faster with no change in output: verified tokens are exactly what the target model would have produced. measured on the training rig, best config (tree-3-4-8), against plain decoding:
|
| 19 |
+
|
| 20 |
+
| workload | speedup | accept length |
|
| 21 |
+
|---|---|---|
|
| 22 |
+
| repetitive text | 1.52x | 1.97 |
|
| 23 |
+
| code | 1.44x | 1.84 |
|
| 24 |
+
| prose | 1.33x | 1.56 |
|
| 25 |
+
| chat | 1.23x | 1.57 |
|
| 26 |
+
|
| 27 |
+
(release bench at the selected checkpoint, step 21000; base decode 59.6 tok/s on the same card, code reaching 89.0 tok/s with the drafter by the final bench. zero failed requests across all bench runs.)
|
| 28 |
+
|
| 29 |
+
## usage (sglang)
|
| 30 |
+
|
| 31 |
+
```bash
|
| 32 |
+
python -m sglang.launch_server \
|
| 33 |
+
--model-path <your-gemma-3-27b-it path or AWQ variant> \
|
| 34 |
+
--speculative-algorithm EAGLE3 \
|
| 35 |
+
--speculative-draft-model-path witcheer/gemma-3-27b-eagle3-drafter \
|
| 36 |
+
--speculative-num-steps 3 \
|
| 37 |
+
--speculative-eagle-topk 4 \
|
| 38 |
+
--speculative-num-draft-tokens 8
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
the three configs benched:
|
| 42 |
+
|
| 43 |
+
| config | num_steps | eagle_topk | num_draft_tokens | note |
|
| 44 |
+
|---|---|---|---|---|
|
| 45 |
+
| chain-3-1-4 | 3 | 1 | 4 | cheapest, lowest gain |
|
| 46 |
+
| **tree-3-4-8** | 3 | 4 | 8 | **best net speedup, recommended** |
|
| 47 |
+
| tree-5-8-16 | 5 | 8 | 16 | higher accept length, lower net speedup: the extra draft work costs more than the extra accepts pay |
|
| 48 |
+
|
| 49 |
+
verified with sglang 0.5.14, target served as AWQ, context 4096, cuda graphs on.
|
| 50 |
+
|
| 51 |
+
## what's inside
|
| 52 |
+
|
| 53 |
+
- 716M-parameter single-layer llama-architecture EAGLE-3 head (`LlamaForCausalLMEagle3`, bf16), hidden size 5376 to match the Gemma-3-27B residual stream
|
| 54 |
+
- draft vocab 32000 with `d2t`/`t2d` maps to Gemma's 262k vocabulary
|
| 55 |
+
- no Gemma weights are included; every tensor in this repo was trained from scratch
|
| 56 |
+
|
| 57 |
+
## training
|
| 58 |
+
|
| 59 |
+
- framework: [SpecForge](https://github.com/sgl-project/SpecForge)
|
| 60 |
+
- data: a 54k-sample chat and code dataset
|
| 61 |
+
- hardware: one RTX 5090 (32GB), four nights of otherwise idle time (23:00 to ~05:20 each), ~25h GPU total
|
| 62 |
+
- checkpoint selection: every checkpoint was release-benched live; the speedup curve peaked at step 21000 (39% of one epoch) and regressed at 28000 (prose 1.33x to 1.24x), so 21000 ships. training loss alone does not show this: bench your checkpoints.
|
| 63 |
+
|
| 64 |
+
curve at a glance (tree-3-4-8):
|
| 65 |
+
|
| 66 |
+
| step | prose | code | repetitive | chat |
|
| 67 |
+
|---|---|---|---|---|
|
| 68 |
+
| 7000 | 1.22x | 1.40x | 1.37x | 1.25x |
|
| 69 |
+
| 14000 | 1.29x | 1.43x | 1.44x | 1.22x |
|
| 70 |
+
| **21000** | **1.33x** | **1.44x** | **1.52x** | **1.23x** |
|
| 71 |
+
| 28000 | 1.24x | 1.49x | 1.50x | 1.25x |
|
| 72 |
+
|
| 73 |
+
## licence
|
| 74 |
+
|
| 75 |
+
this head was trained on hidden states produced by Gemma-3-27B-it, so it is distributed as a Gemma model derivative under the [Gemma Terms of Use](https://ai.google.dev/gemma/terms). the drafter never generates final output on its own; all emitted tokens are verified by the Gemma target model.
|