haagenti-neural 0.1.0

Neural compression using learned codebooks for 10x model compression
Documentation

Neural Compression

10x compression using learned codebooks for model weights.

Architecture

┌─────────────────────────────────────────────────────────────────┐
│                    Neural Compression                            │
├─────────────────────────────────────────────────────────────────┤
│                                                                  │
│  Traditional: weights.safetensors (16GB)                        │
│               ↓ LZ4                                              │
│               weights.hct (8GB) — 2:1 compression               │
│                                                                  │
│  Neural:      weights.safetensors (16GB)                        │
│               ↓ Learned Encoder                                  │
│               weights.nct (1.6GB) — 10:1 compression            │
│               ↓ Learned Decoder (GPU)                            │
│               weights (reconstructed)                            │
│                                                                  │
│  ┌──────────────────────────────────────────────────────────┐   │
│  │              Compression Pipeline                         │   │
│  │                                                           │   │
│  │  Encoder (offline, CPU):                                 │   │
│  │  ┌─────────┐    ┌─────────┐    ┌─────────┐              │   │
│  │  │ Weight  │ -> │ Vector  │ -> │ Codebook│ -> indices   │   │
│  │  │ Tensor  │    │ Quantize│    │ Lookup  │              │   │
│  │  └─────────┘    └─────────┘    └─────────┘              │   │
│  │                                                           │   │
│  │  Decoder (runtime, GPU):                                 │   │
│  │  ┌─────────┐    ┌─────────┐    ┌─────────┐              │   │
│  │  │ Indices │ -> │ Codebook│ -> │ Residual│ -> weights   │   │
│  │  │         │    │ Lookup  │    │ Refine  │              │   │
│  │  └─────────┘    └─────────┘    └─────────┘              │   │
│  └──────────────────────────────────────────────────────────┘   │
└─────────────────────────────────────────────────────────────────┘

Layer-Specific Codebooks

Different layer types use different codebook sizes:

  • Attention Q/K: 4096 centroids, 12-bit indices
  • Attention V/O: 8192 centroids, 13-bit indices
  • FFN: 2048 centroids, 11-bit indices
  • Normalization: 256 centroids, 8-bit (lossless)