Text Generation
Transformers
qwen3
feature-extraction
speculative-decoding
dspark
dflash
specforge
sglang
long-context
custom_code
Instructions to use LazyPenitent/MyModel with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use LazyPenitent/MyModel with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="LazyPenitent/MyModel", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("LazyPenitent/MyModel", trust_remote_code=True) model = AutoModel.from_pretrained("LazyPenitent/MyModel", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use LazyPenitent/MyModel with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "LazyPenitent/MyModel" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LazyPenitent/MyModel", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/LazyPenitent/MyModel
- SGLang
How to use LazyPenitent/MyModel with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "LazyPenitent/MyModel" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LazyPenitent/MyModel", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "LazyPenitent/MyModel" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LazyPenitent/MyModel", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use LazyPenitent/MyModel with Docker Model Runner:
docker model run hf.co/LazyPenitent/MyModel
File size: 3,964 Bytes
fd06215 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | ---
library_name: transformers
pipeline_tag: text-generation
tags:
- speculative-decoding
- dspark
- dflash
- specforge
- sglang
- long-context
inference: false
---
# Kimi K3 DSpark speculator
## Overview
A long-context DSpark speculator for
[Kimi K3](https://huggingface.co/moonshotai/Kimi-K3). It supports context lengths of up to 1 million tokens.
A DSpark speculator for the Kimi K3 target, enabling faster inference through speculative decoding.
DSpark extends the DFlash parallel-draft backbone with a Markov logit-bias head and a per-position confidence head. This checkpoint was trained with [SpecForge](https://github.com/sgl-project/SpecForge/) using hidden states from a live SGLang target engine.
## Model Specifications
- **Base model:** `moonshotai/Kimi-K3`
- **Format:** Safetensors (single-file BF16, 2,249,289,601 parameters)
- **Draft:** 5 full-attention Qwen3-style GQA layers, hidden size 7168,
64 query heads / 16 KV heads, and `block_size=7`
- **Verification width:** 1 current token + 7 draft tokens
- **Auxiliary target layers:** `[7, 23, 51, 67, 83]`
- **Trained context:** 65,536 tokens
- **Target weights:** embedding and unembedding weights are not included
## Evaluation Results
`acc_len` is SGLang's histogram-native request acceptance length, averaged
within each question and then equally across questions.
| Dataset | Questions | acc_len |
|---|---:|---:|
| SWE-Rebench | 50 | **4.6594** |
| GSM8K | 1,319 | **5.4176** |
| MATH500 | 500 | **4.1329** |
| HumanEval | 164 | **5.5121** |
| MBPP | 257 | **5.1980** |
| MT-Bench | 80 | **3.9342** |
| AIME26 | 30 | **2.9893** |
| RULER V2 1M (MK/MV/QA) | 150 (50 per partition) | **4.2553** |
RULER V2 uses the 1M input configuration. Actual prompts span
1,000,432β1,047,925 tokens; partition acc_len is 4.4658 for MK, 4.3081 for
MV, and 3.9919 for QA.
### AIME26 acc_len by output length
| Output-token bucket | Questions | Actual output range | acc_len |
|---|---:|---:|---:|
| 0β1K | 13 | 192β885 | **3.1310** |
| 1β2K | 5 | 1,359β1,828 | **2.5773** |
| 2β4K | 6 | 2,210β3,732 | **2.5632** |
| 4β8K | 4 | 5,187β7,750 | **2.7174** |
| 8β16K | 0 | β | β |
| 16β32K | 0 | β | β |
| 32K+ | 2 | 54,545β224,703 | **4.9194** |
## Serving with SGLang
[SGLang Cookbook](https://lmsysorg.mintlify.app/cookbook/autoregressive/Moonshotai/Kimi-K3#hw=b300&pdMode=unified&strategy=low-latency&spec=dspark&hicache=off) provides Kimi K3 deployment recipes.
```bash
sglang serve \
--trust-remote-code \
--model-path moonshotai/Kimi-K3 \
--tp-size 8 \
--dcp-size 8 \
--mem-fraction-static 0.85 \
--max-mamba-cache-size 160 \
--max-running-requests 32 \
--cuda-graph-max-bs-decode 32 \
--reasoning-parser kimi_k3 \
--tool-call-parser kimi_k3 \
--host 0.0.0.0 \
--port 30000 \
--speculative-algorithm DSPARK \
--speculative-draft-model-path RadixArk/Kimi-K3-DSpark \
--speculative-dspark-block-size 7 \
--speculative-draft-attention-backend trtllm_mha \
--enable-linear-replayssm-spec \
--context-length 1048576 \
--chunked-prefill-size 16384
```
YaRN-16 is enabled in the published draft config by default with
`original_max_position_embeddings=65536` and
`max_position_embeddings=1048576`; no separate draft config override is
required.
## Training Details
- **Framework:** SpecForge online distillation, with hidden states captured from a frozen Kimi K3 target served by a live SGLang engine. Draft trained from random initialization.
- **Loss:** `0.1 CE + 0.9 L1 distillation + 1.0 confidence BCE`, decay gamma 4.0, with 512 sampled anchors per sequence and `block_size=7`.
- **Topology:** 4 nodes Γ 4 GB300 (16 ranks) β 2 Γ TP8 target replicas, DP2 sampler, FSDP16 `SHARD_GRAD_OP` on the draft, TP-batch scatter. Batch 8 per replica Γ 32 accumulation steps Γ 2 replicas = global batch 512.
|