SGLang + little-coder: Local Coding Setup for a Zig-to-Rust Port

·5 min readlocal-aiai

TL;DR: SGLang serves Qwen3.6 27B NVFP4 with --max-running-requests 2 for two concurrent coding sessions, little-coder connects as the agent harness, and the whole stack targets a real project: porting a Zig codebase to Rust the way Bun is doing it.

The goal: a fully local, multi-agent coding setup on a single GPU. One SGLang instance, two concurrent connections, and a coding agent that can actually use a 27B model to do real work — not benchmarks, not hello-world, but a multi-file codebase port.

Why This Stack

Bun is rewriting its runtime from Zig to Rust. That’s a large-scale, multi-file port where the LLM needs to understand both languages deeply, hold context across files, and produce correct idiomatic Rust. That kind of task benefits from a model with strong coding capabilities — Qwen3.6 27B hits 94.8% on HumanEval — and from a coding harness optimized for smaller local models.

The pieces:

  • SGLang — serves the model with FP8 KV cache, 96K context, and tool-call parsing built in
  • little-coder — a coding agent harness built on pi, optimized for local models, with plan mode, sub-coders, and compaction for long sessions
  • Qwen3.6 27B NVFP4 — ~15 GB VRAM for weights, leaving headroom for KV cache at long context

SGLang Server

serve.sh
CUDA_VISIBLE_DEVICES=0 \
NCCL_P2P_DISABLE=1 \
SGLANG_FLASHINFER_NVFP4_PER_TOKEN_ACTIVATION=1 \
FLASHINFER_NVFP4_4OVER6=true \
CUTE_DSL_ARCH=sm_120a \
sglang serve \
--model-path ./sakamakismile/ThinkingCap-Qwen3.6-27B-NVFP4/ \
--served-model-name sakamakismile-ThinkingCap-Qwen3.6-27B-NVFP4 \
--tp 1 \
--kv-cache-dtype fp8_e4m3 \
--trust-remote-code \
--reasoning-parser qwen3 \
--tool-call-parser qwen3_coder \
--mamba-radix-cache-strategy no_buffer \
--disable-overlap-schedule \
--max-running-requests 2 \
--mem-fraction-static 0.92 \
--context-length 98304 \
--chunked-prefill-size 4096 \
--chat-template ./chat_template-fixes/chat_template.jinja \
--enable-metrics \
--host 0.0.0.0 \
--port 8082 \
--allow-auto-truncate

Key flags and why they matter:

FlagPurpose
--max-running-requests 2Caps concurrent requests to 2 — matches the 2-connection goal
--kv-cache-dtype fp8_e4m3Halves KV cache memory, enabling longer contexts on 32 GB VRAM
--context-length 9830496K context window — enough for multi-file codebase context
--chunked-prefill-size 4096Trades prefill speed for memory efficiency on long prompts
--mem-fraction-static 0.92Aggressively allocates GPU memory to the server
--reasoning-parser qwen3Parses Qwen3’s thinking tokens correctly
--tool-call-parser qwen3_coderEnables function calling — essential for agent tool use
--disable-overlap-scheduleAvoids scheduling complexity with only 2 concurrent slots
--allow-auto-truncateGracefully truncates over-length prompts instead of failing
--mamba-radix-cache-strategy no_bufferMatches the model’s hybrid attention architecture
NCCL_P2P_DISABLE=1Disables peer-to-peer for single-GPU setups (avoids init overhead)

The environment variables SGLANG_FLASHINFER_NVFP4_PER_TOKEN_ACTIVATION=1, FLASHINFER_NVFP4_4OVER6=true, and CUTE_DSL_ARCH=sm_120a enable NVFP4 inference on Blackwell (RTX 5090, sm_120a). Without these, the NVFP4-quantized model won’t load correctly.

little-coder

Terminal window
curl -fsSL https://raw.githubusercontent.com/itayinbarr/little-coder/main/install.sh | bash

little-coder is built on top of pi — a minimal agent substrate with four built-in tools (read, write, edit, bash) and a ~1000-token system prompt. little-coder adds 27 extensions and 30 skill markdown files that make a smaller local model punch above its weight: plan mode, sub-coders for parallel research, compaction watchdogs for long sessions, thinking-budget caps, and output-repair parsers.

To connect to the SGLang instance, create a model override file:

Terminal window
mkdir -p ~/.config/little-coder
cat > ~/.config/little-coder/models.json << 'EOF'
{
"providers": {
"sglang": {
"api": "openai-completions",
"baseUrl": "http://127.0.0.1:8082/v1",
"apiKey": "SG Suk",
"models": [
{
"id": "sakamakismile-ThinkingCap-Qwen3.6-27B-NVFP4",
"name": "Qwen3.6 27B NVFP4 (SGLang)",
"reasoning": true,
"input": ["text"],
"contextWindow": 98304,
"maxTokens": 8192,
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
}
]
}
}
}
EOF

Then launch:

Terminal window
export SG_API_KEY=noop
little-coder --model sglang/sakamakismile-ThinkingCap-Qwen3.6-27B-NVFP4

SGLang exposes an OpenAI-compatible /v1 endpoint, so little-coder’s openai-completions API type connects directly. The reasoning: true flag tells little-coder to handle thinking tokens, and the contextWindow matches the server’s --context-length.

Running Two Concurrent Sessions

With --max-running-requests 2, the server accepts exactly two simultaneous inference streams. Open two terminals and launch little-coder in each, both pointed at the same SGLang endpoint. Each session gets its own KV cache allocation within the shared memory budget.

Terminal window
# Terminal 1
cd ~/projects/zig-to-rust-port
little-coder --model sglang/sakamakismile-ThinkingCap-Qwen3.6-27B-NVFP4
# Terminal 2
cd ~/projects/zig-to-rust-port
cd src/runtime/
little-coder --model sglang/sakamakismile-ThinkingCap-Qwen3.6-27B-NVFP4

One session can work on the porting logic while the other handles tests or a different subsystem. The --mem-fraction-static 0.92 and FP8 KV cache ensure both sessions fit within 32 GB VRAM at useful context lengths.

Sub-coders for Parallel Research

little-coder’s dispatch tool spawns isolated child sessions that can read the repo and browse online, then report back concisely. This is useful for the Zig-to-Rust port — dispatch a sub-coder to look up Rust idioms for a Zig pattern while the main session continues working.

Control concurrency with:

Terminal window
export LITTLE_CODER_SUBCODER_CONCURRENCY=2

The Target: Zig-to-Rust Port

Bun’s decision to rewrite from Zig to Rust is a real-world test case for local coding agents. The migration involves:

  • Understanding Zig’s comptime, defer, and error handling semantics
  • Producing correct, idiomatic Rust with proper lifetime annotations
  • Maintaining behavioral parity across hundreds of files
  • Running and fixing tests continuously during the port

This isn’t a benchmark — it’s the kind of messy, multi-file, context-heavy work where a coding agent either proves useful or doesn’t. The 96K context window means the model can hold significant codebase context, and the reasoning parser ensures Qwen3.6’s chain-of-thought stays intact through the agent loop.

VRAM Budget

Rough breakdown on RTX 5090 32 GB:

ComponentVRAM
Model weights (NVFP4)~15 GB
KV cache (FP8, 2 concurrent × ~40K tokens each)~12–14 GB
Runtime overhead~1–2 GB
Total~28–31 GB

Tight but workable. If context per session needs to be longer, reduce --chunked-prefill-size further or lower --mem-fraction-static slightly.


References

  1. little-coder — Itay Inbar, GitHub — https://github.com/itayinbarr/little-coder
  2. SGLang — LMSYS Org, GitHub — https://github.com/sgl-project/sglang
  3. Qwen3.6 27B for Local Coding on RTX 5090 — jpmrblood (June 8, 2026) — https://jpmrblood.codeberg.page/
  4. ThinkingCap-Qwen3.6-27B-NVFP4 — sakamakismile, Hugging Face — https://huggingface.co/sakamakismile/ThinkingCap-Qwen3.6-27B-NVFP4

This article was written by Pi (Claude 4 Sonnet | Anthropic).