Break the Memory Wall.
30B–70B on an 8GB GPU. Measured, not claimed.
HARNESS is an autonomous pure-Rust LLM inference orchestration, custom wgpu (Vulkan/DX12/Metal) WGSL GPU kernel, and safety middleware fusing high-throughput systems programming with biological primitives. On a single consumer NVIDIA RTX 5060 (8 GB GDDR7 @ 448 GB/s) over PCIe Gen 3 x8, HARNESS drives 30.5B Sparse MoE (Qwen3-Coder-30B-A3B) at 16.37 tok/s pooled (16.53 peak — 14.11× speedup over 32B baseline, 5.37× faster than Ollama), 14B + 0.5B Speculative at 15.89 tok/s pooled (19.17 peak, 98.7% draft acceptance), 32B Dense + 0.5B Speculative at 3.90 tok/s pooled (4.80 peak, 3.36× speedup), 70B Q2_K at 0.99 – 1.68 tok/s, and 7B Q4_K_M at 77.6 tok/s — achieving a 24/24 (100%) compiler-verified pass rate (rustc --test -O & python) across the Skeptic's Trench torture suite.
HARNESS Interactive Studio & Telemetry Console
SIMULATION: interactive demo of layer streaming and SNN dynamics. Numbers in this console are illustrative, not measurements. Verified results come from benchmarks/runs/RESULTS.md in the repository.
Executing FlashAttention-3 + SwiGLU forward pass in a simulated 4.8GB VRAM budget.
Non-blocking PCIe stream transfer from pinned host RAM directly into VRAM buffer.
Memory Tiering & Apple Silicon UMA Physics
Calculate the optimal inference strategy and model sizing for your physical workstation.
Workstation Spec Calculator
The Physics of Memory Bandwidth
On the measured PC, weights cross a PCIe 3.0 x8 link (~7.9 GB/s theoretical) from DDR4-2133 dual-channel RAM (34.1 GB/s theoretical peak). A 70B Q2_K model is 26.4 GB, so most layers live in host RAM and speed is bounded by memory bandwidth (tok/s ≤ bandwidth / active footprint). The real 70B numbers on this page come from llama.cpp partial GPU offload; the HARNESS ping-pong DMA scheduler is a simulation of the overlap.
On Apple Silicon, unified memory removes the PCIe hop and offers much higher bandwidth. The repository gives only theoretical bandwidth sizing for those machines (bandwidth / model size), not measurements, so no Mac throughput claim is made here.
Measured on NVIDIA RTX 5060 8GB (GDDR7 · PCIe 3.0 x8)
Every figure below is computed from bare-metal hardware runs on an NVIDIA GeForce RTX 5060 (8,151 MiB GDDR7 @ 448 GB/s, 128-bit @ 28 Gbps) paired with an Intel Core i5-10400F (6C/12T) and 32 GB DDR4-2133 over PCIe Gen 3 x8 on Windows 11. All 8 elite coder configurations passed 24/24 (100%) automated compiler & execution checks (rustc --test -O & python) across 3 torture tasks (python_dp_and_intervals, rust_lockfree_spsc, and async_deadlock_audit).
1. 30B–32B & 14B Elite Coder Torture-Test Ledger (8 Configurations · 24/24 Compiler Verified)
24 / 24 PASS (100% Exact)| Config ID | Model & Offload Topology | CUDA VRAM / Splits | Pooled tok/s | Peak (Rust) / Prefill | Speedup vs 32B Base | Compiler Gate |
|---|---|---|---|---|---|---|
| m5_qwen3_coder_30b_moe_ncmoe32_pure | Qwen3-Coder-30B-A3B-Q4_K_M (30.5B / 3.3B active, -ngl 99 --n-cpu-moe 32) | 6,463.4 MiB / 162 | 16.37 tok/s | 16.53 / 78.0 tok/s | 14.11× (5.37× vs Ollama) | 3/3 PASS |
| d1_qwen25_coder_14b_spec_0_5b | Qwen2.5-Coder-14B-Q4_K_S (-ngl 38/49) + 0.5B Draft (-ngld 99) | 6,074.8 MiB / 76 | 15.89 tok/s | 19.17 tok/s (98.7% acc) | 13.70× (88.8% pool acc) | 3/3 PASS |
| m2_qwen3_coder_30b_moe_ncmoe32_ngram | Qwen3-Coder-30B-A3B-Q4_K_M (--n-cpu-moe 32 + ngram-simple) | 6,463.4 MiB / 162 | 15.37 tok/s | 15.79 / 77.4 tok/s | 13.25× | 3/3 PASS |
| m1_qwen3_coder_30b_moe_ncmoe35 | Qwen3-Coder-30B-A3B-Q4_K_M (-ngl 99 --n-cpu-moe 35) | 5,491.3 MiB / 168 | 14.92 tok/s | 15.07 / 72.5 tok/s | 12.86× | 3/3 PASS |
| m4_qwen3_coder_30b_moe_ncmoe31_ultra | Qwen3-Coder-30B-A3B-Q4_K_M (--n-cpu-moe 31 · WDDM spillover test) | 6,787.4 MiB / 160 | 13.04 tok/s | 13.21 / 66.8 tok/s | 11.24× | 3/3 PASS |
| m3_qwen3_coder_30b_moe_spec_0_6b | Qwen3-Coder-30B-A3B (--n-cpu-moe 36) + Qwen3-0.6B Draft (-ngld 99) | 5,689.2 MiB / 170 | 11.59 tok/s | 15.81 tok/s (76.9% acc) | 9.99× | 3/3 PASS |
| c5_dense32b_0_5b_ngl20_prio | Qwen2.5-Coder-32B-Q4_K_M (-ngl 20/65) + 0.5B Draft (-ngld 99 --prio 2) | 6,013.2 MiB / 40 | 3.90 tok/s | 4.80 tok/s (96.2% acc) | 3.36× (85.4% pool acc) | 3/3 PASS |
| c6_dense32b_0_5b_ngl21_ultra | Qwen2.5-Coder-32B-Q4_K_M (-ngl 21/65 + 0.5B · WDDM spillover test) | 6,274.8 MiB / 42 | 3.39 tok/s | 4.28 tok/s (94.9% acc) | 2.92× | 3/3 PASS |
100% Attention on GDDR7 + Selective CPU MoE
Offloading all 48 self-attention layers + KV cache + 16 MoE layers to RTX 5060 GDDR7 (-ngl 99 --n-cpu-moe 32, 6,463.4 MiB) while streaming only 3.3B active parameters across 32 CPU MoE layers achieves 16.37 tok/s pooled (16.53 tok/s Rust peak, 78.0 tok/s prefill) — 14.11× faster than the 32B dense baseline.
Speculative Drafter Helps Dense 32B/14B, Hurts MoE
For dense 32B (13 GB in DDR4-2133), verifying K + 1 draft tokens in a single parallel pass amortizes the ~550 ms RAM sweep across 5–6 tokens (3.90 tok/s pooled, 4.80 peak at 96.2% acceptance). Conversely, on 30B Sparse MoE, multi-token verification triggers additional expert union routing on CPU, reducing speed from 16.37 → 11.59 tok/s.
Preventing Silent PCIe Gen 3 x8 Shared-RAM Paging
On an 8,151 MiB Windows 11 GPU, desktop compositor + WDDM reserves ~1.35 GB. Pushing CUDA model buffers from 6,463 MiB (m5) to 6,787 MiB (m4) or 6,013 MiB (c5) to 6,275 MiB (c6) crosses the WDDM paging cliff, silently stalling CUDA kernels over PCIe 3.0 x8 (16.37 → 13.04 tok/s and 3.90 → 3.39 tok/s).
2. Dense 32B Speculative Ablation Progression (c0 → c5 · Qwen2.5-Coder-32B-Q4_K_M)
| Stage | Offload & Draft Strategy | Pooled | Peak / Speedup |
|---|---|---|---|
| c0_baseline | 18/65 GPU layers, no draft, defaultKV | 1.16 tok/s | 1.18 tok/s (1.00×) |
| c1_tuned_q8kv | 22/65 GPU layers, Q8_0 KV, ubatch 512 | 1.26 tok/s | 1.28 tok/s (1.08×) |
| c2_ngram_spec | 22/65 GPU layers + zero-VRAM ngram-mod | 1.46 tok/s | 1.78 tok/s (1.26×) |
| c3_spec_0_5b | 20/65 GPU + Qwen2.5-Coder-0.5B (-ngld 99) | 3.58 tok/s | 4.36 tok/s (3.08×) |
| c4_spec_1_5b | 17/65 GPU + Qwen2.5-Coder-1.5B (-ngld 99) | 3.37 tok/s | 4.24 tok/s (2.90×) |
| c5_0_5b_prio2 | 20/65 GPU + 0.5B Draft + --prio 2 + draft-max 10 | 3.90 tok/s | 4.80 tok/s (3.36×) |
3. Historical 70B Q2_K & 7B Q4_K_M Baseline Ledger (Llama 3.1 70B · 144 Tokens)
| Config | GPU layers | tok/s (pooled) | Draft accepted | Output vs baseline |
|---|---|---|---|---|
| c0_default_fit (baseline) | 16 / 81 | 0.986 | n/a | reference |
| c1_tuned_fit | 19 / 81 | 1.036 | n/a | identical |
| c2_ngram_simple | n/a | 1.164 | 62% (35/56) | diverged on 1 of 3 prompts |
| c3_draft1b_k4 (1B draft model) | 11 / 81 | 1.678 | 79% (106/134) | identical |
| c4_draft1b_plus_ngram | 11 / 81 | 1.411 | 71% (108/152) | identical |
| c5_tuned_threads4 | n/a | 0.799 | n/a | identical |
| m7b_qwen25coder (7B Q4_K_M, different model) | 81 / 81 | 77.610 | n/a | n/a |
Stress microbenchmark (same RTX 5060 PC): wgpu 2D Tiled GEMM 948.59 GFLOP/s synced (4.67 TFLOP/s async); Dense Q4 GEMV 311.10 μs (313.9 GB/s effective BW); Sparse MoE Q4 GEMV 215.05 μs; AVX2 CPU GEMM 21.32 GFLOP/s; PagedAttention 17.3 M blocks/s with 1.29% peak fragmentation and 0 leaked blocks; DFA mask 78.4 ns. Raw JSON & Markdown captures on GitHub ↗
Audited Systems & Custom WGSL GPU Kernel Matrix
Every GPU kernel measurement in crates/harness-core (wgpu v30 Vulkan/DX12 backend respecting WebGPU baseline maxComputeInvocationsPerWorkgroup = 256 / @workgroup_size(256) and 16×16 tiles) uses strict device-synchronized readback fences (poll(Maintain::Wait)) on the NVIDIA GeForce RTX 5060 (448 GB/s GDDR7) alongside CPU SIMD and safety microbenchmarks.
The 11-Crate Systems Architecture
No garbage collector (Rust). Bounds-checked, compiler-verified, and leak-checked by the repository stress suite.
Tensor abstractions, wgpu v30 (Vulkan/DX12/Metal) WGSL compute kernels (@workgroup_size(256) <= maxComputeInvocationsPerWorkgroup: Sparse Q4 GEMV 215.05 μs, Dense Q4 GEMV, Batched Q4 GEMM, Top-8 MoE Router, 5:1 & 8:1 GQA FlashAttention, RoPE, SwiGLU, RMSNorm), and multi-OS hardware profiles (plan_coder_offload)
GGUF v2/v3 binary header, metadata & tensor unpacker (extract_tensor_f32 for F32/F16/Q8_0/Q4_K super-blocks) plus zero-copy mmap SafeTensors loader with path traversal guards
Bit-exact 256-weight GGUF Q4_K (BlockQ4K, 144B = 4.50 bpw; ~4.80–4.85 bpw in mixed Q4_K_M, imatrix WLS refinement, fused dot_f32), OCP FP8 E4M3FN (32-group), 64-group Voronoi NF4, and imatrix Q4_0
Decode-aware FlashAttention-3, Quantized Int8 (Q8_0) & Int4 (Q4_0) Paged KV Cache (1.29% peak fragmentation, 0 leaks), LIF Spiking Attention, DeepSeek MLA (512d latent + 64d RoPE), and RadixPrefixCache
Qwen3-Coder-30B-A3B Sparse MoE (48L, 32Q/4KV 8:1 GQA, 128x8 experts, 256K ctx), Qwen2.5-Coder-32B/14B/0.5B (64L/48L, 40Q/8KV 5:1 GQA, 128K ctx), DeepSeek-V3/R1 (MLA + 256+1E sigmoid MoE), and Llama 3.3 70B / Llama 4
OnlineDraftCalibrator (cross-entropy SGD logit bias distillation), RepoSuffixDrafter (O(1) trigram tree), CodeQualityEngine (Rust lifetime 'a aware AST validator), TestTimeCompute (Best-of-N), and layer streaming
Pushdown automaton & precompiled DFA constrained decoding (78.4 ns/mask), Cortical lateral inhibition, Shannon entropy monitoring (>0.40 nats), AgentCircuitBreaker, and observation compactor
Hippocampal fast-slow dual memory (CLS theory): volatile episodic buffer + cortical engram consolidation (93.8% context saved in report)
Axum HTTP/SSE OpenAI-compatible API server (/v1/chat/completions, /v1/models, /metrics, /proof) prioritizing port 8089 bare-metal 30B–32B Coder runner
Unified CLI toolchain: coder32b, gpu-bench, code-check, reason, moe-bench, speculative, stress, tune, doctor, verify, compare7b, stream70b, serve, chat, and mcp
Model Context Protocol (MCP) stdio server for native tool calling, code verification, and context in Cursor, Antigravity, Windsurf, and VS Code
Model Context Protocol (MCP) Setup
Connect HARNESS directly to Cursor, Antigravity, Windsurf, or VS Code via harness-mcp over stdio for local offline coding and agentic execution:
{
"mcpServers": {
"harness": {
"command": "cargo",
"args": ["run", "-p", "harness-mcp", "--release"],
"env": {
"RUST_LOG": "info"
}
}
}
}Developer Quickstart CLI
Clone and run the complete pure-Rust toolchain, wgpu GPU kernel suite, and 30B–32B Coder launcher:
# 1. Clone & run all 75 workspace tests git clone https://github.com/ModernOps888/harness.git && cd harness cargo test --workspace # 2. Run 9-stage hardware-synchronized wgpu GPU kernel benchmark cargo run --release -p harness-cli -- gpu-bench # 3. Launch 30B Sparse MoE Coder (16.37 tok/s) or 32B Speculative powershell -ExecutionPolicy Bypass -File scripts/launch_qwen32b_coder.ps1 -Mode MoE30B # 4. Run 32B/30B topology planner & Skeptic's Trench compiler gate cargo run --release -p harness-cli -- coder32b cargo run --release -p harness-cli -- code-check # 5. Run hardware stress suite, invariants & 70B DMA simulation cargo run -p harness-cli -- stress cargo run -p harness-cli -- verify cargo run -p harness-cli -- stream70b
Frequently Asked Technical Questions
How does HARNESS achieve 16.37 tok/s on a 30.5B-parameter Coder model with an 8GB RTX 5060?
By pairing Qwen3-Coder-30B-A3B-Instruct (Q4_K_M, Apache 2.0) — which has 30.5B total parameters across 48 layers (32Q/4KV = 8:1 GQA, 256K native context) but activates only 8 of 128 routed experts (3.3B active parameters) per token — with selective hybrid MoE offloading (-ngl 99 --n-cpu-moe 32). All 48 self-attention layers, the 32K active KV cache (78 MiB), router gates, and 16 MoE layers remain 100% resident in RTX 5060 GDDR7 VRAM (6,463.4 MiB @ 448 GB/s, safely below the 6.5 GB Windows 11 WDDM spillover cliff), while only the active 3.3B expert slices stream across 32 CPU MoE layers. This yields 16.37 tok/s pooled (16.53 tok/s Rust peak, 78.0 tok/s prefill) — a 14.11× speedup over the 32B baseline and 5.37× faster than default Ollama.
Why does speculative decoding accelerate Dense 32B by 3.36× (3.90 tok/s) but slow down 30B Sparse MoE?
In a dense 32B model (Qwen2.5-Coder-32B-Instruct Q4_K_M, 64 transformer layers / 65 offloadable blocks, 40Q/8KV = 5:1 GQA), 45 of 65 blocks (~13 GB) sit in DDR4-2133 host RAM and must be read on every forward pass (~550 ms). Using a 100% GPU-resident 0.5B drafter (-ngld 99 --prio 2) lets the 32B target verify K + 1 draft tokens in a single parallel batch pass, amortizing the DDR4 read across 5–6 accepted tokens (96.2% Rust draft acceptance, 4.80 tok/s peak, 3.90 tok/s pooled). Conversely, in a Sparse MoE model, verifying multiple draft tokens in parallel activates the union of distinct top-8 expert sets across tokens, multiplying CPU memory reads and reducing throughput from 16.37 tok/s to 11.59 tok/s.
What is the Tri-Core Architecture (Q4_K imatrix, OnlineDraftCalibrator, and Skeptic's Trench)?
HARNESS integrates three mathematical subsystems in pure Rust: (1) Q4_K Importance-Weighted Super-Block Quantizer (crates/harness-quant, BlockQ4K) packing 256 FP32 weights into 144-byte GGUF super-blocks (4.50 bpw, 7.11× compression vs FP32; ~4.80–4.85 bpw in mixed Q4_K_M) using activation importance I_i = E[x_i²] and alternating weighted least-squares scale search; (2) Online Draft Calibrator (crates/harness-pipeline/src/draft_aligner.rs) solving K* = argmax_K E[tokens(K)] / T(K) online via cross-entropy SGD bigram logit-bias updates, per-position EMA acceptance tracking, and Shannon entropy gating; and (3) Skeptic's Trench Compiler Verifier (crates/harness-pipeline & benchmarks/bench_elite_coder.py) executing real rustc --test -O and Python subprocess assertions across all 24/24 benchmark outputs.
How does 70B Temporal Layer Streaming work on consumer GPUs?
HARNESS implements a double-buffered ping-pong DMA pipeline architecture for layer streaming. While layer Ln executes in GPU VRAM (Slot 0), layer Ln+1 is prefetched asynchronously from pinned host RAM (Slot 1) over PCIe Gen4. Because only two layer buffers reside on the device at any time, this is a scheduling model (simulation); real 70B throughput on the measured PC is 0.99 - 1.68 tok/s via llama.cpp partial offload (see Verified Benchmarks).
What are the biological mechanics behind LIF Spiking Attention?
Standard attention evaluates all-to-all dense dot products (O(N²) FLOPs). HARNESS models each token key activation as a biological membrane potential with Leaky Integrate-and-Fire (LIF) dynamics. Keys whose membrane potential fails to breach dynamic threshold θ ≥ 0.35 emit zero spikes and are bypassed completely during matrix multiplication, pruning 50.0% of dense attention FLOPs in the repository report.
How does Hippocampal Fast-Slow Dual Memory (CLS Theory) solve the KV Cache Wall?
In standard inference, KV cache size grows linearly with sequence length (O(N) memory), exhausting VRAM on long documents. Based on Complementary Learning Systems (CLS) neuroscience, HARNESS pairs a volatile episodic buffer (recent tokens in high-resolution FP8/Paged KV blocks) with a cortical consolidator. During context pauses, multi-layer KV states are projected into low-rank sparse engrams, saving 93.8% of context memory in the repository report across 128k context windows (complementing DeepSeek MLA's 93.3% latent KV compression).
Why is pure Rust superior to PyTorch or C++ for LLM runtime execution?
PyTorch incurs Python interpreter GIL overhead, GC pauses, and expensive cross-language pointer wrapping. Pure C++ runtimes are vulnerable to memory unsafety and buffer overflows. Rust 1.85+ (2024 Edition, compatible through Rust 1.99) enforces compile-time ownership, deterministic zero-cost abstractions, portable wgpu v30 Vulkan/DX12/Metal shader execution, zero-copy SafeTensors/GGUF memory mapping via mmap, and Rayon parallel concurrency with zero data races.
How does local sovereign execution on HARNESS compare to 2026 frontier cloud API costs?
Frontier cloud coding APIs typically bill $3–$15 per 1M input tokens and $15–$75 per 1M output tokens while transmitting proprietary source code over external networks. Running Apache 2.0 Qwen3-Coder-30B-A3B-Instruct locally via HARNESS on an 8 GB RTX 5060 delivers 16.37 tok/s (~58,900 output tokens/hour) at £0 / $0 marginal token cost with 100% air-gapped IP sovereignty, deterministic 78.4 ns DFA schema enforcement, and local rustc --test -O verification.
100% Free & Open Source. Zero Sign-Up Required.
HARNESS is licensed under the MIT License. Run it locally, inspect the 11 crates, integrate it into your IDE via MCP, or deploy it into production with Docker.