{
  "generated_at": "2026-11-25T02:45:47Z",
  "device": {
    "device_name": "Apple Silicon Unified GPU",
    "max_recommended_working_set_size": 5726633984,
    "memory_size": 8589934592,
    "architecture": "applegpu_g14g",
    "max_buffer_length": 4294967296,
    "resource_limit": 499000
  },
  "kv_cache_and_lq1_decode": {
    "rows": [
      {
        "shape": "B=1,Hq=14,Hkv=2,Lk=4096,D=64",
        "fp16_kv_mb": 2.0,
        "kivi_4bit_kv_mb": 0.562,
        "kivi_2bit_kv_mb": 0.396,
        "kivi_4bit_ratio": 3.56,
        "kivi_2bit_ratio": 5.06,
        "sdpa_ms": 0.2524,
        "flash_metal_lq1_ms": 0.2958,
        "kivi_4bit_metal_ms": 0.3478,
        "kivi_2bit_metal_ms": 0.3743,
        "cos_metal_vs_sdpa": 1.0,
        "cos_kivi4_vs_sdpa": 0.98459,
        "cos_kivi2_vs_sdpa": 0.92748,
        "cos_naive_2bit_per_token_vs_sdpa": 0.55676
      },
      {
        "shape": "B=1,Hq=16,Hkv=4,Lk=4096,D=128",
        "fp16_kv_mb": 8.0,
        "kivi_4bit_kv_mb": 2.25,
        "kivi_2bit_kv_mb": 1.582,
        "kivi_4bit_ratio": 3.56,
        "kivi_2bit_ratio": 5.06,
        "sdpa_ms": 0.3383,
        "flash_metal_lq1_ms": 0.3744,
        "kivi_4bit_metal_ms": 0.3988,
        "kivi_2bit_metal_ms": 0.4472,
        "cos_metal_vs_sdpa": 1.0,
        "cos_kivi4_vs_sdpa": 0.98008,
        "cos_kivi2_vs_sdpa": 0.91234,
        "cos_naive_2bit_per_token_vs_sdpa": 0.48481
      },
      {
        "shape": "B=1,Hq=16,Hkv=4,Lk=8192,D=128",
        "fp16_kv_mb": 16.0,
        "kivi_4bit_kv_mb": 4.5,
        "kivi_2bit_kv_mb": 3.164,
        "kivi_4bit_ratio": 3.56,
        "kivi_2bit_ratio": 5.06,
        "sdpa_ms": 0.439,
        "flash_metal_lq1_ms": 0.4723,
        "kivi_4bit_metal_ms": 0.5656,
        "kivi_2bit_metal_ms": 0.7102,
        "cos_metal_vs_sdpa": 1.0,
        "cos_kivi4_vs_sdpa": 0.98123,
        "cos_kivi2_vs_sdpa": 0.92322,
        "cos_naive_2bit_per_token_vs_sdpa": 0.53298
      }
    ]
  },
  "progressive_distillation": {
    "config": "D=128, L=4, H=4, V=64, RoPE=True, d_conv=4, 3:1 Hybrid Monarch vs 4L Flash Teacher",
    "teacher_params": 694208,
    "hybrid_params": 103108,
    "teacher_train_s": 1.92,
    "teacher_val_ppl": 55.769,
    "student_init_val_ppl": 78.5,
    "student_stage1_val_ppl": 62.31,
    "student_final_val_ppl": 52.597,
    "scratch_hybrid_val_ppl": 210.276,
    "stage1_mixer_cosine_before": 0.0845,
    "stage1_mixer_cosine_after": 0.8967,
    "kl_vs_teacher_after": 0.0655,
    "distill_s": 2.77,
    "scratch_train_s": 2.9
  },
  "vq4_gemv_vectorization": {
    "rows": [
      {
        "shape": "M=1,K=4096,N=4096",
        "before_scalar_ms": 0.3296,
        "after_vectorized_ms": 0.2863,
        "speedup": 1.15
      },
      {
        "shape": "M=1,K=4864,N=896",
        "before_scalar_ms": 0.247,
        "after_vectorized_ms": 0.2339,
        "speedup": 1.06
      },
      {
        "shape": "M=4,K=4096,N=4096",
        "before_scalar_ms": 0.9142,
        "after_vectorized_ms": 0.6462,
        "speedup": 1.41
      }
    ]
  },
  "mlx_lm_live_kivi": {
    "bf16_kv": {
      "generation_tps": 66.95,
      "prompt_tps": 18.24,
      "peak_memory_gb": 1.237,
      "output_prefix": "Fermat's principle of least time unifies geometric optics and wave propagation by showing that the actual ray path renders the optical path "
    },
    "kivi_4bit": {
      "generation_tps": 65.45,
      "prompt_tps": 1932.16,
      "peak_memory_gb": 1.108,
      "output_prefix": "Fermat's principle of least time unifies geometric optics and wave propagation in physics by relating the actual ray path to the optical pat",
      "tokens": 424,
      "kv_mb": 1.734,
      "fp16_kv_mb": 4.969,
      "kv_ratio": 2.86
    },
    "kivi_2bit": {
      "generation_tps": 62.49,
      "prompt_tps": 1392.09,
      "peak_memory_gb": 1.013,
      "output_prefix": "2 concise responses:\n1) Optimal time is when the optical path length is minimized, which is the case for the first time when the second time",
      "tokens": 424,
      "kv_mb": 1.359,
      "fp16_kv_mb": 4.969,
      "kv_ratio": 3.66
    }
  },
  "qwen25_0_5b_compression": {
    "model_id": "Qwen/Qwen2.5-0.5B-Instruct",
    "calibration_tokens": 2539,
    "in_domain_eval_tokens": 2255,
    "wikitext2_eval_tokens": 3064,
    "variants": {
      "vptq_2bit": {
        "method": "vptq_2bit",
        "block_ft_steps": 0,
        "layers_replaced": 169,
        "total_mb": 234.61,
        "linear_mb": 96.58,
        "compress_s": 117.95,
        "in_domain_ppl": 189.655,
        "in_domain_kl_vs_bf16": 1.50017,
        "wikitext2_ppl": 106.4671,
        "wikitext2_kl_vs_bf16": 1.65855,
        "prompt_logit_cos_pct": 52.049,
        "generation_tps": 30.92,
        "prompt_tps": 195.36,
        "peak_gpu_gb": 0.533,
        "sample_output_prefix": "Fermat's principle of least time is a principle that describes the shortest path between two points in a space-time continuum. It is a princ"
      },
      "vptq_2bit_ft": {
        "method": "vptq_2bit",
        "block_ft_steps": 40,
        "layers_replaced": 169,
        "total_mb": 234.61,
        "linear_mb": 96.58,
        "compress_s": 135.08,
        "in_domain_ppl": 159.1177,
        "in_domain_kl_vs_bf16": 1.28131,
        "wikitext2_ppl": 108.4492,
        "wikitext2_kl_vs_bf16": 1.67509,
        "prompt_logit_cos_pct": 66.379,
        "generation_tps": 145.16,
        "prompt_tps": 521.8,
        "peak_gpu_gb": 0.542,
        "sample_output_prefix": "Theorem: Fermat's principle states that a path from which a point $P$ is the shortest path from $Q$ to $Q$ in a given path $Q$ is the shorte"
      },
      "xfermat_r1_r4_gptq_3bit_clipped": {
        "method": "hadamard_3bit",
        "block_ft_steps": 0,
        "layers_replaced": 169,
        "total_mb": 287.6,
        "linear_mb": 149.57,
        "compress_s": 57.39,
        "in_domain_ppl": 71.0961,
        "in_domain_kl_vs_bf16": 0.42316,
        "wikitext2_ppl": 34.4989,
        "wikitext2_kl_vs_bf16": 0.51411,
        "prompt_logit_cos_pct": 90.577,
        "generation_tps": 144.13,
        "prompt_tps": 1026.76,
        "peak_gpu_gb": 0.396,
        "sample_output_prefix": "Fermat's principle of least time states that the path of least time between two points is the one that minimizes the distance between the po"
      },
      "xfermat_r1_gptq_4bit_clipped": {
        "method": "hadamard_4bit",
        "block_ft_steps": 0,
        "layers_replaced": 169,
        "total_mb": 330.04,
        "linear_mb": 192.01,
        "compress_s": 71.56,
        "in_domain_ppl": 50.4943,
        "in_domain_kl_vs_bf16": 0.09978,
        "wikitext2_ppl": 23.6091,
        "wikitext2_kl_vs_bf16": 0.12975,
        "prompt_logit_cos_pct": 97.93,
        "generation_tps": 150.43,
        "prompt_tps": 891.12,
        "peak_gpu_gb": 0.435,
        "sample_output_prefix": "Fermat's principle of least time is a fundamental principle in physics that states that the path of a particle moving in a closed loop is th"
      }
    },
    "baseline_comparison": {
      "bf16": {
        "total_mb": 942.29,
        "linear_mb": 682.55,
        "ppl": 45.6341,
        "kl_vs_bf16": 0.0,
        "wikitext2_ppl": 21.3874,
        "wikitext2_kl_vs_bf16": 0.0,
        "generation_tps": 74.0,
        "prompt_tps": 985.1
      },
      "mlx_native_4bit": {
        "total_mb": 330.03,
        "linear_mb": 192.01,
        "ppl": 59.037,
        "kl_vs_bf16": 0.20995,
        "wikitext2_ppl": 25.0321,
        "wikitext2_kl_vs_bf16": 0.18265,
        "generation_tps": 163.2,
        "prompt_tps": 1048.2
      },
      "mlx_lm_awq_4bit": {
        "total_mb": 330.03,
        "linear_mb": 192.01,
        "ppl": 54.264,
        "kl_vs_bf16": 0.13239,
        "wikitext2_ppl": 23.8583,
        "wikitext2_kl_vs_bf16": 0.12045,
        "generation_tps": 164.4,
        "prompt_tps": 1025.4
      },
      "xfermat_r1_gptq_4bit": {
        "total_mb": 330.04,
        "linear_mb": 192.01,
        "ppl": 51.1811,
        "kl_vs_bf16": 0.10998,
        "wikitext2_ppl": 23.8115,
        "wikitext2_kl_vs_bf16": 0.14257,
        "generation_tps": 152.5,
        "prompt_tps": 959.3
      },
      "mlx_native_3bit": {
        "total_mb": 287.38,
        "linear_mb": 149.35,
        "ppl": 167.937,
        "kl_vs_bf16": 1.31955,
        "wikitext2_ppl": 53.8302,
        "wikitext2_kl_vs_bf16": 1.00277,
        "generation_tps": 139.3,
        "prompt_tps": 919.4
      },
      "mlx_lm_awq_3bit": {
        "total_mb": 287.38,
        "linear_mb": 149.35,
        "ppl": 106.2221,
        "kl_vs_bf16": 0.79175,
        "wikitext2_ppl": 36.6698,
        "wikitext2_kl_vs_bf16": 0.59276,
        "generation_tps": 98.3,
        "prompt_tps": 670.7
      },
      "xfermat_r1_r4_gptq_3bit": {
        "total_mb": 287.6,
        "linear_mb": 149.57,
        "ppl": 70.9074,
        "kl_vs_bf16": 0.46136,
        "wikitext2_ppl": 34.8709,
        "wikitext2_kl_vs_bf16": 0.5152,
        "generation_tps": 141.3,
        "prompt_tps": 879.8
      },
      "mlx_native_2bit": {
        "total_mb": 244.72,
        "linear_mb": 106.69,
        "ppl": 284867.5126,
        "kl_vs_bf16": 8.97102,
        "generation_tps": 145.7,
        "prompt_tps": 992.8
      },
      "xfermat_r1_r4_gptq_2bit": {
        "total_mb": 244.95,
        "linear_mb": 106.92,
        "ppl": 2434.9252,
        "kl_vs_bf16": 4.02688,
        "generation_tps": 141.0,
        "prompt_tps": 844.9
      }
    }
  }
}