/kaggle-tools:kaggle-llm-servingfrom kaggle-tools
Optimizes vLLM throughput on Kaggle GPUs (4x L4, 2x T4, single 24 GB cards) for LLM inference. Covers tensor vs data parallel, fitting 20-30B models, KV-cache limits, speculative decoding, int4/fp8 quantization, and benchmarking before spending quota.
Ships in kaggle-tools. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
On Kaggle's 4x L4 (24 GB, ~300 GB/s, PCIe, no P2P) aggregate decode tokens/s = running streams x per-stream rate. The stream count is capped by memory (KV + per-stream state), so serving work is mostly a memory problem. Evidence below is from ARC Prize 2026 ARC-AGI-2 (Qwen3.8-27B, vLLM 0.31, Oct 2026).
Faster serving is not a better score. Every config change goes through a quality gate at a fixed token budget before it reaches a submission. See the Quality gate section.
Throughput numbers are only comparable when the bench follows these rules:
running, waiting, KV%, the MTP acceptance length (AL) and the context at the start and
end of the window. When KV is near 100% with requests waiting, you are capacity-bound.| layout | what limits it | measured (Qwen3.8-27B) |
|---|---|---|
| FP8, TP4, MTP3, 16 streams | SHM all-reduce: ~80-100 ms per verify step at 32 streams | 345-353 tok/s; 24 streams 378 (+6.6%); 32 streams 393 |
| INT4, TP2 x 2 replicas | KV: ~12 running per replica | 233 per replica (RunPod) |
| INT4, TP1 x 4 (DP4) + the memory stack below | KV + state slots | 239 tok/s per L4 at 14.2 running; 2xL4 measured 447.6 (220.7 per server), so 4x is about 900 |
DP4 has no inter-GPU traffic, so the slow link stops mattering. It only works when the model fits on one 24 GB card with room for KV. A 27B at FP8 (~27 GB) does not fit, so DP4 means 4-bit weights. If 4-bit costs too much accuracy, the remaining options are FP8 TP4 at more streams or TP2 x 2. "About 900" is projected from the 2xL4 run; the 4xL4 DP4 run never happened.
One DP4 replica: one server per GPU, each pinned with CUDA_VISIBLE_DEVICES, and the client
keeps each session on the same server so prefix-cache hits survive.
CUDA_VISIBLE_DEVICES=$i VLLM_EMBED_UVA=1 VLLM_SPEC_DECODE_ATTN=1 VLLM_INT4_MQ_3D=1 \
python -m vllm.entrypoints.openai.api_server --model $INT4_CKPT --port $((8000+i)) \
--tensor-parallel-size 1 --gpu-memory-utilization 0.95 --max-model-len 65536 \
--max-num-seqs 16 --max-num-batched-tokens 1024 --kv-cache-dtype int4_per_token_head \
--attention-backend TRITON_ATTN --mamba-ssm-cache-dtype float16 --language-model-only \
--enable-prefix-caching --use-replayssm --mamba-backend triton \
--speculative-config '{"method":"mtp","num_speculative_tokens":3}'
Several of these flags and env vars are not in stock vLLM 0.31:
int4_per_token_head, VLLM_EMBED_UVA and VLLM_INT4_MQ_3D come from the HyperQwen patch series
(syv-ai/HyperQwen, commit ce9615c: 51 Python files).--use-replayssm is a backport of the upstream RecoverSSM PRs.Ship the patched files as a Kaggle dataset and put that copy ahead of the installed package on
PYTHONPATH. That leaves the installed package untouched, and you can hash-check the files at boot.
| lever | effect |
|---|---|
| W4A16 INT4 body (RedHat) + int8 lm_head, embeddings and MTP head; 40,960-row draft vocab | weights 13.9 GiB |
Embeddings in pinned host RAM (VLLM_EMBED_UVA=1, HyperQwen) | frees ~1.3 GB of VRAM |
--max-num-batched-tokens 1024 | peak activation 1.5 GiB -> 0.38 GiB |
gpu_memory_utilization 0.95 | 0.97 OOMs in the sampler prewarm |
int4 per-token-head KV + VLLM_INT4_MQ_3D=1 | KV pool 137k -> 289k tokens. Without MQ_3D, the MTP verify falls back to a serial path: 3.6 vs 29 tok/s at 72k |
| fp16 GDN/Mamba state | halves the per-stream state |
| RecoverSSM (replay; upstream vLLM PRs #58863/#61309/#62625, backported) | drops the K draft state slots: 15 -> 6 blocks per stream; running streams 8 -> 12 |
Hybrid models (GDN or Mamba layers) pay a hidden per-stream cost. Each stream holds
groups x (1+K) state blocks, or groups x (2+K) with prefix caching (align mode). For
Qwen3.8-27B with MTP3 that is 15 blocks, or 435 MB: the same as 12.5k fp8 KV tokens, before any
context. KV quantization shrinks only the context part, so int4 KV gave ~1.5x more streams,
not 2x. On a capacity-bound server, MTP1 beat MTP3 (197 vs 176 tok/s) until RecoverSSM freed
the slots. With RecoverSSM, MTP3 won (239 vs 206).
BLOCK_M=32, fp16 dot (not TF32) and TILE=32 made it 2.0x faster (2.46 -> 1.23 ms per layer)
and more accurate against an fp64 reference. Microbench one kernel at N=8, 29k context, 4 rows
per sequence before and after a change.use_local_argmax_reduction remove that traffic.NCCL_SHM_USE_CUDA_MEMCPY=1: the server hung at load.NCCL_P2P_DISABLE=1, which also matches Kaggle. RunPod 4xL4 ran at 78% of Kaggle's speed
on the same config, so compare A/Bs only on the same host.REQUIRED BACKGROUND: kaggle-code-competitions (offline wheels, re-run limits) and kaggle-llm-reasoning (agent and voting side).
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
vllm, kaggle, llm-serving, throughput-tuning, gpu-optimization
npx claudepluginhub yassinealouini/kaggle-tools --plugin kaggle-tools9 skills in this plugin
/kaggle-audio-bioacousticsUse when working on Kaggle audio/bioacoustics competitions like BirdCLEF — row_id parsing, pretrained bioacoustic backbones (Perch, BirdNET), per-species probes, temporal models, mel spectrograms, CV/LB gap, rare and zero-sample species, CPU inference budget/kaggle-code-competitionsUse when working on any Kaggle code competition — notebook submission, data paths, offline packages, GPU/accelerator choice, kernel push workflow, time limits, or debugging "Submission Scoring Error", TIMEOUT and NO_SCORE/kaggle-competition-playbookUse when starting, planning or steering any Kaggle competition — reading the metric, choosing CV, deciding which experiment to run next, interpreting CV/LB gaps, ensembling, and managing submission/GPU quota/kaggle-leaderboard-analysisCompare Kaggle public and private team positions, or plot an account's competition history as top percentages by year with readable paginated figures. Use for leaderboard shakeups, finishing positions, and competition progress reports./kaggle-llm-finetuningUse when fine-tuning LLMs (LoRA/QLoRA, SFT, GRPO) inside Kaggle competitions — TRL/PEFT setup, packing, completion-only loss, data quality, adapter submission format, GPU quota and 12 h kernel limits/kaggle-llm-reasoningUse when working on Kaggle LLM reasoning/inference competitions like AIMO — model choice, vLLM on H100, tool-integrated reasoning (TIR), self-consistency voting, answer extraction, inference-server API, time budget, offline tokenizer filesOther plugins' skills for the same job