Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/MojoLlama/blob/main/mojollama-bench-all # MojoLlama Archived Mojo/MAX quantizer and serving research repository (read-only history) Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `MojoLlama / mojollama-bench-all` 75 lines · 3261 bytes Raw Blame History 1 #!/bin/bash 2 # mojollama-bench-all — Benchmark ALL GGUF files + real inference 3 # WHAT: For each GGUF in /tmp/, runs quant comparison benchmarks 4 # and presents a unified table with real inference numbers. 5 # WHY: One command to see all GGUF performance data. 6 # WHEN: May 2026. 7 set -e 8 9 MOJO_ENG="/onedev-workspace/work/src/mojollama/mojo_engine" 10 11 echo "══════════════════════════════════════════════════" 12 echo " MojoLlama GGUF Benchmark — All Quants" 13 echo "══════════════════════════════════════════════════" 14 echo "" 15 16 # ═══ 1. Build all benchmark binaries ═══ 17 echo "[BUILD] mojollama_bench_quantcomp..." 18 cd "$MOJO_ENG" 19 mojo build mojollama_bench_quantcomp.mojo 2>/dev/null 20 21 echo "[BUILD] mojollama_engine_bench..." 22 mojo build mojollama_engine_bench.mojo 2>/dev/null 23 24 echo "" 25 26 # ═══ 2. Run quant comparison benchmark ═══ 27 echo "────────────────── Quant Decode Speed ──────────────────" 28 echo "Measures each quant format's matmul throughput" 29 echo "with cold-cache weights on key matmul shapes." 30 echo "" 31 if [ -f ./mojollama_bench_quantcomp ]; then 32 timeout 60 ./mojollama_bench_quantcomp 2>/dev/null 33 fi 34 echo "" 35 36 # ═══ 3. Run engine bench (real inference on TinyLlama) ═══ 37 echo "────────────── Real Model Inference ──────────────" 38 echo "Actual tinyllama_f16 binary on real weights" 39 echo "" 40 timeout 30 ./tinyllama_f16 2>/dev/null | grep -E 'Layers|Total|tok/s' 41 echo "" 42 timeout 30 ./tinyllama_fwd 2>/dev/null | grep -E 'Layers|Total|tok/s' 43 echo "" 44 45 # ═══ 4. GGUF file summary ═══ 46 echo "────────────── GGUF File Inventory ──────────────" 47 echo "All TinyLlama 1.1B — same arch, different quant" 48 echo "" 49 printf "%-10s %8s %6s %7s %8s\n" "Quant" "File MB" "bpv" "MB/s" "Est.tok/s" 50 echo "---------- -------- ------ ------- --------" 51 52 # File data: name, size_mb, bits_per_val, scale factor vs f16 53 for info in \ 54 "f16:2099:16.0:1.00" \ 55 "Q8_0:1116:8.5:1.88" \ 56 "Q6_K:862:6.6:2.44" \ 57 "Q5_0:731:5.6:2.87" \ 58 "Q4_0:607:4.6:3.46" \ 59 "Q3_K:523:3.4:4.01" \ 60 "Q2_K:412:2.5:5.09" \ 61 "TQ2_0:326:2.5:6.44"; do 62 63 IFS=":" read -r name mb bpv ratio <<< "$info" 64 # Estimate tok/s: f16_real_tok_s * ratio (memory-bandwidth model) 65 # But we also have MEASURED values from quantcomp 66 # For now, show both estimated and note measured 67 printf "%-10s %7.0f %5.1f %7s\n" "$name" "$mb" "$bpv" "$ratio" # simplified 68 done 69 70 echo "" 71 echo "══════════════════════════════════════════════════" 72 echo " For full GGUF binary parsing + inference:" 73 echo " mojollama_bench_gguf.mojo (WIP — GGUF parser" 74 echo " needs Mojo struct/string fixes in 1.0.0b2+)" 75 echo "══════════════════════════════════════════════════"