Skip to content

[Model] Add Inkling 2 Mini Fixed and VarLoop support - #214

Merged
bjf-frz merged 1 commit into
InferMatrixLab:mainfrom
bjf-frz:feature/inkling2-mini-full-20261124
Nov 24, 2026
Merged

bjf-frz merged 1 commit into
InferMatrixLab:mainfrom
bjf-frz:feature/inkling2-mini-full-20261124

Conversation

@bjf-frz

@bjf-frz bjf-frz commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Purpose

Add single-GPU CUDA text generation for Inkling 2 Mini Fixed and TML-d24-varloop-research. This is the full reviewed integration on top of the standalone revert in #213. The original integration and its review history are in #210.

Both checkpoints share an RLT model wrapper and the vLLM Inkling operators on SM10x. RLT manages per-pass KV and short-convolution state, packed prefill, Mixed scheduling, and startup graph warmup. VarLoop uses the startup --max-loops setting. The integrated loop optimizations include WCPB and optional adaptive sizing, asynchronous self-speculative decode, batched draft/target vocabulary projection and Coda layers, and optional speculative pipeline graphs.

Automatic KV planning reuses the serving attention implementation when profiling the model. The adaptive scheduler reads the actual KV pool's page counts and geometry. It can choose a chunk at admission, reserve pages for queued decode growth, and fill spare batch rows with already-staged, consecutive chunks at the same Core depth.

Required human contributor answers

The contributor's reviewed outcome, highest-leverage variable, intended impact, users, and decision to submit are recorded in #210's contributor answers. The maintainer approved the final workspace implementation and requested a new full PR after a standalone revert. This PR is needed to publish the reviewed runtime changes, regression coverage, and performance comparison together.

Baseline performance against vLLM

Baseline RLT uses Mixed scheduling, packed prefill, asynchronous scheduling, and startup CUDA Graph warmup. WCPB and self-speculation are disabled. The vLLM reference is target-only at revision 3146a9df4140. The comparison uses TML-d24-varloop-research at revision 657b53ba5da7baefe9ff15dca5cd25f5bd3dbaa2 and three target Core passes, BF16, per-pass KV, and a 1,024-row query budget. RLT uses the 256-token chunk for W3 and 1,024 for W1 and W7, with 96 graph rows and entries. Each reported point is the median of three unprofiled waves on B300. The W7 C4 software pair used separate B300s on the same host. The other workload rows are same-card pairs.

Workload RLT baseline (output tok/s) vLLM (output tok/s) RLT / vLLM
W1 C1, 128 input / 128 output 259.1 263.1 98.5%
W3 C4, 4,096 input / 128 output 455.6 570.3 79.9%
W3 C16, 4,096 input / 128 output 621.2 1,055.3 58.9%
W7 C4, 48 real prompts 784.9 832.7 94.3%
W7 C16, 96 real prompts 2,078.9 2,275.8 91.3%
W7 C32, 256 real prompts 3,142.0 3,694.0 85.1%

W7 uses natural EOS and a 512-token output limit. These baseline results show the initial gap on long prompts and the three W7 concurrency levels.

W7 C32 reproduction

Run on one B300 with BF16 weights and KV, T3 per-pass KV, and 32 concurrent streaming requests. The checkpoint is VarLoop at 657b53b. RLT reserves 25,344 physical pages across three passes. vLLM reserves 8,449 logical pages including its empty page. With 16 tokens per page, both runs have 8,448 usable logical pages, or 135,168 token positions.

The W7 corpus contains 256 ordered first-turn ShareGPT prompts. From ShareGPT_V3_unfiltered_cleaned_split.json, shuffle record indices with Python's random.Random(20261021).shuffle, keep records whose first turn is from human or user and spans 16–4,096 tokens with the Ouro-1.4B tokenizer, and take the first 256. With the Inkling tokenizer the corpus is 76,810 input tokens, with lengths of 13–3,149 tokens. The dataset file SHA-256 is 35f0e213ce091ed9b9af2a1f0755e9d39f9ccec34ab281cd4ca60d70f6479ba4. The ordered text array SHA-256 is 0aa122fd181fffc1b72731d0fcba133a1f7a2348f12ea3b34e5290feff708487 when serialized as compact UTF-8 JSON with ensure_ascii=False.

For each benchmark, send 32 unmeasured warmup prompts at zero-based indices 4, 12, …, 252. Run three unprofiled 256-request waves against /v1/completions with model=inkling, temperature=0, max_tokens=512, ignore_eos=false, stream=true, and stream_options={"include_usage":true}. Submit prompts in corpus order, with 32 client lanes that refill as requests complete. Divide successful output tokens by elapsed time from launching the wave to the final completion, including the drain. The tables use median throughput.

The RLT commands below use the current CLI names. Launch with an empty extra array for the baseline and the shown flags for the batched-Coda run. Point VARLOOP_MODEL at the pinned local snapshot.

extra=()
# For the batched-Coda run, replace the line above with this array.
# extra=(--wavefront-chunked-prefill --speculative-mode pipeline
#        --speculative-tokens 2 --draft-loops 1 --target-loops 3)
python -m vllm_rlt.entrypoints.serve \
  --model "$VARLOOP_MODEL" --max-loops 3 --device cuda --dtype bfloat16 \
  --mode mixed --packed-prefill --prefill-chunk-size 1024 \
  --attention-backend triton --num-blocks 25344 --block-size 16 \
  --max-num-seqs 32 --max-num-batched-tokens 1024 --request-timeout 600 \
  --cuda-graphs --cuda-graph-max-batch-size 96 --cuda-graph-max-graphs 96 \
  --packed-graph-buckets --cuda-graph-warmup --min-coda-batch-size 1 \
  --async-scheduling --served-model-name inkling --host 127.0.0.1 --port 19624 \
  "${extra[@]}"

Launch target-only vLLM at 3146a9df4140 with the same checkpoint and client settings.

VLLM_KV_CACHE_LAYOUT=LBHNC vllm serve "$VARLOOP_MODEL" \
  --language-model-only --tensor-parallel-size 1 --max-model-len 8192 \
  --no-enable-prefix-caching --enable-chunked-prefill --generation-config vllm \
  --disable-log-requests --cudagraph-metrics --dtype bfloat16 \
  --max-num-seqs 32 --max-num-batched-tokens 1024 --async-scheduling \
  --hf-overrides '{"text_config":{"loop_num_passes":3,"loop_share_cache":false}}' \
  --block-size 16 --kv-cache-dtype bfloat16 --disable-hybrid-kv-cache-manager \
  --num-gpu-blocks-override 8449 --served-model-name inkling \
  --host 127.0.0.1 --port 19624
Recorded mode Wave 1 (output tok/s) Wave 2 Wave 3 Successful requests per wave
RLT baseline 3,142.02 3,202.28 3,087.75 256
RLT batched Coda 4,103.82 4,125.09 4,113.31 256
vLLM target-only 3,662.81 3,694.03 3,698.76 256

Runtime feature switches

Feature Activation
Mixed scheduling and async submission Set --mode mixed --async-scheduling.
Packed prefill and startup CUDA Graph warmup Set --packed-prefill --cuda-graphs --packed-graph-buckets --cuda-graph-warmup to reproduce the benchmark settings. CUDA Graph capture and startup warmup are explicit options.
WCPB Add --wavefront-chunked-prefill. Add --adaptive-wavefront-prefill to opt into adaptive sizing within the configured chunk and token budget. The batched-Coda benchmark uses static WCPB.
Async self-speculation and Coda batching Use --speculative-mode pipeline --speculative-tokens 2 --draft-loops 1 --target-loops 3 with async scheduling. Eligible pipeline paths use shared Coda computation and vocabulary projection automatically.
Pipeline CUDA Graphs The default --speculative-pipeline-graph off uses staged execution with per-stage Graphs where eligible. Opt into transition for pipeline acceptance and updates, or full for eligible dense decode rounds. The batched-Coda benchmark uses the default.
UVA staging Enabled by default where supported. Set --no-uva to use DMA staging.

Incremental loop optimizations

Each row uses its own A/B pair. The percentages describe that pair's throughput change. Queue settings, sample sizes, and source revisions vary across the individual experiments.

Optimization Matched workload Before → after (output tok/s) Change
WCPB alone W3 C16, 256-token chunk / 1,024-row budget 621.2 → 781.6 +25.8%
WCPB alone W7 C32 3,142.0 → 3,152.7 +0.3%
Async self-speculative decode pipeline, draft pass 1, target pass 3, K=2 W7 C32, WCPB enabled in both arms 3,152.7 → 3,730.6 +18.3%
Shared draft/target vocabulary projection W7 C32, pipeline K=2 3,671 → 3,731 +1.6%
Shared linear projections and MoE batch within each Coda layer W7 C32, starting from the shared vocabulary projection 3,730.59 → 4,113.31 +10.3%
Input bank reuse, asynchronous staging, Coda Graph reuse, and pipeline Graph follow-up W7 C32, separate 96-request sample 4,010.37 → 4,132.37 +3.0%
Adaptive WCPB with same-depth fill W3 C16, chunk ceiling 1,024, budget 3,072 992.00 → 1,055.56 +6.4%
Adaptive WCPB with same-depth fill, adaptive arm run first Same W3 C16 settings on a second B300 1,037.48 → 1,065.10 +2.7%
  • W3 C1 same-depth fill reduced TTFT P50 from 80.46 to 69.75 ms and increased throughput from 227.00 to 231.29 tok/s. W3 C4 throughput was close, at 541.60 versus 545.23 tok/s. The two C16 adaptive pairs have overlapping per-wave throughput ranges. Earlier adaptive sizing without same-depth fill reached 823.56 versus 830.12 tok/s on W3 C16 at a reduced 9,492-block KV capacity.
  • Target-to-draft attention and short-convolution ordering is preserved while their Coda projections and MoE operations share a batch. The layer batching result is incremental over the shared vocabulary projection.
  • In the isolated 128-event-queue W7 C32 comparison, transition and full pipeline Graphs improved throughput by 1.04% and 2.37% over the updated staged path. Full Graph ITL P99 rose from 27.88 to 29.06 ms. UVA and DMA throughput overlapped across repetitions. The full Graph remains an explicit mode.
  • The grouped follow-up improved W1 C1 from 307.52 to 324.90 tok/s. The W4 C32 pair moved from 1,133.88 to 1,140.68 tok/s. These have separate workload and queue definitions from the baseline table.

Optimized RLT against vLLM

These are the same-card VarLoop T3 comparisons at the batched-Coda stage. RLT uses the asynchronous K=2 pipeline, with WCPB enabled for W7. vLLM is target-only. Each point is a median of three unprofiled waves.

Workload RLT (output tok/s) vLLM (output tok/s) Throughput change TTFT P50 RLT / vLLM (ms) TPOT P50 RLT / vLLM (ms) ITL P99 RLT / vLLM (ms)
W1 C1 309.95 261.37 +18.6% 11.47 / 16.24 3.16 / 3.73 8.74 / 4.96
W7 C4 960.82 835.49 +15.0% 50.00 / 36.69 4.02 / 4.72 11.38 / 5.73
W7 C16 2,530.90 2,275.75 +11.2% 64.37 / 38.74 5.96 / 6.83 25.55 / 11.87
W7 C32 4,113.31 3,694.03 +11.4% 66.77 / 66.32 7.31 / 8.39 27.62 / 17.04

Long-prompt throughput and token tail latency remain areas for improvement. In the separate W4 C32 comparison at a 2,048-row budget, RLT WCPB reached 1,089.46 tok/s versus 1,371.91 for vLLM. Adding the K=2 pipeline to that RLT configuration reduced throughput to 1,027.49 tok/s while reducing TPOT P50 from 10.83 to 9.81 ms. In W3 C16 at the baseline table's smaller budget, WCPB alone reached 781.6 versus 1,055.3 tok/s for vLLM.

vLLM DSpark results by checkpoint

These W7 C32 runs use vLLM 3146a9df4140, the same 256-prompt workload, BF16 per-pass KV, and 16-token KV pages. Each checkpoint uses three Core passes. The DSpark arm adds --speculative-config '{"method":"dspark","num_speculative_tokens":7}' and loads that checkpoint's mtp.safetensors. Each pair uses the same GPU for its control and DSpark runs. The VarLoop vLLM reference in the main tables remains target-only.

Checkpoint Target-only (output tok/s) DSpark K=7 (output tok/s) Throughput change Measured waves, target-only / DSpark
Fixed Inkling-2-Mini 3,727.76 6,688.10 +79.4% 1 / 2
VarLoop TML-d24-varloop-research, T3 3,694.58 2,806.41 −24.0% 2 / 2

Fixed + DSpark needs separate follow-up. The two Fixed DSpark waves reached 6,714.23 and 6,661.98 tok/s. Fixed median request TPOT fell from 8.30 to 3.92 ms. The near-1.8× throughput increase makes Fixed with its dedicated drafter an important reference when evaluating Fixed-loop performance. Fixed target-only was measured in one wave. VarLoop produced a throughput regression with DSpark in its paired runs. The Fixed checkpoint was pinned to b85c3cf.

Automatic KV startup reproducer

The #210 snapshot failed locally on B300 during the automatic KV memory probe with ValueError: packed queries require a compatible attention backend and KV layout. The trigger was VarLoop with Triton and Packed Prefill and no explicit KV pool size. The probe recreated the backend from its name and lost the packed capability. The expected behavior is to use the selected serving backend, finish planning the KV pool, and accept requests.

python -m vllm_rlt.entrypoints.serve \
  --model thinkingmachines/TML-d24-varloop-research --max-loops 3 \
  --device cuda --dtype bfloat16 --attention-backend triton \
  --mode mixed --packed-prefill --max-num-seqs 4 \
  --prefill-chunk-size 1024 --max-num-batched-tokens 3072

Test plan and results

  • GitHub CI for the replacement head passed Ruff lint and formatting (160 files checked) and the CPU test suite (1,308 passed, 916 skipped). The B300 serving check below is separate GPU evidence.
  • The replacement source at add9dd7 passed repository-wide pre-commit checks, covering Ruff lint, formatting, and the CPU suite. CI-pinned Ruff 0.13.2 lint and formatting also passed locally. Formatting in the publishing checkout preserved the reviewed Python syntax trees.
  • A native B300 smoke on the replacement source used VarLoop T3 BF16, Mixed, Packed Prefill, startup Graph warmup, async scheduling, and adaptive WCPB. The device probe allocated 26,024 physical KV blocks of size 16. After a four-request warmup, all four W3 requests completed with 4,096 input tokens and exactly 128 output tokens.
  • The original integration validation retains Fixed and VarLoop eager and Graph tests, loop-depth tests, and speculation lifecycle evidence. The reduced-memory and performance rows above retain the respective reviewed experiment snapshots. Native greedy output can vary across batch shapes and waves, and the throughput comparisons measure the recorded workloads.

Launch flags and model requirements are covered in the Inkling section of the launch guide.

@bjf-frz
bjf-frz merged commit 4821d47 into InferMatrixLab:main Nov 24, 2026
2 checks passed
HowardYangAI added a commit to HowardYangAI/vllm-rlt that referenced this pull request Nov 24, 2026
Resolve conflicts with the Inkling 2 Mini adaptation (InferMatrixLab#214):
- kv_cache_manager, stage_engine, memory, buffers: keep both sets of new
  keyword arguments and imports; grouped writes go through the retained
  _mark_prepared_write / packed_ranges path.
- scheduler: SWA submission-bounded chunking first, then the adaptive
  wavefront chunk, then the fixed prefill chunk size.
- model_runner: keep the packed/coda prefill structure, gated by
  _packs_prefill() since grouped storage cannot pack.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant