The dominant industry trend assumes that any enterprise artificial intelligence solution requires orchestrating massive models with tens or hundreds of billions of parameters through remote HTTP endpoints. However, in environments where deterministic latency, memory footprint, and data sovereignty are critical engineering constraints, this approach introduces severe bottlenecks in operating expenses and response times.

Engineering Thesis: A compact model specialized via Supervised Fine-Tuning (SFT) alongside a native C99 inference engine with zero external dependencies can resolve 100% of corporate domain queries with a Time-To-First-Token (TTFT) below 150 ms and virtually instantaneous cold starts.

⚡ 1. Dual System Architecture

The project evaluates two complementary engines designed to execute 100% locally on consumer-grade hardware (Apple Silicon M-Series):

  • 🔹 RubikPro 0.5B: Conversational engine built on top of Qwen2.5-0.5B-Instruct with fused LoRA adapters (r=16, alpha=32). Operates in FP16 precision (torch.float16) accelerated directly on GPU cores via Apple Metal Performance Shaders (MPS).
  • 🔹 RubikNano C99: Ultralight inference engine compiled in pure C99 with zero third-party dependencies. Implements a Transformer with Pre-LayerNorm, Rotary Positional Embeddings (RoPE), and SwiGLU activations, quantized to per-channel symmetric INT8 with FP32 activation buffers.
System Metric RubikPro 0.5B (Conversational) RubikNano C99 (Ultralight)
Total Parameters 494,032,768 (~494M) 9,923,840 (~9.92M)
Numerical Precision FP16 (Apple Metal MPS) Symmetric INT8 (.rnano) + FP32
Disk Footprint 953.22 MB 9.9 MB
Cold Start Time 1.529 s < 0.015 s (instant mmap)
Kernel Warmup 0.638 s N/A (Native CPU SIMD)

📊 2. Inference Telemetry and Throughput

All benchmarks were measured token-by-token in real time using model.generate() and TextIteratorStreamer, eliminating any mock responses or static caching. The evaluation suite comprised 41 live turns (14 turns across 3 multi-turn dialog sessions and 27 single-turn queries).

Global Throughput Results:
  • • Processed Volume: 21,212 total tokens (17,913 input prompt tokens + 3,299 generated output tokens).
  • • Average Time-To-First-Token (TTFT): 141.8 ms (minimum recorded: 88.28 ms, maximum: 246.82 ms).
  • • Pure Decode Throughput: 92.18 tokens/second.
  • • End-to-End Throughput (including prefill): 78.03 tokens/second.
  • • Latency Distribution: P50 of 956.64 ms and P95 of 1948.05 ms.
# Running the factual benchmark over the native C99 binary
$ python3 python/eval_rubik_kb.py --cli bin/rubik_cli
=== RubikNano Factual Benchmark [C99 CLI] ===
[PASS] KB-01 to KB-30: 30/30 (100.0% PASS)
Total time: 9.21 s | Mean latency: 307.07 ms/query
Final Accuracy: 100.0% (Target >= 85.0%)

🛡️ 3. Epistemic Limits and Out-of-Domain Guardrails

One of the primary failure modes of Small Language Models (SLMs) is hallucination when prompted outside their training distribution or when pressured to provide restricted enterprise metrics. Through curated fine-tuning datasets, the model demonstrated deterministic behavior across two critical areas:

  • 🔹 Epistemic Limits: When asked for fixed migration pricing or per-seat costs without an architectural discovery phase, the model refused to invent figures in 100% of test cases (Suite F), redirecting requests to the technical discovery workflow.
  • 🔹 Out-of-Domain Guardrails: On queries involving cooking recipes, medical guidance, offensive cyber activities, or geopolitics (Suite G), the system applied explicit domain rejection while preserving its specialized enterprise scope.
Architectural Conclusion: Decoupling inference from cloud providers for domain-specific routing and bounded knowledge tasks eliminates marginal token billing while delivering predictable 140 ms latencias that redefine interactive agent workflows.