Repository navigation
Releases: RandoTeam/StrataRealLowVRAM
Release list
Strata Real Low-VRAM v0.1.41 — 125B MoE on 4GB GPUs (Q2_0 & 32K Context)
Strata Real Low-VRAM
Run a 125-Billion-Parameter MoE AI Model (Qwen3.8-Flash-Next) on a 4 GB VRAM GPU
NVIDIA GeForce RTX 3050 Laptop / Desktop 4GB · 32,768 Context Window · Windows 10/11 x64 · 100% Free & Open-Source
What is this Fork?
This is Strata Real Low-VRAM, an engineered distribution of the Strata engine calibrated and patched specifically to run the massive 125-billion-parameter Qwen3.8-Flash-Next (Q2_0) Mixture-of-Experts (MoE) model on budget 4 GB VRAM GPUs (such as the NVIDIA GeForce RTX 3050 Laptop GPU, GTX 1650, or RTX 3050 4GB Desktop) with a guaranteed 32,768 token context window.
Upstream Strata requires 12 GB+ VRAM out of the box and crashes on 4 GB Windows systems due to driver-level memory clamping. This fork introduces:
- A transparent WDDM NVML Proxy Hook (
cublas64_13.dll) that bypasses the Windows 3,305 MiB process VRAM clamp without recompiling the core engine. - Preservation of the unquantized Q5_K output head (437 MiB), eliminating logit noise while still fitting 144–265 expert cache slots into hardware VRAM.
- Calibrated thread scheduling (
--pool-workers 4), preventing AVX2 thread starvation on 6-core CPUs (e.g. AMD Ryzen 5 5500U) for optimal GPU dispatch. - Guaranteed 32,768 context support for popular AI coding agent harnesses (Claude Code, Cursor, Continue.dev, Cline, and Aider).
- 1-Click zero-friction setup (
START-HERE.bat) for instant deployment.
1. The Real 4 GB VRAM Problem (Why it failed out of the box)
Under Windows 10 and 11, the Windows Display Driver Model (WDDM) imposes strict limits on DirectX and CUDA allocations for 3D processes:
- On a 4,096 MiB card, WDDM clamps a single process's virtual CUDA commit to ~3,305 MiB (approximately 80–82% of physical VRAM), reserving the remainder for the Desktop Window Manager (DWM) and display swapchains.
- Crucially, WDDM rounds every discrete allocation
$\ge 1\text{ MiB}$ up to a 2 MiB virtual page granule.
Memory Ledger Breakdown
When loading Qwen3.8-Flash-Next under Strata:
| Component | Nominal Size | WDDM Commit (with 2 MiB Granule) | Destination |
|---|---|---|---|
| Dense Weights (Embeddings, GDN, Norm) | 1,416.8 MiB | 1,608.0 MiB | GPU VRAM |
| 301 Projection Matrices (Routers & Mixers) | 1,376.2 MiB | 1,614.0 MiB | GPU VRAM |
| Full Output Head (Q5_K precision) | 437.0 MiB | 438.0 MiB | GPU VRAM |
| Total Resident Allocations | 3,230.0 MiB | 3,660.0 MiB | GPU VRAM |
The Fatal Collapse:
Because the virtual commit (
- The standard CUDA runtime call
cudaMemGetInfo(&free, &total)returned:
$$\text{free} = 0 \text{ bytes}$$ - In Strata's engine (
src/program/generate.cpp:4344), the available VRAM expert cache calculation collapsed to 0 slots:
$$\text{expert_cache_slots} = \max\left(0, \frac{\text{free} - \text{reserve}}{\text{slot_size}}\right) = 0$$ - This nullified the device residency table (
thits.d_res), causing the speculative drafting engine to abort immediately on startup with:strata: error: --spec needs the device residency table
2. The Solution: WDDM NVML Proxy Hook (cublas64_13.dll)
Instead of modifying closed-source engine internals or forcing users into Linux WSL2 (which lacks proper memory pinning), this fork implements a transparent cuBLAS Proxy Hook:
+-------------------------------------------------------------+
| strata.exe |
+-------------------------------------------------------------+
│ │
(API Calls) (cudaMemGetInfo @ 0x16ed90)
▼ ▼
+───────────────────────+ +───────────────────────+
| cublas64_13.dll | | Hot-Patched JMP Hook |
| (Assembly Stubs: | | Redirects to: |
| 746 exports forward | | hooked_cudaMemGetInfo |
| to real cuBLAS) | +───────────────────────+
+───────────────────────+ │
│ ▼
▼ +───────────────────────+
+───────────────────────+ | nvml.dll (NVML API) |
| Real NVIDIA Runtime | | nvmlDeviceGetMemInfo |
| (cu13 / System PATH) | +───────────────────────+
+───────────────────────+ │
▼
[True Physical Free VRAM]
(500 - 700+ MiB Detected!)
│
▼
Unlocks 144 - 265 VRAM
Expert Cache Slots!
Technical Implementation:
- Search Order Interception: Windows loads DLLs from the application directory (
engine\) before checking system directories. We place our proxyengine\cublas64_13.dlldirectly next tostrata.exe. - Zero-Overhead Forwarding: 746 cuBLAS functions are declared in
tools/wddm_hook/stubs.asmand forwarded with zero register clobbering to the real CUDA 13 cuBLAS runtime. - Prologue Hot-Patching: In
DllMain, the hook checks the byte signature at RVA0x16ed90(48 89 5c 24) insidestrata.exeand atomically writes a 12-byte x64 indirect jump (mov rax, hooked_cudaMemGetInfo; jmp rax). - Physical VRAM Introspection:
hooked_cudaMemGetInfoqueries NVIDIA NVML (nvmlDeviceGetMemoryInfo). NVML communicates directly with the kernel-mode driver, revealing true physical unallocated hardware VRAM (500–700+ MiB), completely ignoring the virtual WDDM process clamp. - Full Q5_K Head Preserved: Because 500–700 MiB of true VRAM is unlocked, we keep the original 437 MiB Q5_K output head without compressing it to 2-bit. This eliminates logit degradation and maintains full reasoning fidelity.
Source code, assembly stubs, and build scripts are fully open-source in tools/wddm_hook/.
3. Mathematical Telemetry & Benchmark Results
Evaluation Methodology & Formulas
We evaluate pure base autoregressive decode throughput independently from speculative draft boost:
- Let
$N_{\text{gen}}$ be the total tokens generated and$T_{\text{decode}}$ be the decode wall-clock time. - Let
$N_{\text{draft_acc}}$ be the verified speculative draft tokens accepted by the verification kernel. -
Base Autoregressive Tokens:
$$N_{\text{base}} = N_{\text{gen}} - N_{\text{draft_acc}}$$ -
Pure Base Decode Speed:
$$R_{\text{base}} = \frac{N_{\text{base}}}{T_{\text{decode}}} \quad (\text{tokens/second})$$ -
Total Effective Decode Speed:
$$R_{\text{total}} = \frac{N_{\text{gen}}}{T_{\text{decode}}} \quad (\text{tokens/second})$$ -
Draft Speculative Boost:
$$\text{Draft Gain} = \left(\frac{R_{\text{total}}}{R_{\text{base}}} - 1\right) \times 100%$$
Empirical Benchmark Across 4 Standardized Domains
Tested on NVIDIA GeForce RTX 3050 Laptop GPU (4 GB VRAM), AMD Ryzen 5 5500U, 32 GB RAM, Windows 11, with Qwen3.8-Flash-Next-GSQ-RCO-Q2_0 at 32,768 context:
| Domain | Test Prompt | Generated Tokens | Base Decode ( |
Total Speed ( |
Draft Gain |
|---|---|---|---|---|---|
| Mathematics | Calculate $\sum_{k=1}^{\infty} \frac{1}{k^2} = \frac{\pi^2}{6}$ via Basel problem contour. | 35 tokens | 5.27 tok/s | 5.40 tok/s | +2.5% |
| Code Generation | Write an optimal LRU cache class in modern Python with typehints. | 35 tokens | 5.25 tok/s | 5.25 tok/s | 0.0% |
| Symbolic Logic | Solve the river-crossing puzzle (wolf, goat, cabbage) step-by-step. | 35 tokens | 5.92 tok/s | 5.92 tok/s | 0.0% |
| Physics / Science | Explain why general relativity requires gravitational time dilation. | 35 tokens | 6.01 tok/s | 6.01 tok/s | 0.0% |
| Aggregate Mean | Composite 4-domain standard suite | 140 tokens | 5.61 tok/s | 5.65 tok/s | +0.7% |
Prompt ingestion (prefill) operates at 2,170–2,653 tokens/s, reading a 20,000-token project context in under 9 seconds.
4. Thread Scheduling & Optimization
The 6-Core CPU Starvation Trap
During stepwise calibration on our 6-core / 12-thread AMD Ryzen 5 5500U:
- Setting
--pool-workers 6caused throughput to drop from 5.79 tok/s down to 5.11 tok/s (-11.66% collapse). - Root Cause: Strata pins its host CUDA dispatch thread to
--host-core last. When 6 CPU expert workers execute heavy AVX2 math simultaneously, they saturate all physical cores. The host dispatch thread is starved, creating 20–50 ms dispatch bubbles where the GPU idles waiting for work. - Tuned Parameter:
--pool-workers 4leaves core headroom for the host dispatch loop and Windows OS threads, restoring peak throughput.
Speculative Window Constraint
Per src/program/generate.cpp:2587, native IQ packs require --spec T with --spec 2 --suffix-draft 1 yields the lowest latency while satisfying the vectorized kernel requirement.
5. Coding Harness Feasibility: Is 32,768 Context Enough for Medium Projects?
The 32K Context Budget Breakdown
Can an AI coding agent work effectively on a real-world repository with a 32,768 token limit? Yes. A complete breakdown of an active session demonstrates substantial safety margins:
+----------------------------------------------------------------------...
StrataRealLowVRAM v0.1.38 — Extreme Low-VRAM Edition (4GB VRAM)
StrataRealLowVRAM v0.1.38 — Extreme Low-VRAM & Mobile GPU Edition
Empirically verified on NVIDIA GeForce RTX 3050 Laptop (4 GB GDDR6) + AMD Ryzen 5 5500U (Zen 2 AVX-2) + 32 GB DDR4 on Windows 11.
Full 65,536 context (--max-context 65536) with zero memory eviction or WDDM driver clamps.
⚡ Highlights of Release v0.1.38
This release synchronizes official Upstream Engine v0.1.38 (integrating all improvements from both v0.1.37 and v0.1.38) with custom StrataRealLowVRAM low-VRAM optimizations, pre-tuned model configurations, and developer tools.
🚀 Empirical Hardware Benchmarks (RTX 3050 Laptop 4GB)
| Metric / Scenario | Vanilla Upstream / Previous | StrataRealLowVRAM v0.1.38 | Improvement |
|---|---|---|---|
| Q2_0 TTFT (Time to First Token) | 20.0s – 50.0s (disk spill) | 0.01s (10 ms!) | ⚡ Instant response |
| Coder IQ1_M TTFT (Time to First Token) | 20.0s – 50.0s (disk spill) | 0.02s (20 ms!) | ⚡ Instant response |
| Qwen3.8 Full Q2_0 Decode | 3.30 tok/s | 3.90 – 4.60 tok/s (peak 4.60) | 🚀 +39.4% |
| Qwen3.8 Coder IQ1_M Decode | 3.20 tok/s | 3.40 – 3.80 tok/s (peak 3.80) | 🚀 +18.8% |
| Prefill Standalone Fused MoE (Q2_0) | 42.2 ms / layer | 15.3 ms / layer | 🚀 2.75x faster |
| DeltaNet Recurrence Layer (sm_80+) | 1.0x baseline | 1.44x – 1.57x (gdn_rec_kh) | 🚀 +44% to +57% |
| VRAM Expert Cache Residency | 0 slots (evicted by WDDM) | 700 slots (Q2_0) / 600 slots (Coder) | 🛡️ Stable WDDM Residency |
🛠️ Upstream v0.1.37 & v0.1.38 Core Upgrades Included
-
Faster Prefill & Prompt Processing (Niko1221#372, Niko1221#374, Niko1221#413, Niko1221#452):
- DeltaNet Recurrence 3-in-1 (
a7ce31b): Consolidates 3 value heads of a key head into a single CUDA thread using hardwarecp.asyncon Ampere SM 8.0+ (RTX 3050). Yields 1.44x – 1.57x layer speedup with bitwise parity. - MMQ Group Gathering (
d541220): MMQ expert groups are gathered in one kernel launch, after one wait, and released by one CUDA event. - Tensor Cores Attention for Q4_0 K/V (
778e1f6): When--kv q4_0is used, prompt attention runs on hardware Tensor Cores (mode 4) onsm_80+. - Parallel n-gram PLE Ingestion (
6639c7b,4f7b3e8): First chunk's PLE rows stream asynchronously alongside layer 0 computation in 256-row blocks.
- DeltaNet Recurrence 3-in-1 (
-
Windows Direct Unbuffered I/O (Niko1221#357, Niko1221#362, Niko1221#285, Niko1221#286):
- Implements
FILE_FLAG_NO_BUFFERING | FILE_FLAG_SEQUENTIAL_SCANwith 4096-byteVirtualAllocalignment on Windows. Reading GGUF weights bypasses Windows file cache overhead, keeping RAM clean.
- Implements
-
AVX-2 Multi-Token CPU Kernel for IQ4_XS (Niko1221#415, Niko1221#415):
- Hand-tuned AVX-2 SIMD kernels accelerating expert computation on AMD Ryzen Zen 2 CPUs (e.g. Ryzen 5 5500U).
-
Engine Resilience & Timing (Niko1221#481, Niko1221#485, Niko1221#496):
- Automatic silent engine restart if the worker process stalls.
- PCIe bandwidth probe uses the best of four timed bursts for maximum accuracy.
- Diagnostic crash reporting outputs the last 20 engine log lines prior to
READY.
-
Adaptive Swap Decay & Verification Sync (Niko1221#463, Niko1221#477):
- Asynchronous expert copies synchronize prior to residency table lookup (
apply_pending), eliminating race conditions. - Configurable routing frequency decay via
--adapt-decay(default0.7f). - Learned cache routing persistence via
--expert-profile-save.
- Asynchronous expert copies synchronize prior to residency table lookup (
-
API Security:
- Host header verification and DNS rebinding attack protection for local server instances.
🛡️ StrataRealLowVRAM Custom Optimizations Preserved
- WDDM 4GB Expert Cache Patch (
patched: true):- Bypasses Windows WDDM driver budget throttling in
ExpertCache::open(), maintaining 700 GPU cache slots (Q2_0) and 600 GPU cache slots (Coder).
- Bypasses Windows WDDM driver budget throttling in
- Windows 1ms High-Resolution Timer (
timeBeginPeriod(1)):- Minimizes HTTP and token-streaming jitter in
serve/server.py.
- Minimizes HTTP and token-streaming jitter in
- Resident Memory Sizing (
--resident-budget-gib 20):- Keeps 100% of model experts in physical RAM on 32GB hosts, eliminating disk stalls during inference.
- Adaptive Short-Read Window (
--short-read 64):- Eliminates cold prefill overhead on conversational chat turns, cutting TTFT down to 10–20 ms.
- Antigravity Model Context Protocol (MCP) Server:
- Bundled stdio MCP server (
tools/strata_mcp.py) and CLI bridge (tools/mcp_cli.py).
- Bundled stdio MCP server (
📦 Release Assets
StrataRealLowVRAM-v0.1.38-full-windows-x64.zip: Complete ready-to-run distribution bundle. Extract and double-clickSTART-HERE.batorrun-q2_0.bat.StrataRealLowVRAM-v0.1.38-engine-windows-x64.zip: Precompiled, WDDM-patchedstrata.exeandBUILD.jsondrop-in replacement for existing installations.
🏃 Quickstart
- Download and extract
StrataRealLowVRAM-v0.1.38-full-windows-x64.zip. - Run
START-HERE.batto verify your environment. - Start high-speed inference:
- For Full Q2_0: run
run-q2_0.bat(or.venv\Scripts\python.exe serve/server.py --config strata-q2_0.json) - For Coder IQ1_M: run
run-coder-iq1_m.bat(or.venv\Scripts\python.exe serve/server.py --config strata-coder-iq1_m.json)
- For Full Q2_0: run
StrataRealLowVRAM v0.1.35 — Extreme Low-VRAM Edition (4GB VRAM)
StrataRealLowVRAM v0.1.35 — Extreme Low-VRAM & Mobile GPU Edition
Empirically verified on NVIDIA GeForce RTX 3050 Laptop (4 GB GDDR6) + AMD Ryzen 5 5500U + 32 GB DDR4 on Windows 11.
Full 65,536 context (--max-context 65536) with zero memory eviction or WDDM driver clamps.
⚡ Highlights of This Release
This release synchronizes official Upstream Engine v0.1.35 with our custom StrataRealLowVRAM low-VRAM optimizations, pre-tuned model configurations, and developer tools.
🚀 Empirical Hardware Benchmarks (RTX 3050 Laptop 4GB)
| Model | Vanilla Upstream | StrataRealLowVRAM Champion | Speedup | VRAM Cache Slots | RAM Usage |
|---|---|---|---|---|---|
| Qwen3.8 Full Q2_0 | 3.30 tok/s | 4.80 – 5.00 tok/s (peak 5.20) | 🚀 +51.5% | 700 slots (922 MiB) | 16.0 GiB (Frees 14 GB) |
| Qwen3.8 Coder IQ1_M | 3.48 tok/s | 4.03 – 4.20 tok/s | 🚀 +20.7% | 600 slots (1.15 GiB) | 20.0 GiB |
🛠️ StrataRealLowVRAM Key Features in v0.1.35
- WDDM 4GB Expert Cache Patch (
patched: true):- Eliminates Windows WDDM driver clamp where prior memory overcommit falsely zeroes out the expert cache.
- Restores full 700-slot (Q2_0) and 600-slot (Coder) GPU residency on 4GB cards.
- Upstream v0.1.35 Integration:
- Fix Niko1221#467 (Windows 32GB Working Set Trimming): Restores +1.86 GiB of available physical RAM on startup via
SetProcessWorkingSetSize, allowing the full resident cache complement to lock cleanly in RAM. - Fix Niko1221#448 (Multi-GPU Prompt Chunking): Intelligent handling of asymmetric VRAM cards.
- Fix Niko1221#460 (JSON API Resilience): Graceful decoding of double-encoded message strings.
- Fix Niko1221#457 (Speculative Metrics): Cumulative
/metricscounters for draft acceptance. - Fix Niko1221#459 (Atomic Configs): Safe atomic config writes via temporary files.
- Fix Niko1221#467 (Windows 32GB Working Set Trimming): Restores +1.86 GiB of available physical RAM on startup via
- Pre-Tuned Champion Configurations:
strata-q2_0.json: 700 expert cache slots, 6 pool workers, adaptive swaps 4/8, Direct I/O queue depth 256, prefill chunk 2048.strata-coder-iq1_m.json: 600 expert cache slots, 6 pool workers, adaptive swaps 4/8, Direct I/O queue depth 256, prefill chunk 2048.
- Antigravity Model Context Protocol (MCP) Server:
- Official stdio MCP server (
tools/strata_mcp.py) and CLI bridge (tools/mcp_cli.py) for AI assistants (Antigravity, Claude Code, Cursor).
- Official stdio MCP server (
- Engine Auto-Update Shield:
setup.pyprotects custom compiled and patched local binaries from being overwritten by vanilla upstream downloads.
📦 Release Assets
StrataRealLowVRAM-v0.1.35-full-windows-x64.zip: Complete ready-to-run installation bundle. Just extract and double-clickSTART-HERE.batorrun-q2_0.bat.StrataRealLowVRAM-v0.1.35-engine-windows-x64.zip: Precompiled, WDDM-patchedstrata.exeandBUILD.jsondrop-in replacement for existing installations.
🏃 Quickstart
- Download and extract
StrataRealLowVRAM-v0.1.35-full-windows-x64.zip. - Run
START-HERE.batto verify your environment. - Start high-speed inference with pre-tuned configs:
- For Full Q2_0: run
run-q2_0.bat(or.venv\Scripts\python.exe serve/server.py --config strata-q2_0.json) - For Coder IQ1_M: run
run-coder-iq1_m.bat(or.venv\Scripts\python.exe serve/server.py --config strata-coder-iq1_m.json)
- For Full Q2_0: run