Upload folder using huggingface_hub
Browse files
.gitattributes
CHANGED
|
@@ -84,3 +84,5 @@ function-calls/functiongemma-270m-cellm/functiongemma-270m-int8-e4g32.cellm filt
|
|
| 84 |
function-calls/functiongemma-270m-cellm/functiongemma-270m-f16.cellm filter=lfs diff=lfs merge=lfs -text
|
| 85 |
privacy/privacy-filter-int4-g32-f16s.cellm filter=lfs diff=lfs merge=lfs -text
|
| 86 |
privacy/privacy-filter-int3-g128.cellm filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 84 |
function-calls/functiongemma-270m-cellm/functiongemma-270m-f16.cellm filter=lfs diff=lfs merge=lfs -text
|
| 85 |
privacy/privacy-filter-int4-g32-f16s.cellm filter=lfs diff=lfs merge=lfs -text
|
| 86 |
privacy/privacy-filter-int3-g128.cellm filter=lfs diff=lfs merge=lfs -text
|
| 87 |
+
LFM2-2.6B-int4-g64/LFM2-2.6B-int4-g64.cellm filter=lfs diff=lfs merge=lfs -text
|
| 88 |
+
LFM2-2.6B-int4-g64/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
LFM2-2.6B-int4-g64/LFM2-2.6B-int4-g64.cellm
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:74e7429152b0990d1f7a26a58bfcfafc853d7b1d210ede1439589c7118d895fb
|
| 3 |
+
size 1686190208
|
LFM2-2.6B-int4-g64/README.md
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: cellm
|
| 3 |
+
license: apache-2.0
|
| 4 |
+
tags:
|
| 5 |
+
- cellm
|
| 6 |
+
- rust
|
| 7 |
+
- quantized
|
| 8 |
+
- int4
|
| 9 |
+
- cpu
|
| 10 |
+
- lfm2
|
| 11 |
+
- reasoning
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# LFM2-2.6B INT4 g64 (cellm)
|
| 15 |
+
|
| 16 |
+
Liquid Foundation Model 2 (2.6B) converted to cellm format, MLX-style affine
|
| 17 |
+
INT4 at group size 64. Runs on CPU with an ARM `SDOT` W4A8 prefill kernel.
|
| 18 |
+
|
| 19 |
+
This build emits `<think>` reasoning blocks before its answer.
|
| 20 |
+
|
| 21 |
+
## Files
|
| 22 |
+
|
| 23 |
+
| file | size |
|
| 24 |
+
| ---- | ---- |
|
| 25 |
+
| `LFM2-2.6B-int4-g64.cellm` | 1,686,190,208 bytes (1.57 GiB) |
|
| 26 |
+
| `tokenizer.json` | 17 MB |
|
| 27 |
+
|
| 28 |
+
## Model details
|
| 29 |
+
|
| 30 |
+
- **Format**: cellm (`.cellm`)
|
| 31 |
+
- **Precision**: affine INT4, nibbles packed 8-per-`u32`, f32 `.scales` /
|
| 32 |
+
`.biases` sidecars at group size 64
|
| 33 |
+
- **Parameters**: 2,697,198,592
|
| 34 |
+
- **Architecture**: LFM2 hybrid, 30 layers (LIV convolution + grouped-query
|
| 35 |
+
attention)
|
| 36 |
+
- **Hidden size**: 2048
|
| 37 |
+
- **Heads**: 32 query / 8 key-value
|
| 38 |
+
- **Vocab**: 128,000, tied embeddings
|
| 39 |
+
- **RoPE theta**: 10,000,000
|
| 40 |
+
- **Chat format**: ChatML, EOS 124900, `<think>` = 124901
|
| 41 |
+
|
| 42 |
+
## Usage
|
| 43 |
+
|
| 44 |
+
```sh
|
| 45 |
+
./target/release/infer \
|
| 46 |
+
--model LFM2-2.6B-int4-g64.cellm \
|
| 47 |
+
--tokenizer tokenizer.json \
|
| 48 |
+
--prompt "What is the capital of France?" \
|
| 49 |
+
--chat --gen 120 --temperature 0 --stop-eos
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
Output:
|
| 53 |
+
|
| 54 |
+
```
|
| 55 |
+
Prefill: 16 tokens in 4.31s (next=124901)
|
| 56 |
+
<think>The user is asking a straightforward factual question: "What is the
|
| 57 |
+
capital of France?"
|
| 58 |
+
|
| 59 |
+
1. **Identify the core entity and attribute:** The entity is "France", the
|
| 60 |
+
attribute is "capital".
|
| 61 |
+
2. **Retrieve knowledge:** My internal knowledge base contains information
|
| 62 |
+
about world capitals. The capital of France is Paris.
|
| 63 |
+
3. **Formulate the answer:** The direct answer is "Paris".
|
| 64 |
+
4. **Check for nuances or additional context:** Sometimes people mention
|
| 65 |
+
"Île-de-France" as the region, but the capital city is definitely Paris.
|
| 66 |
+
Decode: 120 tokens in 18.23s
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
Code generation:
|
| 70 |
+
|
| 71 |
+
```sh
|
| 72 |
+
./target/release/infer \
|
| 73 |
+
--model LFM2-2.6B-int4-g64.cellm \
|
| 74 |
+
--tokenizer tokenizer.json \
|
| 75 |
+
--prompt "Write a Python function that reverses a string. Answer with code only." \
|
| 76 |
+
--chat --gen 200 --temperature 0 --stop-eos
|
| 77 |
+
```
|
| 78 |
+
|
| 79 |
+
~~~
|
| 80 |
+
Prefill: 23 tokens in 0.84s (next=124901)
|
| 81 |
+
<think>The user wants a Python function that reverses a string.
|
| 82 |
+
The constraint is "Answer with code only." This means I should not include
|
| 83 |
+
explanations, comments outside the function, or any other text. Just the
|
| 84 |
+
function definition.
|
| 85 |
+
|
| 86 |
+
There are several ways to do this in Python:
|
| 87 |
+
1. Slicing: `return s[::-1]` - This is the most Pythonic and efficient way.
|
| 88 |
+
2. `reversed()` function combined with `join`: `return ''.join(reversed(s))`
|
| 89 |
+
|
| 90 |
+
The slicing method `[::-1]` is concise, readable, and standard for this task.
|
| 91 |
+
|
| 92 |
+
So the code should look like:
|
| 93 |
+
```python
|
| 94 |
+
def reverse_string(s):
|
| 95 |
+
return s[::-1]
|
| 96 |
+
```
|
| 97 |
+
Decode: 200 tokens in 29.19s
|
| 98 |
+
~~~
|
| 99 |
+
|
| 100 |
+
Both runs are greedy (`--temperature 0`) on an Apple M-series CPU with the
|
| 101 |
+
model already in the page cache. Raise `--gen` to let the model finish past the
|
| 102 |
+
reasoning block.
|
| 103 |
+
|
| 104 |
+
## Performance
|
| 105 |
+
|
| 106 |
+
Prefill uses a W4A8 kernel: activations are quantized to INT8 and dotted
|
| 107 |
+
against the packed nibbles with ARM `SDOT`. Affine nibbles are unsigned 0..15,
|
| 108 |
+
so they reinterpret as non-negative `i8` exactly, and the `bias * sum(x)` term
|
| 109 |
+
stays in f32 against unquantized activations. Greedy output is byte-identical
|
| 110 |
+
to the f32 path.
|
| 111 |
+
|
| 112 |
+
| prompt tokens | f32 NEON | W4A8 | speedup |
|
| 113 |
+
| ------------- | -------- | ------ | ------- |
|
| 114 |
+
| 70 | 11.30s | 2.28s | 4.96x |
|
| 115 |
+
| 210 | 27.74s | 6.63s | 4.18x |
|
| 116 |
+
| 460 | 61.99s | 19.68s | 3.15x |
|
| 117 |
+
|
| 118 |
+
The speedup shrinks as prompts grow because attention is quadratic and not
|
| 119 |
+
covered by this kernel.
|
| 120 |
+
|
| 121 |
+
Notes on measuring:
|
| 122 |
+
|
| 123 |
+
- Run-to-run variance is about ±7%, so treat any single timing as a range.
|
| 124 |
+
- A cold page cache on the 1.6 GiB file moves prefill by more than 2x. Warm it
|
| 125 |
+
with a throwaway `--gen 1` run first.
|
| 126 |
+
- Peak resident size is ~1.7 GB. Measure with `vmmap --summary` "Physical
|
| 127 |
+
footprint"; `ps` RSS counts clean file-backed mmap pages and overstates this
|
| 128 |
+
by roughly 3x.
|
| 129 |
+
- Override the weight cache bound with `CELLM_WEIGHT_CACHE_MB` if needed.
|
| 130 |
+
|
| 131 |
+
## Known issues
|
| 132 |
+
|
| 133 |
+
- Metal is not implemented for the LFM2 runner. `--backend metal` silently
|
| 134 |
+
falls back to CPU.
|
| 135 |
+
- The tokenizer carries vision and audio tokens this text-only build does not
|
| 136 |
+
define, so startup prints hundreds of benign lines like
|
| 137 |
+
`Token '<|img_row_9_col_9|>' was expected to have ID '124996' but was given ID 'None'`.
|
| 138 |
+
Filter with `2>/dev/null` or `2>&1 | grep -v 'tokenizers::'`.
|
| 139 |
+
|
| 140 |
+
## Quantization
|
| 141 |
+
|
| 142 |
+
INT4 is the floor for this model. INT2 was tested end-to-end by writing
|
| 143 |
+
INT2-derived `(q, scale, bias)` triples into the INT4 container, which
|
| 144 |
+
reproduces INT2 numerics exactly. Even the gentlest variant measured (FFN-only,
|
| 145 |
+
group 64, MSE-optimal clipping, 34.2% mean weight error) produced grammatical
|
| 146 |
+
but broken output: it lost the `<think>` behavior, hallucinated a phantom input
|
| 147 |
+
token, inverted basic physics, and would not write code when asked.
|
| 148 |
+
|
| 149 |
+
| scheme | rel. error | cosine |
|
| 150 |
+
| ------ | ---------- | ------ |
|
| 151 |
+
| int4 g64 | 0.00% | 1.0000 |
|
| 152 |
+
| int3 g64 | 20.4% | 0.9872 |
|
| 153 |
+
| int2 g64 mse | 33.8% | 0.9437 |
|
| 154 |
+
| int2 g64 | 46.0% | 0.9161 |
|
| 155 |
+
| int2 g128 | 53.5% | 0.8946 |
|
| 156 |
+
|
| 157 |
+
## License
|
| 158 |
+
|
| 159 |
+
Apache 2.0, same as upstream LFM2.
|
LFM2-2.6B-int4-g64/tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:695be7802a0e4b8a81048f0ff5ebb7fc811a0ba5a6be63dbb24deb5a81096f41
|
| 3 |
+
size 17905598
|