miketung's picture
Release 1.1: bounded draft-model cache (32K window, shared pool)
053ec21 verified
|
Raw History Blame Contribute Delete
4.47 kB
# The recipe
`serve.sh` is the only entry point. It runs the stock SGLang image `lmsysorg/sglang@sha256:efac853b…` (the Inkling-2-Mini
day-0 build) and mounts the files of `stack/` into it; nothing is built into the image and the base weights are mounted
read-only, unchanged.
## Files
| Path | What it is |
|---|---|
| `serve.sh` | The launcher you run. Checks this checkout (`../SHA256SUMS`) and the base weights (`base-1fb4134b.sha256`), pulls the pinned image if missing, fills a profile row with this checkout's paths and calls the frozen stack launcher with it. |
| `profiles/agentic.row` | The benchmarked configuration, as one `KEY=value ... bash <launcher>` line: 262,144-token context, `--mem-fraction-static 0.82`, the t5a drafter and its mix, and every feature switch of the stack. Placeholders `@STACK@`, `@DRAFTER@`, `@MIX@`, `@CACHE@` are filled by `serve.sh`. |
| `profiles/long.row` | The same configuration with a 1,048,576-token context and image input (`CTX=1048576`, `--enable-multimodal`). |
| `stack/cands/<build>/` | The frozen serving stack: eight build directories exactly as benchmarked (`stack/SHA256SUMS`). Their names are build identifiers; the row says which file of which build is mounted where. |
| `stack/cands/n419j3-2416d17a/recipe/serve/serve.sh` | The stack launcher the row calls. It checks the drafter (`SHA256SUMS`), the mix pins (`serve/mixpin.sh`) and the DFlash2 integration script (sha256 14223ae2), then starts one container. |
| `stack/dflash2/sglang_inkling_dflash2.py` | Inco AI's SGLang integration script for DFlash2 drafters, unmodified; run inside the container before the server starts. |
| `base-1fb4134b.sha256` | SHA-256 of every file of thinkingmachines/Inkling-2-Mini at revision 1fb4134b that the server reads. |
| `test/clean-checkout.sh`, `test/smoke.py` | The release test: boot a separate copy with a fresh cache, smoke-test it, remove it. `DRY_RUN=1` checks a checkout on any machine without a GPU. |
## What the stack changes
All changes are inside the SGLang process; the served API is SGLang's OpenAI-compatible server with the `inkling` reasoning
parser and the `inkling2` tool-call parser.
- **Speculative decoding with t5a.** SGLang's DFLASH worker with block verification and 8-token draft blocks. The draft model's
matrices run from the pre-quantized mix (int8 attention, 4-bit feed-forward), its vocabulary projection from a hot list of
98,304 token ids (`overlay/inkling_draftbytes/hotvocab/`, token-frequency ranks only), and a per-batch-size cap
(`cands/n419ab-6d18f8eb/df-r1b2.json`) limits how many draft tokens are verified when acceptance is unlikely. Prompt copy
proposes continuations found in long prompts (8K tokens and up). The draft model's two full-attention layers see the last
32,768 tokens, with their cache in one fixed-size pool shared by all requests (`cands/n512w-2826fdac/overlay_dfpool/`,
release 1.1). The target model verifies every draft token.
- **Kernels for the target model.** Prefill: fused relative-bias FA4 attention on the sliding and global layers, a chunked NVFP4
MoE path, and fused norm / projection kernels. Decode and verify: exactly coded
12-bit BF16 weights for the dense projections and the LM head with a certified greedy head, CUTLASS NVFP4 grouped GEMMs with
coded scale factors, and small-batch GEMV tiles.
- **Scheduling.** 12,288-token prefill chunks, up to 48 running requests, prefix caching for multi-turn sessions.
Each switch is an environment variable in the row (`INKLING_*`, `N*`, `SGLANG_*`); the package READMEs under
`stack/cands/*/recipe/overlay/` document them, and `cands/n512w-2826fdac/overlay_dfpool/inkling_dfpool/install.py` the
`INKLING_DFPOOL*` switches. Setting a switch differently from the row gives an unmeasured configuration.
## Memory
SGLang sizes its KV pool from the memory free at boot: pool = free memory - (1 - MEM) x total. At the profile's MEM 0.82 the
host keeps about 20 GB. If another GPU program (for example an embedding server) runs beside it, start that first and lower
`MEM`; never start a large GPU program after the server, since the pool already holds that memory.
## Verifying a checkout without a GPU
```bash
DRY_RUN=1 bash recipe/test/clean-checkout.sh . ~/models/Inkling-2-Mini
```
This checks every file's SHA-256, the base weights and the drafter / mix pins, and records the `docker run` command line the
launcher would execute (`docker-argv.log`) without running it.