ykhrustalev commited on
Commit
0b2728c
·
verified ·
1 Parent(s): ce1816f

README: fix sampling params (top_k=80 + rep_penalty=1.05); add mlx_lm sample_utils usage

Browse files
Files changed (1) hide show
  1. README.md +136 -1
README.md CHANGED
@@ -1,7 +1,142 @@
1
  ---
2
- language: en
3
  library_name: mlx
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  pipeline_tag: text-generation
5
  tags:
 
 
 
 
6
  - mlx
 
7
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
 
2
  library_name: mlx
3
+ license: other
4
+ license_name: lfm1.0
5
+ license_link: LICENSE
6
+ language:
7
+ - en
8
+ - ar
9
+ - zh
10
+ - fr
11
+ - de
12
+ - ja
13
+ - ko
14
+ - es
15
+ - pt
16
  pipeline_tag: text-generation
17
  tags:
18
+ - liquid
19
+ - lfm2.5
20
+ - edge
21
+ - moe
22
  - mlx
23
+ base_model: LiquidAI/LFM2.5-8B-A1B
24
  ---
25
+
26
+ <div align="center">
27
+ <img
28
+ src="https://cdn-uploads.huggingface.co/production/uploads/61b8e2ba285851687028d395/2b08LKpev0DNEk6DlnWkY.png"
29
+ alt="Liquid AI"
30
+ style="width: 100%; max-width: 100%; height: auto; display: inline-block; margin-bottom: 0.5em; margin-top: 0.5em;"
31
+ />
32
+ <div style="display: flex; justify-content: center; gap: 0.5em; margin-bottom: 1em;">
33
+ <a href="https://playground.liquid.ai/"><strong>Try LFM</strong></a> •
34
+ <a href="https://docs.liquid.ai/lfm/getting-started/welcome"><strong>Docs</strong></a> •
35
+ <a href="https://leap.liquid.ai/"><strong>LEAP</strong></a> •
36
+ <a href="https://discord.com/invite/liquid-ai"><strong>Discord</strong></a>
37
+ </div>
38
+ </div>
39
+
40
+ # LiquidAI/LFM2.5-8B-A1B-MLX-4bit
41
+
42
+ This model [LiquidAI/LFM2.5-8B-A1B-MLX-4bit](https://huggingface.co/LiquidAI/LFM2.5-8B-A1B-MLX-4bit) was converted to MLX format from [LiquidAI/LFM2.5-8B-A1B](https://huggingface.co/LiquidAI/LFM2.5-8B-A1B) using mlx-lm version **0.31.3**.
43
+
44
+ ## About this quantization
45
+
46
+ Quantized to 4 bits per weight (group size 64, affine mode). MoE routing gates retained at 8 bits.
47
+
48
+ ## About LFM2.5-8B-A1B
49
+
50
+ LFM2.5 is a new family of hybrid models designed for on-device deployment. It builds on the LFM2 architecture with extended pre-training and reinforcement learning.
51
+
52
+ - **On-device personal assistant**: Designed to power real-life agentic applications, chaining tool calls and following complex instructions on modest devices.
53
+ - **Compressed performance**: Competitive with much larger models on instruction following, math, and agentic benchmarks at only 1.5B active parameters.
54
+ - **Unmatched throughput**: Fastest model in its size class on H100 (18.5K output tok/s at high concurrency via SGLang), with first-class CPU support through llama.cpp.
55
+
56
+ Find more information about LFM2.5-8B-A1B in the [blog post](https://www.liquid.ai/blog/lfm2-5-8b-a1b) and the [original model card](https://huggingface.co/LiquidAI/LFM2.5-8B-A1B).
57
+
58
+ ### Model Details
59
+
60
+ - **Total parameters**: 8.3B
61
+ - **Active parameters**: 1.5B
62
+ - **Number of layers**: 24 (18 double-gated LIV conv + 6 GQA)
63
+ - **Context length**: 131,072
64
+ - **Vocabulary size**: 128,000
65
+ - **Languages**: English, Arabic, Chinese, French, German, Japanese, Korean, Portuguese, Spanish
66
+ - **Recommended generation parameters**:
67
+ - `temperature: 0.2`
68
+ - `top_k: 80`
69
+ - `repetition_penalty: 1.05`
70
+
71
+ ## Use with mlx
72
+
73
+ ```bash
74
+ pip install mlx-lm
75
+ ```
76
+
77
+ ```python
78
+ from mlx_lm import load, generate
79
+ from mlx_lm.sample_utils import make_sampler, make_logits_processors
80
+
81
+ model, tokenizer = load("LiquidAI/LFM2.5-8B-A1B-MLX-4bit")
82
+
83
+ prompt = "What is C. elegans?"
84
+
85
+ if tokenizer.chat_template is not None:
86
+ messages = [{"role": "user", "content": prompt}]
87
+ prompt = tokenizer.apply_chat_template(
88
+ messages, add_generation_prompt=True
89
+ )
90
+
91
+ sampler = make_sampler(temp=0.2, top_k=80)
92
+ logits_processors = make_logits_processors(repetition_penalty=1.05)
93
+
94
+ response = generate(
95
+ model, tokenizer, prompt=prompt,
96
+ sampler=sampler, logits_processors=logits_processors,
97
+ verbose=True,
98
+ )
99
+ ```
100
+
101
+ ### Chat Template
102
+
103
+ LFM2.5 uses a ChatML-like format. See the [Chat Template documentation](https://docs.liquid.ai/lfm/key-concepts/chat-template) for details. Example:
104
+
105
+ ```
106
+ <|startoftext|><|im_start|>system
107
+ You are a helpful assistant trained by Liquid AI.<|im_end|>
108
+ <|im_start|>user
109
+ What is C. elegans?<|im_end|>
110
+ <|im_start|>assistant
111
+ ```
112
+
113
+ Because LFM2.5-8B-A1B is a reasoning model, assistant turns contain an explicit chain of thought before the final answer. `tokenizer.apply_chat_template()` formats messages automatically.
114
+
115
+ ### Tool Use
116
+
117
+ LFM2.5 supports function calling. Pass tools to `tokenizer.apply_chat_template(..., tools=...)`. See the [Tool Use documentation](https://docs.liquid.ai/lfm/key-concepts/tool-use) for the full guide.
118
+
119
+ ## License
120
+
121
+ LFM Open License v1.0 — see the [LICENSE](LICENSE) file or the [original model card](https://huggingface.co/LiquidAI/LFM2.5-8B-A1B) for terms.
122
+
123
+ ## Citation
124
+
125
+ ```bibtex
126
+ @article{liquidAI20268BA1B,
127
+ author = {Liquid AI},
128
+ title = {LFM2.5-8B-A1B: Personal Assistant On Your Laptop},
129
+ journal = {Liquid AI Blog},
130
+ year = {2026},
131
+ note = {www.liquid.ai/blog/lfm2-5-8b-a1b},
132
+ }
133
+ ```
134
+
135
+ ```bibtex
136
+ @article{liquidai2025lfm2,
137
+ title = {LFM2 Technical Report},
138
+ author = {Liquid AI},
139
+ journal = {arXiv preprint arXiv:2511.23404},
140
+ year = {2025}
141
+ }
142
+ ```