← Back to all articles
Local LLMsMoERTX 4050llama.cppPolyStrataCoding Agents

Inkling-2-Mini on RTX 4050 6GB 16GB RAM

Running Inkling 2 Mini at 34+ tok/s (and up to 100K Context) on a 6 GB RTX 4050 Laptop

• 18 min read
Inkling-2-Mini on RTX 4050 6GB 16GB RAM

Why I Left llama.cpp / Unsloth Studio (The 4K Wall)

This whole experiment didn't start because I wanted to compile a custom C++ inference engine for fun—it started because even heavily tuned llama.cpp couldn't make Inkling 2 Mini usable for coding on 6 GB of VRAM.

In llama.cpp (b12722-mix-f1c70ea via Unsloth v0.1.925-beta), I went well past stock settings: I turned off auto-fit, kept the 12 looped middle layers (blocks 6–17) in VRAM, manually offloaded the 12 outer layers' MoE experts to the CPU, pinned 8 threads strictly to my 4 Performance cores (0-7), turned on Flash Attention and active polling (--poll 100), and compressed the KV cache all the way down to q4_0 at a tiny 4,096-token context.

SettingValue
Engine / BuildUnsloth v0.1.925-beta (2026.11.12) · llama.cpp b12722-mix-f1c70ea
Backend / StackCUDA (Torch 2.11.0+cu130, Python 3.13.13)
Context / KV Cache4,096 tokens · q4_0 KV
Batch / Micro-batch1024 / 256 · Flash Attention on · Parallel slots 1
Manual Offload Flags-ot blk.(0|1|2|3|4|5|18|19|20|21|22|23).ffn_.*_exps.*=CPU -t 8 -tb 8 --cpu-range 0-7 --cpu-strict 1 --poll 100 --flash-attn on

Here is what that heavily tuned setup delivered on a short ~1.8K-token prompt (generating 223 tokens):

MetricTuned llama.cpp Result
Prompt eval / speed12.86 s (141.8 tok/s)
Time to first token13.82 s
Generation / speed17.30 s (12.8 tok/s)
Total wall time30.70 s (223 tokens)

Why it hit a wall: Static layer-regex offloading (-ot) is an all-or-nothing hammer. Even when you smartly keep the looped middle layers on the GPU, every single token still has to pause 12 times per forward pass while the CPU grinds through the outer layers' experts—leaving the RTX 4050 idle while waiting on system RAM bandwidth. At 12.8 tok/s and 4K context with aggressive 4-bit KV quantization, a multi-turn coding agent becomes painful to use.

That bottleneck is the exact reason I moved to PolyStrata (strata-poly), which manages individual routed experts dynamically in a VRAM cache instead of statically exiling whole layers to the CPU.

The Hardware & Model Setup

  • Laptop: Lenovo LOQ
  • GPU: NVIDIA GeForce RTX 4050 Laptop (6 GB GDDR6, 96-bit bus, 20 SMs, 80W TGP, Ada Lovelace sm_89)
  • CPU: Intel Core i5-12450HX (4 Performance cores / 8 threads + 4 Efficiency cores)
  • RAM: 16 GB dual-channel DDR5-5600 (~14 GiB usable in Ubuntu)
  • OS / Stack: Ubuntu 24.04 Linux, NVIDIA Driver 595.71, CUDA 13.2, GCC 13
  • Model: Inkling-2-Mini-UD-Q2_K_XL.gguf (9.14 GB Unsloth Dynamic 2-bit quant)
  • Engine: PolyStrata (strata-poly), compiled locally for sm_89

Why Inkling 2 Mini Is Surprisingly Friendly to 6 GB GPUs

Inkling 2 Mini has 24 physical layers, but its 12 middle layers run three times per token (acting like a 48-layer model). Normally, a 48-layer model would blow up KV cache VRAM at long contexts. Inkling avoids this because 40 of its 48 effective layers use a 1,024-token sliding window—only 8 global layers grow linearly with context length. At FP16, the KV cache costs just 32 KiB per token; at 8-bit (fp8 or q8_0), it drops to ~16 KiB per token.

Why PolyStrata Instead of Standard llama.cpp

On a 6 GB GPU, a 9.14 GB MoE model cannot fit entirely in VRAM. Standard layer-based offloading (-ngl) forces whole layers onto the CPU, leaving the GPU idle while waiting for slow CPU matrix multiplications. PolyStrata's strata-poly takes a different approach: it keeps all dense weights, attention, and loop controllers on the GPU, then manages the 3,072 routed experts as a dynamic VRAM cache—swapping hot experts into VRAM over PCIe while computing cold misses on the CPU in parallel.

Benchmarking Rules

To avoid fooling myself with placebo tweaks, every run followed four rules:

  1. One variable at a time. Never stack two new flags in the same test.
  2. P-core pinning. Always wrap the engine with taskset -c 0-7 and --threads 4 so offloaded CPU math stays on the 4 fast Performance cores instead of getting scheduled onto slow Efficiency cores.
  3. Deterministic prompts. Repeatable token files (/tmp/bench_1k.txt through /tmp/bench_100k.txt) with --max-new 128 and a dummy --eos-ids 9999999 so every run generates the exact same 128 tokens.
  4. Live GPU telemetry. Log nvidia-smi wattage, clocks, utilization, temperature, and VRAM every second during every run.

The Master Lab Notebook (Runs #01–#22)

RunContext (Prompt / Max)Change TestedExperts in VRAMPrefill (tok/s)Decode (tok/s)VRAM Hit %CPU / Router WaitVerdict
#011K / 8KBaseline defaults1,179 / 3,072133.810.7592.4%8.2 / 2.7 msBaseline
#021K / 8K+ --ram-experts-mib 40961,179 / 3,072186.914.0691.7%6.4 / 2.5 msKeep (temp)
#031K / 8K+ --attn-requant q5_k1,233 / 3,072171.316.2991.6%6.1 / 2.3 msKeep
#041K / 8K+ --expert-swaps 01,233 / 3,072204.37.7483.1%13.2 / 2.2 msDrop (-52%)
#051K / 8K#03 + --loop-bf161,233 / 3,072178.617.0692.1%5.4 / 2.3 msKeep
#061K / 8KDrop RAM cap (--lock-experts*)1,233 / 3,072255.723.0690.1%5.1 / 0.4 msBreakthrough
#071K / 8K--ram-experts-mib -1 + --kv fp81,245 / 3,072198.621.6491.2%6.1 / 0.4 msSkip at 1K
#081K / 8K#06 (-1) + --tail-skip 41,233 / 3,072215.634.3194.4%3.8 / 0.4 msKeep (+49%)
#091K / 8K+ --vram-reserve-mib 2561,337 / 3,072231.734.6794.8%3.5 / 0.4 ms1K Champion
#1016K / 32KSame as #09 (FP16 KV)1,337 / 3,072655.025.6797.4%0.1 / 0.9 ms16K Baseline
#1116K / 32K+ --kv fp81,351 / 3,072718.534.4997.8%0.1 / 0.9 ms16K Champion
#1232K / 64KSame as #11 (--kv fp8)1,351 / 3,072691.421.5197.0%0.1 / 1.1 ms32K Cliff
#1332K / 64K--kv q8_0 + STRATA_KV_INT8=11,343 / 3,072685.227.1196.9%0.0 / 1.1 ms32K Champion
#1432K / 64K#13 + STRATA_INK_FAST_CTRL=11,343 / 3,072635.824.0796.9%0.1 / 1.1 msDrop (-11%)
#1516K / 32KCUDA patch: kInt8From = 40961,343 / 3,072684.028.9497.7%0.1 / 0.9 msRevert
#1632K / 64KSTRATA_INK_SCORE_STEPS (1/2/4/8)1,343 / 3,072~63016.3–23.696.9%0.1 / 1.2 msNo magic bullet
#1732K / 64KPost-rebuild cool check (STEPS=4)1,343 / 3,072631.218.0596.9%0.1 / 1.2 msCache eviction!
#1848K / 64K--rtx4050-64k (q8_0 + INT8)1,343 / 3,072636.821.6096.5%0.0 / 1.2 msClean
#1964K / 64K--rtx4050-64k (q8_0 + INT8)1,343 / 3,072618.520.2096.4%0.0 / 1.4 ms64K Champion
#2080K / 80K--rtx4050-64k + --max-context1,343 / 3,072609.521.0996.5%0.0 / 1.4 ms5,669 MiB peak
#2190K / 90K--rtx4050-64k + --max-context1,343 / 3,072590.921.0196.0%0.0 / 1.5 ms5,711 MiB peak
#22100K / 100K--rtx4050-64k + --max-context1,343 / 3,072564.319.9095.9%0.0 / 1.6 ms100K Champion

*In Run #06, Linux refused --lock-experts due to ulimit -l (8192 KiB), accidentally revealing that simply removing the 4096 MiB userspace RAM cap (--ram-experts-mib -1) was the real bottleneck.

Part 1: What Worked (and Why)

1. Uncapping the Expert RAM Budget (--ram-experts-mib -1)

In Run #05, we were stuck at 17.06 tok/s, and nvidia-smi revealed the smoking gun: the RTX 4050 was boosting to full 2,670 MHz core / 8,001 MHz memory clocks, yet GPU utilization was bouncing between 4% and 62% (~35–45% average) and drawing only 25–41 W. The card wasn't thermal- or power-throttled—it was starving.

When we removed --ram-experts-mib 4096 (switching to --ram-experts-mib -1), PolyStrata stopped running its userspace RAM-budget tracker and let Linux map all 4.3 GiB of offloaded experts directly through the OS page cache (mmap):

  • Router wait collapsed from 2.3 ms → 0.4 ms/token
  • GPU utilization jumped from ~40% → 97–99%
  • Decode surged from 17.06 → 23.06 tok/s (+35%) and prefill jumped from 178.6 → 255.7 tok/s

Best of all, because --ram-experts-mib -1 uses standard OS file-cache mapping rather than mlock, Linux can safely reclaim unused pages if you open a heavy browser or IDE—zero system freezes.

2. Shrinking Attention & Loop Controllers (--attn-requant q5_k, --loop-bf16)

On a 6 GB card, every megabyte saved on dense weights buys more VRAM slots for routed experts and cuts memory bandwidth on the 96-bit bus:

  • --attn-requant q5_k requantizes Inkling's attention matrices from 8-bit down to 5-bit (Q5_K), freeing VRAM for +54 extra experts (1,179 → 1,233) and boosting decode from 14.06 → 16.29 tok/s.
  • --loop-bf16 stores the recurrent loop controllers in BF16 instead of F32, pushing decode to 17.06 tok/s and cutting CPU expert wait.

3. Skipping Cold Tail Experts (--tail-skip 4)

This was the single biggest win of the entire project. For every token, Inkling 2 Mini's router picks 8 experts. With --tail-skip 4, any expert ranked 5th–8th that is not already sitting in VRAM is skipped instead of being computed on the CPU.

  • Decode skyrocketed from 23.06 → 34.31 tok/s (+49% in one flag).
  • GPU power climbed to 59.5 W at 98% utilization because the tiny CPU-to-GPU sync bubbles disappeared.
  • The honest tradeoff: Unlike q5_k or bf16 (which only round weights), --tail-skip 4 actually drops low-weight off-GPU experts. PolyStrata's own benchmarks measure ~98% top-1 token agreement with all three small-card settings enabled. If you're doing critical coding or math where you want zero skipped experts, you can override it per-run with --tail-skip 0.

4. Reclaiming Idle VRAM (--vram-reserve-mib 256)

With the default 512 MiB VRAM reserve, nvidia-smi peaked at 5,365 MiB out of 6,144 MiB—leaving ~780 MiB unused. Dropping the reserve to 256 handed another ~256 MiB directly to the expert cache, jumping resident experts from 1,233 → 1,337 (43.5% of the entire model) and hitting 34.67 tok/s at a safe 5,621 MiB peak.

5. Context-Aware KV Cache Formats (fp8 at 16K, q8_0 + INT8 dp4a at 32K+)

Long-context testing uncovered a fascinating split:

  • At 16K context (Run #10 vs #11): FP16 KV dropped decode from 34.67 down to 25.67 tok/s (+10 ms/token spent reading ~512 MiB of KV cache). Turning on --kv fp8 completely erased that penalty—restoring 34.49 tok/s decode and pushing prefill to 718.5 tok/s (with 1,351 experts in VRAM and 0.1 ms/token CPU wait).
  • At 32K+ context (Run #12 vs #13): --kv fp8 hit a wall (21.51 tok/s, +17.5 ms/token) because the CUDA kernel unpacks every FP8 value through fp8 → fp16 → fp32. Digging into engine/src/poly/inkling2.cpp, I found an undocumented opt-in switch: STRATA_KV_INT8=1 paired with --kv q8_0. That switches 32K+ decode attention to hardware integer __dp4a dot products—instantly jumping 32K decode by +26% from 21.51 → 27.11 tok/s while keeping CPU experts at 0.0 ms/token.

Part 2: What Didn't Work (The Dead Ends)

1. Freezing the Expert Cache (--expert-swaps 0) — Catastrophic (-52%)

I assumed disabling live PCIe expert swaps would stop bus stalls. Instead, decode crashed from 16.29 → 7.74 tok/s. VRAM hit rate dropped from 91.6% to 83.1% and CPU expert time more than doubled (6.1 → 13.2 ms/token). Because Inkling loops its 12 middle layers 3 times per token, even an 8% drop in VRAM hits triggers a cascade of CPU-GPU stalls. Live swapping is mandatory on a 6 GB card.

2. --kv fp8 at Short Contexts (1K) — Slight Regression (-6%)

At 1K context (Run #07), --kv fp8 dropped decode from 23.06 to 21.64 tok/s. Because 40 of 48 layers use sliding-window attention, a 1K FP16 KV cache is only ~32 MiB—so FP8 quantization overhead cost more than the tiny bandwidth it saved. FP8 only starts paying off past ~8K–16K context.

3. STRATA_INK_FAST_CTRL=1 — Occupancy Trap (-11%)

I spotted STRATA_INK_FAST_CTRL=1 in inkling2.cu, which fuses the loop-controller down-projection into a single CUDA pass. On wide desktop GPUs it saves launch overhead; on my 20-SM RTX 4050, it increased per-block resource pressure and cut warp occupancy, dropping 32K decode from 27.11 → 24.07 tok/s and prefill by -50 tok/s. Dropped immediately.

4. Patching kInt8From = 4096 in inkling2.cu — Clean Experiment, Reverted

In inkling2.cu, STRATA_KV_INT8=1 only activates __dp4a past constexpr int kInt8From = 32768; I patched it down to 4096 and rebuilt with ninja to see if __dp4a could beat --kv fp8 at 16K.

  • Result: It flattened the 16K→32K scaling curve remarkably well (28.94 tok/s at 16K vs 27.11 tok/s at 32K—only +2.3 ms/token for doubling the context!).
  • Why I reverted it: At 16K, the fixed ~5.5 ms/token overhead of quantizing queries to INT8 still lost to --kv fp8's 34.49 tok/s. Better to use fp8 for 32K windows and q8_0 + STRATA_KV_INT8=1 for 64K–100K windows.

5. The Laptop Benchmarking Trap (Run #16 & #17)

When I ran a 4-way back-to-back loop sweeping STRATA_INK_SCORE_STEPS (1, 2, 4, 8), all four runs dropped ~15% below Run #13. Even weirder, a cool single verification run right after rebuilding with nvcc dropped to 18.05 tok/s even though GPU temps were a healthy 74 °C.

The culprit wasn't thermal throttling—it was RAM page-cache eviction. Compiling CUDA with nvcc eats several gigabytes of RAM, pushing cold chunks of the 9.14 GB GGUF file out of Linux's file cache back onto the SSD. On a short 128-token test (~5 seconds), a 2.5-second pause pulling cold pages from SSD wrecks the average. Once the model runs persistently in server mode, those pages stay warm in RAM.

6. Disabling Vision, --kv-resident, and --lookup 4

While trying to squeeze even more context and speed out of the engine, I checked three tempting flags:

  • Disabling vision to reclaim VRAM: In GUI wrappers like Unsloth Studio, turning off vision frees 640 MB–1.5 GB of VRAM because they auto-load the separate mmproj-F16.gguf file. In strata-poly, vision isn't inside the text GGUF and isn't loaded unless explicitly configured—so we were already spending 0 MB on vision.
  • --kv-resident 24576 (VRAM + RAM KV split): strata-poly rejected it cleanly: --kv-resident is supported for qwen35moe models in v1; this is a 'inkling2_loop' model.
  • --lookup 4 (prompt-lookup speculative decoding): Exited without loading—Inkling 2 Mini currently runs strictly one token at a time on strata-poly.

7. Why I Skipped Q4 KV Cache and UD-Q3_K_XL (13.6 GB)

  • Q4 KV (K4/V4): Not supported on Inkling 2 Mini's CUDA path anyway, and quantizing attention Keys to 4-bit on top of a 2-bit weight quant risks silent coding syntax degradation.
  • UD-Q3_K_XL (13.6 GB): Drops resident VRAM experts from 1,351 down to ~900 and pushes ~8.5–9.0 GiB of offloaded experts into 14 GiB of usable RAM, forcing SSD thrashing. (Note: Unsloth's 11.3 GB Q3_XXS / IQ3_XXS sits right in the middle—~6.3 GiB offloaded to RAM—making it the realistic next quant to test for 20+ tok/s coding loads.)

Part 3: Pushing Past the Wall — The 1K → 100K Context Scaling Curve

After hitting 27.11 tok/s at 32K, I wanted to find the exact physical breaking point of a 6 GB RTX 4050. I generated deterministic prompts all the way up to 100K (102,400 tokens) and logged peak VRAM across every step:

Populated ContextKV FormatPrefillDecodeTime / TokenPeak VRAMDrop vs. 1K
1K (Run #09)fp16231.7 tok/s34.67 tok/s28.8 ms5,621 MiBBaseline
16K (Run #11)fp8718.5 tok/s34.49 tok/s29.0 ms5,665 MiB-0.5%
32K (Run #13)q8_0 + INT8685.2 tok/s27.11 tok/s36.9 ms5,697 MiB-21.8%
48K (Run #18)q8_0 + INT8636.8 tok/s21.60 tok/s46.3 ms—-37.7%
64K (Run #19)q8_0 + INT8618.5 tok/s20.20 tok/s49.5 ms—-41.7%
80K (Run #20)q8_0 + INT8609.5 tok/s21.09 tok/s47.4 ms5,669 MiB-39.2%
90K (Run #21)q8_0 + INT8590.9 tok/s21.01 tok/s47.6 ms5,711 MiB-39.4%
100K (Run #22)q8_0 + INT8564.3 tok/s19.90 tok/s50.3 ms5,707 MiB-42.6%

Why It Held 100K Inside 5.7 GiB Without Crashing

  1. Sliding-window architecture: Only 8 of Inkling 2 Mini's 48 effective layers grow with context length, so at q8_0 (~16 KiB/token), a massive 100K context only costs ~1.56 GiB of KV cache.
  2. Dynamic VRAM allocation: strata-poly grows the KV cache on demand and rebalances the GPU pool inside the 256 MiB reserve—keeping peak VRAM flat at ~5.7 GiB from 32K all the way to 100K with 0.0 ms CPU expert wait.
  3. Flat long-context slope: Once you cross past 32K into q8_0 + __dp4a territory, going from 48K (21.60 tok/s) all the way to 100K (19.90 tok/s) only costs 1.7 tok/s.

Part 4: Real-World Stress Test — Prefix Caching & 43K+ Live Coding in pi

Synthetic benchmarks repeat tokens and flatter MoE expert caches. To see if this actually holds up under real work, I spun up the resident server with 100K context and Host-RAM prefix caching (--cache-dir, --pin-dir, --pin-cache-mib 1024), connected it to my pi coding agent, and threw a massive multi-file frontend website build at it.

Here is what the live server logs looked like once the conversation crossed 40,000+ tokens:

text
[strata] done: 118 tokens in 10 s (17.3 tok/s) (stop, cancel=False), expert cache 89.1% hit
[strata] reading the prompt: 39,303 of 39,566 tokens, 2 s so far
[strata] reading the prompt: 39,565 of 39,566 tokens, 5 s so far
[strata] writing a tool call: bash: 1249 of max 57180 tokens, 21.0 tok/s, 64 s
[strata] done: 1257 tokens in 65 s (21.0 tok/s) (stop, cancel=False), expert cache 95.8% hit
[strata] writing a tool call: bash: 6 of max 55452 tokens, 22.1 tok/s, 1 s
...
[strata] done: 1990 tokens in 91 s (22.0 tok/s) (stop, cancel=False), expert cache 95.0% hit
[strata] reading the prompt: 42,928 of 42,929 tokens, 2 s so far
[strata] done: 216 tokens in 14 s (17.9 tok/s) (stop, cancel=False), expert cache 93.3% hit

What Real-World Telemetry Revealed

  • Prefix caching eliminated the 60-second prefill wall: Instead of re-reading 39,566–42,929 tokens from scratch every turn, the server reused the cached prefix and only read the few hundred new tokens from the last bash output—starting generation in 1 to 5 seconds.
  • Long code writes actually beat the synthetic 48K benchmark: On massive 1,257- and 1,990-token bash file writes at 40K+ context, the GPU locked onto the coding experts (95.0–95.8% VRAM hit) and sustained 21.0–22.0 tok/s for 90 seconds straight.
  • Short replies dipped to 17.3–17.9 tok/s (and why): Whenever the model switched gears (reading bash output → thinking → writing English), its expert hit rate dipped briefly to 89–93% while swapping the right experts into VRAM over the first ~30–50 tokens.
  • Why --pin-cache-mib 1024 matters on 16 GB RAM: Capping the prefix cache at 1 GiB gives instant repeat turns without ever evicting the 4.3 GiB of offloaded MoE experts from system RAM back onto the SSD.

Part 5: Baking Three Custom Presets Into main.cpp

Typing 9 CLI flags and environment variables every session gets old fast. Because our benchmarks proved that 32K wants fp8 while 64K and 100K want q8_0 + STRATA_KV_INT8=1, I baked three one-word presets—--rtx4050-32k, --rtx4050-64k, and --rtx4050-100k—directly into engine/src/poly/main.cpp:

cpp
        else if (a == "--rtx4050-32k" || a == "--rtx4050-64k" || a == "--rtx4050-100k") {
            const bool is100k = (a == "--rtx4050-100k");
            const bool isLong = is100k || (a == "--rtx4050-64k");
            o.max_context = is100k ? 102400 : (isLong ? 65536 : 32768);
            o.threads = 4;
            o.vram_reserve_mib = 256;
            o.ram_experts_mib = -1;
            o.attn_requant = "q5_k";
            o.loop_bf16 = true;
            o.tail_skip = 4;
            o.kv_format = isLong ? KvFmt::kQ8_0 : KvFmt::kFp8;
#if !defined(_WIN32)
            if (isLong) setenv("STRATA_KV_INT8", "1", 0);
#endif
            std::fprintf(stderr, "strata-poly: preset %s active (%s ctx, %s KV, q5_k attn, bf16 loop, tail-skip 4)\n",
                         a.c_str() + 2, is100k ? "100K" : (isLong ? "64K" : "32K"), isLong ? "q8_0+int8" : "fp8");
        }

Because strata-poly evaluates flags left-to-right, nothing is locked in: you can append --tail-skip 0 for maximum accuracy or override --max-context anytime.

Part 6: Serving Locally & Registering Dual Models (32K + 100K) in pi

To connect coding agents over OpenAI (/v1/chat/completions) or Anthropic (/v1/messages) APIs:

1. Extract the tokenizer from the GGUF once

bash
python3 terminal/tools/strata_tokenizer.py \
  --gguf /mnt/ssd/Models/Inkling-2-Mini-UD-Q2_K_XL.gguf \
  --out ./inkling-tokenizer

2. Create separate 32K (daily) and 100K (heavy-build) configs sharing the same warm expert profile

strata-inkling-q2_k_xl-rtx4050.json (Daily Driver · 32K):

json
{
  "exe": "/home/prajwaldwivedi/PolyStrata/engine/build/strata-poly",
  "cwd": "/home/prajwaldwivedi/PolyStrata",
  "args": [
    "--model", "/mnt/ssd/Models/Inkling-2-Mini-UD-Q2_K_XL.gguf",
    "--rtx4050-32k",
    "--expert-profile", "/home/prajwaldwivedi/PolyStrata/inkling-q2_k_xl.profile"
  ],
  "tokenizer": "/home/prajwaldwivedi/PolyStrata/inkling-tokenizer/tokenizer",
  "model_name": "Inkling-2-Mini-UD-Q2_K_XL",
  "display_name": "Inkling 2 Mini (UD-Q2_K_XL · RTX 4050 32K)",
  "log": "/home/prajwaldwivedi/PolyStrata/inkling-q2_k_xl-engine.log"
}

strata-inkling-q2_k_xl-rtx4050-100k.json (Heavy Builds · 100K):

json
{
  "exe": "/home/prajwaldwivedi/PolyStrata/engine/build/strata-poly",
  "cwd": "/home/prajwaldwivedi/PolyStrata",
  "args": [
    "--model", "/mnt/ssd/Models/Inkling-2-Mini-UD-Q2_K_XL.gguf",
    "--rtx4050-100k",
    "--expert-profile", "/home/prajwaldwivedi/PolyStrata/inkling-q2_k_xl.profile"
  ],
  "tokenizer": "/home/prajwaldwivedi/PolyStrata/inkling-tokenizer/tokenizer",
  "model_name": "Inkling-2-Mini-UD-Q2_K_XL-100k",
  "display_name": "Inkling 2 Mini (UD-Q2_K_XL · RTX 4050 100K)",
  "log": "/home/prajwaldwivedi/PolyStrata/inkling-q2_k_xl-100k-engine.log"
}

3. Launch the resident server pinned to P-cores with prefix caching enabled

bash
mkdir -p /home/prajwaldwivedi/PolyStrata/cache/pins
cd /home/prajwaldwivedi/PolyStrata/terminal

taskset -c 0-7 python3 -m serve.server \
  --engine strata \
  --config ../strata-inkling-q2_k_xl-rtx4050-100k.json \
  --cache-dir /home/prajwaldwivedi/PolyStrata/cache \
  --pin-dir /home/prajwaldwivedi/PolyStrata/cache/pins \
  --pin-cache-mib 1024 \
  --port 8080

4. Register both 32K and 100K models side-by-side in ~/.pi/agent/models.json

json
{
  "providers": {
    "polystrata": {
      "baseUrl": "http://127.0.0.1:8080/v1",
      "api": "openai-completions",
      "apiKey": "local",
      "compat": { "supportsDeveloperRole": false },
      "models": [
        {
          "id": "Inkling-2-Mini-UD-Q2_K_XL",
          "name": "Inkling 2 Mini Q2_K_XL (32K)",
          "reasoning": true,
          "input": ["text"],
          "contextWindow": 32768,
          "maxTokens": 8192,
          "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
        },
        {
          "id": "Inkling-2-Mini-UD-Q2_K_XL-100k",
          "name": "Inkling 2 Mini Q2_K_XL (100K)",
          "reasoning": true,
          "input": ["text"],
          "contextWindow": 102400,
          "maxTokens": 16384,
          "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
        }
      ]
    }
  }
}

Part 7: The Long-Horizon Strategy — 32K Daily Driver, 100K Safety Net

Putting the starting line next to the finish line shows why the engine architecture matters so much on a 6 GB card:

SetupContextKV PrecisionPrefill SpeedDecode Speedvs. Tuned llama.cpp
Tuned llama.cpp (Unsloth)4Kq4_0 (4-bit)141.8 tok/s12.8 tok/sBaseline
strata-poly (--rtx4050-32k)16Kfp8 (8-bit)718.5 tok/s34.49 tok/s2.7× decode · 5.1× prefill · 4× ctx
strata-poly (--rtx4050-64k)32Kq8_0 + INT8685.2 tok/s27.11 tok/s2.1× decode · 4.8× prefill · 8× ctx
strata-poly (--rtx4050-100k)100Kq8_0 + INT8564.3 tok/s19.90 tok/s1.55× decode · 4.0× prefill · 25× ctx

Even at 25× the context window (100K vs. 4K) and double the KV cache precision (8-bit vs. 4-bit), the tuned strata-poly setup is still 55% faster on decode and 4× faster on prompt reading than manually tuned llama.cpp.

Still, raw context isn't a replacement for good harness hygiene:

  • Use --rtx4050-32k as your daily driver (25–34.5 tok/s): Most interactive coding and scripting stays fast and sharp under 32K when paired with good compaction.
  • Use --rtx4050-100k for heavy builds and automation (20–22 tok/s): Because strata-poly allocates KV cache dynamically, setting the ceiling to 100K costs you nothing while working at 35K–64K and guarantees a sudden giant file read won't crash your session. For multi-hour loops, aim to compact around ~64K so 2-bit attention precision stays sharp.

At the harness level, four habits keep both tiers fast indefinitely:

  1. Cliff Compaction instead of sliding windows: Don't drop old messages on every turn (that breaks KV prefix caching and forces a full re-prefill every turn). Let context grow cleanly so your cache stays 100% hot, then compact sharply in one step.
  2. Observation Masking: In coding agents, raw tool outputs (pytest dumps, git diff, file reads) eat >80% of context. Keep every tool call and decision in history, but replace tool outputs older than 3–5 turns with a 1-line stub ([omitted: 380 lines from test_api.py, exit 0]).
  3. Externalized State (STATE.md): Track the goal, modified files, and next step in a tiny markdown file on disk so a compacted session resumes cleanly without 40 turns of stale chat logs.
  4. Sub-Agent Isolation: Run noisy codebase searches in a disposable sub-session that reads 10 files, returns a 200-token answer, and throws away the 20K tokens it spent searching.

Going from 12.8 tok/s at 4K context in llama.cpp to 27–34.5 tok/s at 32K (and 20–22 tok/s all the way to 100K) with prefix caching and three custom C++ presets completely changed what this laptop can do. A 6 GB RTX 4050 stops feeling like a compromise—it becomes a genuinely fast, daily-driver local coding engine.

Let's build something
remarkable together.