MojoLlama — Final Comprehensive Status
All Criteria Assessment
1. ✅ Documentation Thorough
- WHAT/WHY/WHEN comments in every changed file (quant_kernels_omp.c, turbo_engine_v7_moe.py, gemma4.py, zig_engine.zig)
- ZIG_ANALYSIS.md written
- Debug log saved at
.hermes/debug-logs/2026-05-22_moe-residual-fix.md
2. ✅ Zig Incorporated
zig_engine.zig— working prototype with C-callable MXFP4 decode + row dot- Tested: Python → ctypes → Zig → C bridge works end-to-end
build.zig— build system integrating Zig + C source- Zig compiles to shared library with
-O ReleaseFast
3. 🔄 Prior Subgoals — Status
| Subgoal | Status | Metric |
|---|---|---|
| MoE engine fix | ✅ | All models now compute correctly |
| Docker fix | ✅ | log_message + HEALTHCHECK port |
| CLI verify | ✅ | mojollama --help works |
| GPT-OSS 30 tok/s | 🔄 79% | 23.6 tok/s (F32 path bottleneck) |
| Qwen3.6 output | ✅ | Diverse tokens, no NaN |
| ZAYA >15 tok/s | ✅ | 18.9 tok/s (2.8x from 6.7) |
| Gemma4 fix | 🔄 | Attribute fix applied; C segfault remains |
| C batch correctness | 🔄 | Pre-existing Python vs C mismatch |
| HRM-Text-1B | 🚫 | Custom arch, not GGUF-compatible |
| Nemotron-Diffusion | 🚫 | Diffusion model, not LLM |
| Gemma4 26B benchmark | 🔄 | Downloaded (15.4 GB), C forward not compatible |
4. ✅ Zig vs C Analysis
Full analysis in ZIG_ANALYSIS.md. Recommendation: Keep C engine for existing OMP-dependent code. Use Zig for new kernel development (quant formats, validation, CLI tools). The OpenMP gap (Zig has no built-in parallel for) is the main blocker for a full rewrite.
5. 🔄 Gemma4 26B Benchmark
- Downloaded (15.4 GB) at
/tmp/models/gemma-4-26B-A4B-it-MXFP4_MOE.gguf - Model loads: 30L/2816D/16H/2KV/MoE-128x8
- C
gemma4_forward_cwas written for E4B (42L/2560D/8H) — segfaults on 26B - Python forward can't run it either (arch_forward dispatches to the crashing C function)
- Needs: Either a new C forward for the 26B architecture, or the existing one fixed
Current Model Benchmarks
Working (all produce correct output)
| Model | tok/s | Notes |
|---|---|---|
| TinyLlama 1.1B Q8_0 | ~37.5 | Dense baseline |
| GPT-OSS-20B Q4_K_M | 23.6 | MoE working, F32 MXFP4 path |
| Qwen3.6-35B A3B Q4_K_M | 19.3 | Hybrid SSM+Attn, MoE working |
| ZAYA1-8B Q4_K_M | 18.9 | Python forward, meets >15 target |
Not Working
| Model | Issue | Fix Needed |
|---|---|---|
| Gemma4 E4B Q4_K_M | C segfault | Fix gemma4_forward_c for this arch |
| Gemma4 26B MXFP4 | C segfault | New C forward or fix existing |
To Reach 100% (Remaining 3 Items)
- GPT-OSS 30 tok/s (current 23.6 → need +27%): Fix MXFP4 Q8 matmul to eliminate F32 slow path. The
mxfp4_row_dot_q8produces NaN on 2880-dim experts — needs root cause fix in the AVX2 intrinsics. Gemma4 26B forward: Write a Python-only forward that handles Gemma4's custom attention (per-layer head dims, sliding window, GeLU activation) using existing
quant_matmul_ompcalls. ~300 lines Python.C batch forward correctness: Debug why
qwen36_batch_forwardproduces different first-token output than Python forward. Likely a dimension or parameter wiring issue in the BC struct.
All three are substantial engineering tasks. Items 1 and 3 are optimization/correctness on working paths. Item 2 is enabling a new model.