File size: 3,215 Bytes
8aabb7a
 
 
 
 
 
f7787aa
 
 
 
 
8aabb7a
 
f7787aa
8aabb7a
f7787aa
 
 
8aabb7a
f7787aa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
---
license: other
license_name: lfm-open-license-v1.0
license_link: https://huggingface.co/LiquidAI/LFM2.5-Encoder-350M/blob/main/LICENSE
library_name: minima-lfm
base_model: LiquidAI/LFM2.5-Encoder-350M
tags:
- ternary
- 1.58-bit
- encoder
- cpu
---

# Minima

A W1.58A8 adaptation of
[LiquidAI/LFM2.5-Encoder-350M](https://huggingface.co/LiquidAI/LFM2.5-Encoder-350M),
built with [SSHDotCodes/minima](https://github.com/SSHDotCodes/minima).

- Logical matrix values: `{-1, 0, +1}` (1.585 bits)
- Physical artifact format: I2_S, four trits per byte
- Dynamic int8 activations
- Group size 32 with rank-128 FP16 recovery adapters
- Full 8,192-token encoder context
- 223.9 MB weight file, 84.2% smaller than the 1,418.0 MB source weight file

## Use

```bash
pip install "minima-lfm @ git+https://github.com/SSHDotCodes/minima.git"
```

```python
from minima import MinimaModel

model = MinimaModel.from_pretrained("ProCreations/minima", device="cpu")
outputs = model(input_ids=input_ids, attention_mask=attention_mask)
```

CPU inference defaults to a one-time FBGEMM dynamic-int8 packing of each
effective ternary-plus-recovery matrix, after which source projection tensors are
released. Set `MINIMA_CPU_BACKEND=i2s` for the direct packed 2-bit AVX2/ARM NEON
kernel. The direct I2_S path has the smaller projection representation; the
FBGEMM path is the measured throughput default.

## Measured CPU results

Hugging Face `cpu-performance`, Linux x86-64, FBGEMM, 16 threads, one warmup and
five measured runs:

| Sequence | FP32 median | Minima median | Speedup | Peak RSS reduction |
|---:|---:|---:|---:|---:|
| 128 | 181.62 ms | 80.82 ms | 2.25x | 23.81% |
| 512 | 479.12 ms | 247.94 ms | 1.93x | 26.77% |
| 2,048 | 1,402.74 ms | 1,280.92 ms | 1.10x | 26.94% |
| 8,192 | 7,878.43 ms | 7,312.03 ms | 1.08x | 24.42% |

Peak RSS includes framework and activation memory, so it does not shrink by the
same 84.2% as the weight file. Raw reports are in the
[results dataset](https://huggingface.co/datasets/ProCreations/minima-results).

## Encoder quality

The six-task downstream gate retained **96.66%** of the matched FP32 baseline
after per-task ratios were capped at 100%. Five non-CoLA tasks averaged 98.05%;
CoLA retained 89.70%. This misses the declared 97% threshold by 0.34 percentage
points, so this artifact is a **release candidate**, not a quality-gated release.
The validation-selected CoLA schedule and all eight candidates are published in
the [raw report](https://huggingface.co/datasets/ProCreations/minima-results/blob/main/quality_gate.json).

## CUDA status

The fused Triton path avoids materializing a full dequantized weight tensor and
passes correctness checks, but the current kernel is slower than upstream BF16
on an H200. It is included for optimization work, not advertised as a GPU speedup.

## Diagnostics

The release distillation probe measured hidden-state cosine 0.8491, relative L2
0.5877, and 99.67% masked-token top-1 agreement across 601 positions. These are
diagnostics; the downstream task gate above is the release-quality measure.

## License

The weights remain subject to the LFM Open License v1.0 shipped in this
repository. The Minima runtime code is MIT licensed.