quangnd58 commited on
Commit
6e8fa20
·
verified ·
1 Parent(s): ac68a1b

Add files using upload-large-folder tool

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
LICENSE ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ LFM Open License v1.0
2
+
3
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
4
+
5
+ 1. Definitions.
6
+
7
+ "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by this document.
8
+
9
+ "Licensor" shall mean Liquid AI, Inc.
10
+
11
+ "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
12
+
13
+ "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
14
+
15
+ "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
16
+
17
+ "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
18
+
19
+ "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work.
20
+
21
+ "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
22
+
23
+ "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
24
+
25
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
26
+
27
+ "Commercial Use" shall mean any use of the Work for direct or indirect commercial advantage or monetary compensation.
28
+
29
+ "Qualified Non-Profit Organization" shall mean a Legal Entity that is organized and operated exclusively for religious, charitable, scientific, testing for public safety, literary, or educational purposes, and which is exempt from federal income tax under Section 501(c)(3) of the United States Internal Revenue Code of 1986, as amended, or any equivalent non-profit or charitable organization in a foreign jurisdiction.
30
+
31
+ "Non-Commercial or Research Purposes" shall mean purposes that do not involve any use of the Work or a Derivative Work for Commercial Use.
32
+
33
+ "Threshold" shall mean annual revenue of 10 million United States dollars ($10,000,000) or more.
34
+
35
+ 2. Grant of Copyright License. Subject to the terms and conditions of this License, including the Commercial Use limitation set forth in Section 5, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
36
+
37
+ 3. Grant of Patent License. Subject to the terms and conditions of this License, including the Commercial Use limitation set forth in Section 5, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
38
+
39
+ 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
40
+
41
+ (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
42
+
43
+ (b) You must cause any modified files to carry prominent notices stating that You changed the files; and
44
+
45
+ (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
46
+
47
+ (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
48
+
49
+ You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
50
+
51
+ 5. Commercial Use Limitation.
52
+
53
+ (a) The rights granted under this License for Commercial Use are conditioned upon You or Your Legal Entity not exceeding the Threshold.
54
+
55
+ (b) Any Commercial Use of the Work or a Derivative Work by a Legal Entity that exceeds the Threshold is not licensed under this Agreement.
56
+
57
+ (c) The Threshold shall not apply to a Qualified Non-Profit Organization's use of the Work or a Derivative Work for Non-Commercial or Research Purposes.
58
+
59
+ 6. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
60
+
61
+ 7. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except for the reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
62
+
63
+ 8. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
64
+
65
+ 9. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
66
+
67
+ 10. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
68
+
69
+ 11. Termination. This License will terminate automatically and immediately if You fail to comply with any of its terms and conditions. Upon termination, You must cease all use of the Work and any Derivative Works and delete all copies in Your possession.
70
+
71
+ END OF TERMS AND CONDITIONS
README.md ADDED
@@ -0,0 +1,429 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ license: other
4
+ license_name: lfm1.0
5
+ license_link: LICENSE
6
+ language:
7
+ - ar
8
+ - zh
9
+ - en
10
+ - fr
11
+ - de
12
+ - hi
13
+ - id
14
+ - it
15
+ - ja
16
+ - ko
17
+ - pl
18
+ - pt
19
+ - ru
20
+ - es
21
+ - th
22
+ - vi
23
+ pipeline_tag: text-generation
24
+ base_model: LiquidAI/LFM2.5-2.6B
25
+ base_model_relation: quantized
26
+ tags:
27
+ - liquid
28
+ - lfm2.5
29
+ - edge
30
+ - quantized
31
+ - fp8
32
+ - w8a8
33
+ - compressed-tensors
34
+ - llmcompressor
35
+ - vllm
36
+ ---
37
+ # LFM2.5-2.6B-FP8
38
+
39
+ Quantized build of [LiquidAI/LFM2.5-2.6B](https://huggingface.co/LiquidAI/LFM2.5-2.6B),
40
+ produced by [vrfai](https://huggingface.co/vrfai).
41
+
42
+ **Format:** FP8 (W8A8), SmoothQuant + static per-tensor activation scales
43
+ from calibration, serialized as `compressed-tensors`.
44
+ **Size:** 2.77 GB (base model: 5.0 GB, 55% of original).
45
+
46
+ ## What was quantized
47
+
48
+ LFM2.5-2.6B is a hybrid stack: 30 `Lfm2DecoderLayer`s, 8 `full_attention`
49
+ and 22 `conv` (`Lfm2ShortConv` — a depthwise causal `nn.Conv1d`, kernel size
50
+ 3, **not** an SSM with a learned decay gate the way Gated DeltaNet is, so
51
+ unlike that architecture there is no fragile recurrence-decay sub-component
52
+ inside the conv block worth protecting). Only `lm_head` is held at bf16;
53
+ every other Linear quantizes — 1 module(s) excluded
54
+ (`lm_head`).
55
+
56
+ | Component | Precision |
57
+ |---|---|
58
+ | `self_attn.{q,k,v}_proj` / `out_proj` (8 attention layers) | FP8 |
59
+ | `conv.in_proj` / `conv.out_proj` (22 conv layers) | FP8 |
60
+ | `feed_forward.{w1,w2,w3}` (all 30 layers) | FP8 |
61
+ | `lm_head` | **bf16** |
62
+
63
+ **90.28%** of all `nn.Linear` weight (by parameter count) is quantized —
64
+ see the source pipeline's `inspect_model.py` for the full per-role census.
65
+
66
+ ## Quantization configuration
67
+
68
+ | | |
69
+ |---|---|
70
+ | Method | `llmcompressor` 0.13.0 — SmoothQuant + static FP8 |
71
+ | SmoothQuant | enabled, strength = 0.8, 60 mappings (one operator_norm + one ffn_norm pair per decoder layer, built from the live module tree since attention/conv layers have different SmoothQuant balance targets) |
72
+ | Calibration data | `abisee/cnn_dailymail` (512 samples @ 2048 tokens, text-only — correct for a text-only LLM) |
73
+ | Weights | 8-bit float (E4M3), per-tensor scale |
74
+ | Activations | 8-bit float (E4M3), per-tensor static scale from calibration |
75
+
76
+ ## Benchmark results
77
+
78
+ Two tasks, chosen because they exist in the installed `lm_eval` harness
79
+ **and** are the closest deterministic (no LLM-judge) match to what
80
+ LiquidAI's own model card reports for LFM2.5-2.6B: `IFBench`/`Multi-IF`
81
+ (instruction-following) → `ifeval`; `AIME25` (math reasoning) → `aime25`,
82
+ a literal name match to the card's own reported score.
83
+
84
+ LFM2.5's chat template unconditionally opens every generation with
85
+ `<think>` (no non-thinking toggle exists — verified directly against
86
+ `chat_template.jinja`), so both tasks run in a `_think` variant that strips
87
+ everything up to `</think>` before scoring, and a mild
88
+ `repetition_penalty=1.1` (fully deterministic, no sampling) is applied —
89
+ without it, plain greedy decoding measurably got stuck in degenerate
90
+ token-repeat loops on `ifeval` for both checkpoints, inflating truncated
91
+ responses with a cause that has nothing to do with quantization.
92
+
93
+ | Task | Metric | bf16 baseline | This model (fp8) | Δ (abs) | Δ (rel) |
94
+ |---|---|---:|---:|---:|---:|
95
+ | AIME25 | exact_match | 40.00% (n=30) | 33.33% (n=30) | -6.67 | -16.7% |
96
+ | IFEval | prompt_level_strict_acc | 69.32% (n=541) | 73.75% (n=541) | +4.44 | +6.4% |
97
+
98
+ Both deltas are within run-to-run noise at these sample sizes (two-proportion
99
+ z-test, p > 0.05) — no measurable regression from FP8 quantization on either
100
+ task. AIME25 (n=30) has limited statistical power by nature of the dataset
101
+ size; IFEval (n=541) is the more reliable signal of the two and shows FP8
102
+ matching or slightly exceeding the bf16 baseline.
103
+
104
+ ## Usage
105
+
106
+ No quantization flag is required — vLLM reads the format from `config.json`.
107
+
108
+ ```bash
109
+ vllm serve vrfai/LFM2.5-2.6B-FP8 --trust-remote-code
110
+ ```
111
+
112
+ ```python
113
+ from vllm import LLM, SamplingParams
114
+
115
+ llm = LLM(model="vrfai/LFM2.5-2.6B-FP8", trust_remote_code=True)
116
+ print(llm.generate(["The capital of France is"],
117
+ SamplingParams(temperature=0.0, max_tokens=64))[0].outputs[0].text)
118
+ ```
119
+
120
+ ---
121
+
122
+ > [!WARNING]
123
+ > **Everything below this line is reproduced verbatim from the base model
124
+ > card, [LiquidAI/LFM2.5-2.6B](https://huggingface.co/LiquidAI/LFM2.5-2.6B).** The benchmark
125
+ > tables it contains (AA-Omni, AIME25, LiveCodeBench, IFBench, BFCL, ...)
126
+ > were measured by LiquidAI on the original weights. They were **not**
127
+ > measured on this quantized checkpoint. For numbers measured on these
128
+ > weights, see the Benchmark results section above.
129
+
130
+ ---
131
+
132
+ <div align="center">
133
+ <img
134
+ src="https://cdn-uploads.huggingface.co/production/uploads/61b8e2ba285851687028d395/2b08LKpev0DNEk6DlnWkY.png"
135
+ alt="Liquid AI"
136
+ style="width: 100%; max-width: 100%; height: auto; display: inline-block; margin-bottom: 0.5em; margin-top: 0.5em;"
137
+ />
138
+ <div style="display: flex; justify-content: center; gap: 0.5em; margin-bottom: 1em;">
139
+ <a href="https://playground.liquid.ai/"><strong>Try LFM</strong></a> •
140
+ <a href="https://docs.liquid.ai/lfm/getting-started/welcome"><strong>Docs</strong></a> •
141
+ <a href="https://leap.liquid.ai/"><strong>LEAP</strong></a> •
142
+ <a href="https://discord.com/invite/liquid-ai"><strong>Discord</strong></a>
143
+ </div>
144
+ </div>
145
+
146
+ # LFM2.5-2.6B
147
+
148
+ LFM2.5-2.6B is part of LFM2.5, a family of hybrid models designed for **on-device deployment**. It builds on the LFM2 architecture with a 128K context window and agentic post-training.
149
+
150
+ - **Best-in-class agent**: Competitive with models 4x larger on tool use, instruction following, and multi-step agentic tasks.
151
+ - **Agentic reinforcement learning**: Trained inside the most popular agentic harnesses to improve compatibility.
152
+ - **Efficient inference**: 220 tok/s on an Apple M5 Max and 113 tok/s on an AMD Ryzen CPU, in under 2.5 GB of memory.
153
+
154
+ Find more information about LFM2.5-2.6B in our [blog post](https://www.liquid.ai/blog/lfm2-5-2-6b).
155
+
156
+ ![](https://cdn-uploads.huggingface.co/production/uploads/644249b08443bce4c9890a0f/NAfUL2725b6KDUGf1KOd9.png)
157
+
158
+ > [!NOTE]
159
+ > 💻 **Demos**: Try LFM2.5-2.6B's agentic capabilities in a Hugging Face space without any setup:
160
+ > **[Research Agent in your browser](https://huggingface.co/spaces/LiquidAI/LFM2.5-2.6B-WebGPU)**: helps you research a specific question and generates a summary
161
+
162
+ ## 🗒️ Model Details
163
+
164
+ | Model | Parameters | Description |
165
+ | -------------------------------------------------------------------- | ---------- | -------------------------------------- |
166
+ | [LFM2.5-2.6B-Base](https://huggingface.co/LiquidAI/LFM2.5-2.6B-Base) | 2.6B | Pre-trained base model for fine-tuning |
167
+ | **[LFM2.5-2.6B](https://huggingface.co/LiquidAI/LFM2.5-2.6B)** | 2.6B | Post-trained for agentic workloads |
168
+
169
+ LFM2.5-2.6B is a general-purpose text-only model with the following features:
170
+
171
+ - **Total parameters**: 2.69B
172
+ - **Number of layers**: 30 (22 double-gated short convolution blocks + 8 GQA)
173
+ - **Training budget**: 34 trillion tokens
174
+ - **Vocabulary size**: 128,000
175
+ - **Context length**: 131,072 tokens
176
+ - **Languages**: English, Arabic, Chinese, French, German, Italian, Japanese, Korean, Portuguese, Spanish, Vietnamese, Thai, Indonesian, Hindi, Russian, Polish
177
+ - **Generation parameters**:
178
+ - `temperature: 0.1`
179
+ - `top_k: 50`
180
+ - `repetition_penalty: 1.1`
181
+
182
+ | Model | Description |
183
+ | ------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- |
184
+ | **[LFM2.5-2.6B](https://huggingface.co/LiquidAI/LFM2.5-2.6B)** | Original model checkpoint in native format. Best for fine-tuning or inference with Transformers, vLLM, and SGLang. |
185
+ | **[LFM2.5-2.6B-GGUF](https://huggingface.co/LiquidAI/LFM2.5-2.6B-GGUF)** | Quantized format for llama.cpp and compatible tools. Optimized for CPU inference and local deployment with reduced memory usage. |
186
+ | **[LFM2.5-2.6B-ONNX](https://huggingface.co/LiquidAI/LFM2.5-2.6B-ONNX)** | ONNX Runtime format for cross-platform deployment. Enables hardware-accelerated inference across diverse environments (cloud, edge, mobile). |
187
+ | **[LFM2.5-2.6B-MLX](https://huggingface.co/LiquidAI/LFM2.5-2.6B-MLX)** | MLX format for Apple Silicon. Optimized for fast inference on Mac devices using the MLX framework. |
188
+ | **[LFM2.5-2.6B-DSpark](https://huggingface.co/LiquidAI/LFM2.5-2.6B-DSpark)** | Speculative decoding drafter (328M). Pair it with this model for ~2.6x faster decoding with identical outputs. |
189
+
190
+ We recommend using it for agentic workloads, tool use, data extraction, RAG, and long-context workflows. It is not recommended for agentic coding and knowledge-heavy tasks.
191
+
192
+ ### Chat Template
193
+
194
+ LFM2.5 uses a ChatML-like format. See the [Chat Template documentation](https://docs.liquid.ai/lfm/key-concepts/chat-template) for details. Example:
195
+
196
+ ```
197
+ <|startoftext|><|im_start|>system
198
+ You are a helpful assistant trained by Liquid AI.<|im_end|>
199
+ <|im_start|>user
200
+ What is C. elegans?<|im_end|>
201
+ <|im_start|>assistant
202
+ ```
203
+
204
+ You can use [`tokenizer.apply_chat_template()`](https://huggingface.co/docs/transformers/en/chat_templating#using-applychattemplate) to format your messages automatically.
205
+
206
+ > [!TIP]
207
+ > 💡 **Note**: LFM2.5-2.6B is a pure reasoning model that always thinks before it answers. It adds a `<think>` tag directly in the [chat template](https://huggingface.co/LiquidAI/LFM2.5-2.6B/blob/main/chat_template.jinja#L124) when starting an assistant answer.
208
+
209
+ ### Tool Use
210
+
211
+ LFM2.5 supports function calling in four steps:
212
+
213
+ 1. **Function definition**: Provide the list of tools as a JSON object in the system prompt, or use [`tokenizer.apply_chat_template()`](https://huggingface.co/docs/transformers/en/chat_extras#passing-tools) with `tools=...`.
214
+ 2. **Function call**: By default, LFM2.5 writes Pythonic function calls (a Python list between `<|tool_call_start|>` and `<|tool_call_end|>` special tokens), as the assistant answer. You can override this behavior by asking the model to output JSON function calls in the system prompt.
215
+ 3. **Function execution**: Execute the call and return the result with the `tool` role.
216
+ 4. **Final answer**: LFM2.5 interprets the tool output and returns a plain-text answer addressing the original prompt.
217
+
218
+ See the [Tool Use documentation](https://docs.liquid.ai/lfm/key-concepts/tool-use) for the full guide. Example:
219
+
220
+ ```
221
+ <|startoftext|><|im_start|>system
222
+ List of tools: [{"name": "get_candidate_status", "description": "Retrieves the current status of a candidate in the recruitment process", "parameters": {"type": "object", "properties": {"candidate_id": {"type": "string", "description": "Unique identifier for the candidate"}}, "required": ["candidate_id"]}}]<|im_end|>
223
+ <|im_start|>user
224
+ What is the current status of candidate ID 12345?<|im_end|>
225
+ <|im_start|>assistant
226
+ <|tool_call_start|>[get_candidate_status(candidate_id="12345")]<|tool_call_end|>Checking the current status of candidate ID 12345.<|im_end|>
227
+ <|im_start|>tool
228
+ [{"candidate_id": "12345", "status": "Interview Scheduled", "position": "Clinical Research Associate", "date": "2023-11-20"}]<|im_end|>
229
+ <|im_start|>assistant
230
+ The candidate with ID 12345 is currently in the "Interview Scheduled" stage for the position of Clinical Research Associate, with an interview date set for 2023-11-20.<|im_end|>
231
+ ```
232
+
233
+ ### Training
234
+
235
+ LFM2.5-2.6B is pre-trained on ~34T tokens, with a mid-training phase that extends the context window to 128K. Post-training then turns the base model into an agent in four stages: supervised fine-tuning (two rounds), per-domain teacher specialization, multi-domain on-policy distillation, and agentic reinforcement learning.
236
+
237
+ ![](https://cdn-uploads.huggingface.co/production/uploads/61b8e2ba285851687028d395/hCmGKgTRihAR9NfJlCVNN.png)
238
+
239
+ In particular, agentic reinforcement learning allows us to directly train the model inside popular agentic harnesses. It exposes the model to their tools, system prompts, and interaction patterns, helping it work reliably across agent environments.
240
+
241
+ ![](https://cdn-uploads.huggingface.co/production/uploads/61b8e2ba285851687028d395/LXqTXbw-lh0Yru5UWLMCq.png)
242
+
243
+ ## 🏃 Inference
244
+
245
+ LFM2.5 is supported by many inference frameworks. See the [Inference documentation](https://docs.liquid.ai/lfm/inference/transformers) for the full list.
246
+
247
+ | Name | Description | Docs | Notebook |
248
+ |------|-------------|------|:--------:|
249
+ | [Transformers](https://github.com/huggingface/transformers) | Simple inference with direct access to model internals. | <a href="https://docs.liquid.ai/lfm/inference/transformers">Link</a> | <a href="https://colab.research.google.com/drive/1_q3jQ6LtyiuPzFZv7Vw8xSfPU5FwkKZY?usp=sharing"><img src="https://cdn-uploads.huggingface.co/production/uploads/61b8e2ba285851687028d395/vlOyMEjwHa_b_LXysEu2E.png" width="110" alt="Colab link"></a> |
250
+ | [vLLM](https://github.com/vllm-project/vllm) | High-throughput production deployments with GPU. | <a href="https://docs.liquid.ai/lfm/inference/vllm">Link</a> | <a href="https://colab.research.google.com/drive/1VfyscuHP8A3we_YpnzuabYJzr5ju0Mit?usp=sharing"><img src="https://cdn-uploads.huggingface.co/production/uploads/61b8e2ba285851687028d395/vlOyMEjwHa_b_LXysEu2E.png" width="110" alt="Colab link"></a> |
251
+ | [SGLang](https://github.com/sgl-project/sglang) | High-throughput production deployments with GPU. | <a href="https://docs.liquid.ai/deployment/gpu-inference/sglang">Link</a> | — |
252
+ | [llama.cpp](https://github.com/ggml-org/llama.cpp) | Cross-platform inference with CPU offloading. | <a href="https://docs.liquid.ai/lfm/inference/llama-cpp">Link</a> | <a href="https://colab.research.google.com/drive/1ohLl3w47OQZA4ELo46i5E4Z6oGWBAyo8?usp=sharing"><img src="https://cdn-uploads.huggingface.co/production/uploads/61b8e2ba285851687028d395/vlOyMEjwHa_b_LXysEu2E.png" width="110" alt="Colab link"></a> |
253
+ | [MLX](https://github.com/ml-explore/mlx) | Apple's machine learning framework optimized for Apple Silicon. | <a href="https://docs.liquid.ai/lfm/inference/mlx">Link</a> | — |
254
+ | [LM Studio](https://lmstudio.ai/) | Desktop application for running LLMs locally. | <a href="https://docs.liquid.ai/deployment/on-device/lm-studio">Link</a> | — |
255
+
256
+ > [!TIP]
257
+ > ⚡ **Faster decoding**: attach [LFM2.5-2.6B-DSpark](https://huggingface.co/LiquidAI/LFM2.5-2.6B-DSpark), a 328M speculative-decoding drafter, for ~2.6x faster decoding in SGLang and on Apple silicon via Metal with exactly the same outputs.
258
+ >
259
+ ## How to use
260
+
261
+ LFM2.5-2.6B can be used for direct inference or as a backend for agentic workflows.
262
+
263
+ ### Quick start
264
+
265
+ Get started with Transformers (compatible with `transformers>=5.0.0`):
266
+
267
+ ```python
268
+ from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
269
+
270
+ model_id = "LiquidAI/LFM2.5-2.6B"
271
+ model = AutoModelForCausalLM.from_pretrained(
272
+ model_id,
273
+ device_map="auto",
274
+ dtype="bfloat16",
275
+ # attn_implementation="flash_attention_2" <- uncomment on compatible GPU
276
+ )
277
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
278
+ streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
279
+
280
+ prompt = "What is C. elegans?"
281
+
282
+ input_ids = tokenizer.apply_chat_template(
283
+ [{"role": "user", "content": prompt}],
284
+ add_generation_prompt=True,
285
+ return_tensors="pt",
286
+ tokenize=True,
287
+ )["input_ids"].to(model.device)
288
+
289
+ output = model.generate(
290
+ input_ids,
291
+ do_sample=True,
292
+ temperature=0.1,
293
+ top_k=50,
294
+ repetition_penalty=1.1,
295
+ max_new_tokens=512,
296
+ streamer=streamer,
297
+ )
298
+ ```
299
+
300
+ ### Agent Use
301
+
302
+ LFM2.5-2.6B supports tool calling for agentic workflows.
303
+ Serve it locally with any OpenAI-compatible backend (see [🏃 Inference](#🏃-inference), then configure your agent harness to connect to it.
304
+ For full setup instructions including installation and additional options, see our [Agent Harnesses guide](https://docs.liquid.ai/examples/agent-harnesses).
305
+
306
+ *Note: The port depends on your serving backend — llama.cpp and MLX use `8080`, vLLM uses `8000`, SGLang uses `30000`, and LM Studio uses `1234`. Adjust the URLs below accordingly.*
307
+
308
+ #### Hermes
309
+
310
+ Either use the interactive wizard or set it directly:
311
+
312
+ ```
313
+ hermes config set model.provider custom
314
+ hermes config set model.base_url http://localhost:8080/v1
315
+ hermes config set model.default LFM2.5-2.6B
316
+ hermes config set model.context_length 131072
317
+ hermes config set model.api_mode chat_completions
318
+ hermes config set agent.tool_use_enforcement true
319
+ ```
320
+
321
+ #### OpenClaw
322
+
323
+ Add to your config to `models.providers`:
324
+
325
+ ```
326
+ local: {
327
+ baseUrl: "http://localhost:8080/v1",
328
+ apiKey: "sk-local",
329
+ api: "openai-completions",
330
+ models: [{
331
+ id: "LFM2.5-2.6B",
332
+ name: "LFM2.5-2.6B",
333
+ contextWindow: 131072,
334
+ maxTokens: 8192,
335
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }
336
+ }]
337
+ }
338
+ ```
339
+
340
+ #### Pi
341
+
342
+ Add to your config to `~/.pi/agent/models.json`:
343
+
344
+ ```
345
+ {
346
+ "providers": {
347
+ "local": {
348
+ "baseUrl": "http://localhost:8080/v1",
349
+ "api": "openai-completions",
350
+ "apiKey": "local",
351
+ "models": [{ "id": "LFM2.5-2.6B" }]
352
+ }
353
+ }
354
+ }
355
+ ```
356
+
357
+ ## 🔧 Fine-Tuning
358
+
359
+ We recommend fine-tuning LFM2.5 for your specific use case to achieve the best results.
360
+
361
+ | Name | Description | Docs | Notebook |
362
+ |------|-------------|------|----------|
363
+ | CPT ([Unsloth](https://github.com/unslothai/unsloth)) | Continued Pre-Training using Unsloth for text completion. | <a href="https://docs.liquid.ai/lfm/fine-tuning/unsloth">Link</a> | <a href="https://colab.research.google.com/drive/10fm7eNMezs-DSn36mF7vAsNYlOsx9YZO?usp=sharing"><img src="https://cdn-uploads.huggingface.co/production/uploads/61b8e2ba285851687028d395/vlOyMEjwHa_b_LXysEu2E.png" width="110" alt="Colab link"></a> |
364
+ | CPT ([Unsloth](https://github.com/unslothai/unsloth)) | Continued Pre-Training using Unsloth for translation. | <a href="https://docs.liquid.ai/lfm/fine-tuning/unsloth">Link</a> | <a href="https://colab.research.google.com/drive/1gaP8yTle2_v35Um8Gpu9239fqbU7UgY8?usp=sharing"><img src="https://cdn-uploads.huggingface.co/production/uploads/61b8e2ba285851687028d395/vlOyMEjwHa_b_LXysEu2E.png" width="110" alt="Colab link"></a> |
365
+ | SFT ([Unsloth](https://github.com/unslothai/unsloth)) | Supervised Fine-Tuning with LoRA using Unsloth. | <a href="https://docs.liquid.ai/lfm/fine-tuning/unsloth">Link</a> | <a href="https://colab.research.google.com/drive/1vGRg4ksRj__6OLvXkHhvji_Pamv801Ss?usp=sharing"><img src="https://cdn-uploads.huggingface.co/production/uploads/61b8e2ba285851687028d395/vlOyMEjwHa_b_LXysEu2E.png" width="110" alt="Colab link"></a> |
366
+ | SFT ([TRL](https://github.com/huggingface/trl)) | Supervised Fine-Tuning with LoRA using TRL. | <a href="https://docs.liquid.ai/lfm/fine-tuning/trl">Link</a> | <a href="https://colab.research.google.com/drive/1j5Hk_SyBb2soUsuhU0eIEA9GwLNRnElF?usp=sharing"><img src="https://cdn-uploads.huggingface.co/production/uploads/61b8e2ba285851687028d395/vlOyMEjwHa_b_LXysEu2E.png" width="110" alt="Colab link"></a> |
367
+ | DPO ([TRL](https://github.com/huggingface/trl)) | Direct Preference Optimization with LoRA using TRL. | <a href="https://docs.liquid.ai/lfm/fine-tuning/trl">Link</a> | <a href="https://colab.research.google.com/drive/1MQdsPxFHeZweGsNx4RH7Ia8lG8PiGE1t?usp=sharing"><img src="https://cdn-uploads.huggingface.co/production/uploads/61b8e2ba285851687028d395/vlOyMEjwHa_b_LXysEu2E.png" width="110" alt="Colab link"></a> |
368
+ | GRPO ([TRL](https://github.com/huggingface/trl)) | GRPO with LoRA using TRL. | <a href="https://docs.liquid.ai/lfm/fine-tuning/trl">Link</a> | <a href="https://colab.research.google.com/github/Liquid4All/cookbook/blob/main/finetuning/notebooks/grpo_for_verifiable_tasks.ipynb"><img src="https://cdn-uploads.huggingface.co/production/uploads/61b8e2ba285851687028d395/vlOyMEjwHa_b_LXysEu2E.png" width="110" alt="Colab link"></a> |
369
+
370
+ ## 📊 Performance
371
+
372
+ ### Benchmarks
373
+
374
+ We compared LFM2.5-2.6B with relevant sub-10B models on a diverse suite of benchmarks.
375
+
376
+ | Benchmark | LFM2.5-2.6B (2.6B) | gemma-4-E2B-it (5.1B) | gemma-4-E4B-it (8B) | Qwen3.5-4B (4.7B) | Qwen3.5-9B (9.7B) |
377
+ |---|---:|---:|---:|---:|---:|
378
+ | AA-Omni-Public Index | -29.50 | -74.47 | -49.03 | -54.30 | -50.43 |
379
+ | AA-Omni-Public Acc | 8.13 | 6.37 | 8.33 | 17.63 | 21.30 |
380
+ | AA-Omni-Public Non-hallu | 59.04 | 13.67 | 37.42 | 12.66 | 8.84 |
381
+ | AIME25 | 51.87 | 26.33 | 34.27 | 49.33 | 56.07 |
382
+ | LiveCodeBenchv6 | 59.41 | 54.92 | 63.77 | 60.85 | 69.86 |
383
+ | IFBench | 59.17 | 34.08 | 39.24 | 48.40 | 56.47 |
384
+ | Multi-IF | 80.07 | 69.44 | 77.35 | 55.67 | 62.55 |
385
+ | IFStruct | 85.49 | 64.85 | 76.65 | 36.25 | 78.50 |
386
+ | BFCLv4 | 56.88 | 36.98 | 46.39 | 50.56 | 60.13 |
387
+ | ToolSandbox | 77.83 | 52.40 | 65.00 | 75.55 | 76.44 |
388
+ | τ³-Bench Banking | 5.67 | 3.35 | 4.12 | 5.45 | 5.15 |
389
+ | Claw-Eval average (EN) | 62.85 | 53.14 | 58.02 | 62.28 | 66.53 |
390
+ | PinchBench | 68.22 | 44.24 | 55.09 | 71.26 | 71.45 |
391
+ | BrowseComp+ (OpenClaw) | 26.89 | 8.31 | 15.90 | 24.46 | 27.23 |
392
+
393
+ ### CPU Inference
394
+
395
+ Due to its efficient LFM2 architecture, LFM2.5-2.6B is the fastest model we tested, with decode speeds of 220 tokens/s on an M5 Max and 113 tokens/s on a Ryzen AI Max+ 395. At 30 tokens/s, it allows you to run capable agents even on a phone.
396
+
397
+ ![](https://cdn-uploads.huggingface.co/production/uploads/644249b08443bce4c9890a0f/YwLcMpzsq1b5SW1Gtdt1o.png)
398
+
399
+ ### GPU Inference
400
+
401
+ LFM2.5-2.6B is the fastest model in its size class, reaching almost **15K output tokens per second at high concurrency**, roughly 1.3B tokens per day on a single H100.
402
+
403
+ ![](https://cdn-uploads.huggingface.co/production/uploads/61b8e2ba285851687028d395/6EHzZzduUg1bISqkQuHZ6.png)
404
+
405
+ ## 📬 Contact
406
+
407
+ - Got questions or want to connect? [Join our Discord community](https://discord.com/invite/liquid-ai)
408
+ - If you are interested in custom solutions with edge deployment, please contact [our sales team](https://www.liquid.ai/contact).
409
+
410
+ ## Citation
411
+
412
+ ```bibtex
413
+ @article{liquidAI202626B,
414
+ author = {Liquid AI},
415
+ title = {LFM2.5-2.6B: Agents Everywhere},
416
+ journal = {Liquid AI Blog},
417
+ year = {2026},
418
+ note = {www.liquid.ai/blog/lfm2-5-2-6b},
419
+ }
420
+ ```
421
+
422
+ ```bibtex
423
+ @article{liquidai2025lfm2,
424
+ title = {LFM2 Technical Report},
425
+ author = {Liquid AI},
426
+ journal = {arXiv preprint arXiv:2511.23404},
427
+ year = {2025}
428
+ }
429
+ ```
chat_template.jinja ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{- bos_token -}}
2
+ {%- set preserve_thinking = preserve_thinking | default(false) -%}
3
+
4
+ {%- macro format_arg_value(arg_value) -%}
5
+ {%- if arg_value is string -%}
6
+ {{- "'" + (arg_value | replace("\\", "\\\\") | replace("'", "\\'") | replace("\n", "\\n") | replace("\r", "\\r")) + "'" -}}
7
+ {%- elif arg_value is mapping or arg_value is iterable -%}
8
+ {{- arg_value | tojson -}}
9
+ {%- else -%}
10
+ {{- arg_value | string -}}
11
+ {%- endif -%}
12
+ {%- endmacro -%}
13
+
14
+ {%- macro parse_content(content) -%}
15
+ {%- if content is string -%}
16
+ {{- content -}}
17
+ {%- elif content is mapping -%}
18
+ {{- content | tojson -}}
19
+ {%- elif content is iterable -%}
20
+ {%- set _ns = namespace(result="") -%}
21
+ {%- for item in content -%}
22
+ {%- if item is string -%}
23
+ {%- set _ns.result = _ns.result + item -%}
24
+ {%- elif item is mapping and item.get("type") == "image" -%}
25
+ {%- set _ns.result = _ns.result + "<image>" -%}
26
+ {%- elif item is mapping and item.get("type") == "text" -%}
27
+ {%- set _ns.result = _ns.result + ((item.get("text") or "") | string) -%}
28
+ {%- else -%}
29
+ {%- set _ns.result = _ns.result + (item | tojson) -%}
30
+ {%- endif -%}
31
+ {%- endfor -%}
32
+ {{- _ns.result -}}
33
+ {%- endif -%}
34
+ {%- endmacro -%}
35
+
36
+ {%- macro render_tool_calls(tool_calls) -%}
37
+ {%- set tool_calls_ns = namespace(tool_calls=[]) -%}
38
+ {%- for tool_call in tool_calls -%}
39
+ {%- set func = tool_call["function"] if "function" in tool_call else tool_call -%}
40
+ {%- set func_name = func["name"] -%}
41
+ {%- set func_args = func.get("arguments") -%}
42
+ {%- set args_ns = namespace(arg_strings=[]) -%}
43
+ {%- if func_args is mapping -%}
44
+ {%- for arg_name, arg_value in func_args.items() -%}
45
+ {%- set args_ns.arg_strings = args_ns.arg_strings + [arg_name + "=" + format_arg_value(arg_value)] -%}
46
+ {%- endfor -%}
47
+ {%- elif func_args is string and (func_args | trim) not in ["", "{}", "null"] -%}
48
+ {{- raise_exception("Tool call arguments must be a mapping, got a JSON-encoded string: parse arguments with json.loads() before applying the chat template") -}}
49
+ {%- endif -%}
50
+ {%- set tool_calls_ns.tool_calls = tool_calls_ns.tool_calls + [func_name + "(" + (args_ns.arg_strings | join(", ")) + ")"] -%}
51
+ {%- endfor -%}
52
+ {{- "<|tool_call_start|>[" + (tool_calls_ns.tool_calls | join(", ")) + "]<|tool_call_end|>" -}}
53
+ {%- endmacro -%}
54
+
55
+ {%- set ns = namespace(system_prompt="", last_user_index=-1) -%}
56
+ {%- if messages and messages[0]["role"] == "system" -%}
57
+ {%- if messages[0].get("content") -%}
58
+ {%- set ns.system_prompt = parse_content(messages[0]["content"]) -%}
59
+ {%- endif -%}
60
+ {%- set messages = messages[1:] -%}
61
+ {%- endif -%}
62
+ {%- if tools -%}
63
+ {%- set ns.system_prompt = ns.system_prompt + ("\n" if ns.system_prompt else "") + "List of tools: [" -%}
64
+ {%- for tool in tools -%}
65
+ {%- if tool is not string -%}
66
+ {%- set tool = tool | tojson -%}
67
+ {%- endif -%}
68
+ {%- set ns.system_prompt = ns.system_prompt + tool -%}
69
+ {%- if not loop.last -%}
70
+ {%- set ns.system_prompt = ns.system_prompt + ", " -%}
71
+ {%- endif -%}
72
+ {%- endfor -%}
73
+ {%- set ns.system_prompt = ns.system_prompt + "]" -%}
74
+ {%- endif -%}
75
+ {%- if ns.system_prompt -%}
76
+ {{- "<|im_start|>system\n" + ns.system_prompt + "<|im_end|>\n" -}}
77
+ {%- endif -%}
78
+ {%- for message in messages -%}
79
+ {%- if message["role"] == "user" -%}
80
+ {%- set ns.last_user_index = loop.index0 -%}
81
+ {%- endif -%}
82
+ {%- endfor -%}
83
+ {%- for message in messages -%}
84
+ {{- "<|im_start|>" + message.role + "\n" -}}
85
+ {%- if message.role == "assistant" -%}
86
+ {%- generation -%}
87
+ {%- set keep_thinking = preserve_thinking or loop.index0 > ns.last_user_index -%}
88
+ {%- set thinking = message.thinking or message.reasoning or message.reasoning_content -%}
89
+ {%- set thinking = thinking if thinking is string else "" -%}
90
+ {%- if thinking and keep_thinking -%}
91
+ {{- "<think>" + thinking + "</think>" -}}
92
+ {%- endif -%}
93
+ {%- set _cfm_tag = "CONTINUE_FINAL_MESSAGE_TAG " -%}
94
+ {%- set _has_cfm = false -%}
95
+ {%- set content = "" -%}
96
+ {%- if message.get("content") -%}
97
+ {%- set content = parse_content(message.content) -%}
98
+ {%- endif -%}
99
+ {%- if not keep_thinking and "</think>" in content -%}
100
+ {%- set content = content.split("</think>")[-1] | trim -%}
101
+ {%- endif -%}
102
+ {%- if content.endswith(_cfm_tag) -%}
103
+ {%- set _has_cfm = true -%}
104
+ {%- set _trunc_len = (content | length) - (_cfm_tag | length) -%}
105
+ {%- set content = content[:_trunc_len] -%}
106
+ {%- endif -%}
107
+ {{- content -}}
108
+ {%- if message.tool_calls -%}
109
+ {{- render_tool_calls(message.tool_calls) -}}
110
+ {%- endif -%}
111
+ {%- if _has_cfm -%}
112
+ {{- _cfm_tag -}}
113
+ {%- endif -%}
114
+ {{- "<|im_end|>\n" -}}
115
+ {%- endgeneration -%}
116
+ {%- else %}
117
+ {%- if message.get("content") -%}
118
+ {{- parse_content(message["content"]) -}}
119
+ {%- endif -%}
120
+ {{- "<|im_end|>\n" -}}
121
+ {%- endif %}
122
+ {%- endfor -%}
123
+ {%- if add_generation_prompt -%}
124
+ {{- "<|im_start|>assistant\n<think>" -}}
125
+ {%- endif -%}
config.json ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Lfm2ForCausalLM"
4
+ ],
5
+ "block_auto_adjust_ff_dim": false,
6
+ "block_dim": 2048,
7
+ "block_ffn_dim_multiplier": 1.0,
8
+ "block_mlp_init_scale": 1.0,
9
+ "block_multiple_of": 256,
10
+ "block_norm_eps": 1e-05,
11
+ "block_out_init_scale": 1.0,
12
+ "block_use_swiglu": true,
13
+ "block_use_xavier_init": true,
14
+ "bos_token_id": 124894,
15
+ "conv_L_cache": 3,
16
+ "conv_bias": false,
17
+ "conv_dim": 2048,
18
+ "conv_use_xavier_init": true,
19
+ "dtype": "bfloat16",
20
+ "eos_token_id": 124900,
21
+ "full_attn_idxs": null,
22
+ "hidden_size": 2048,
23
+ "initializer_range": 0.02,
24
+ "intermediate_size": 10752,
25
+ "layer_types": [
26
+ "conv",
27
+ "conv",
28
+ "full_attention",
29
+ "conv",
30
+ "conv",
31
+ "full_attention",
32
+ "conv",
33
+ "conv",
34
+ "conv",
35
+ "full_attention",
36
+ "conv",
37
+ "conv",
38
+ "conv",
39
+ "full_attention",
40
+ "conv",
41
+ "conv",
42
+ "conv",
43
+ "full_attention",
44
+ "conv",
45
+ "conv",
46
+ "conv",
47
+ "full_attention",
48
+ "conv",
49
+ "conv",
50
+ "full_attention",
51
+ "conv",
52
+ "conv",
53
+ "full_attention",
54
+ "conv",
55
+ "conv"
56
+ ],
57
+ "max_position_embeddings": 131072,
58
+ "model_type": "lfm2",
59
+ "norm_eps": 1e-05,
60
+ "num_attention_heads": 32,
61
+ "num_heads": 32,
62
+ "num_hidden_layers": 30,
63
+ "num_key_value_heads": 8,
64
+ "pad_token_id": 124893,
65
+ "quantization_config": {
66
+ "config_groups": {
67
+ "group_0": {
68
+ "format": "float-quantized",
69
+ "input_activations": {
70
+ "actorder": null,
71
+ "block_structure": null,
72
+ "dynamic": false,
73
+ "group_size": null,
74
+ "num_bits": 8,
75
+ "observer": "static_minmax",
76
+ "observer_kwargs": {},
77
+ "strategy": "tensor",
78
+ "symmetric": true,
79
+ "type": "float"
80
+ },
81
+ "output_activations": null,
82
+ "targets": [
83
+ "Linear"
84
+ ],
85
+ "weights": {
86
+ "actorder": null,
87
+ "block_structure": null,
88
+ "dynamic": false,
89
+ "group_size": null,
90
+ "num_bits": 8,
91
+ "observer": "memoryless_minmax",
92
+ "observer_kwargs": {},
93
+ "strategy": "tensor",
94
+ "symmetric": true,
95
+ "type": "float"
96
+ }
97
+ }
98
+ },
99
+ "format": "float-quantized",
100
+ "global_compression_ratio": null,
101
+ "ignore": [
102
+ "lm_head"
103
+ ],
104
+ "kv_cache_scheme": null,
105
+ "quant_method": "compressed-tensors",
106
+ "quantization_status": "compressed",
107
+ "sparsity_config": {},
108
+ "transform_config": {},
109
+ "version": "0.18.0"
110
+ },
111
+ "rope_parameters": {
112
+ "rope_theta": 10000000.0,
113
+ "rope_type": "default"
114
+ },
115
+ "tie_word_embeddings": true,
116
+ "transformers_version": "5.14.1",
117
+ "use_cache": true,
118
+ "use_pos_enc": true,
119
+ "vocab_size": 128000
120
+ }
generation_config.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 124894,
4
+ "eos_token_id": [
5
+ 124900
6
+ ],
7
+ "output_attentions": false,
8
+ "output_hidden_states": false,
9
+ "pad_token_id": 124893,
10
+ "temperature": 0.1,
11
+ "do_sample": true,
12
+ "top_k": 50,
13
+ "repetition_penalty": 1.1,
14
+ "transformers_version": "5.2.0",
15
+ "use_cache": true
16
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e7ea7c277af3e9d90c3e08250430a2e8ece9e5400fa192e2b18159245fa39ae5
3
+ size 2959672048
quantization_manifest.json ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "base_model": "/mnt/data/sftp/data/quangnd58/model/LFM2.5-2.6B",
3
+ "strategy": "fp8",
4
+ "scheme": "FP8",
5
+ "smoothquant": {
6
+ "enabled": true,
7
+ "smoothing_strength": 0.8,
8
+ "num_mappings": 60
9
+ },
10
+ "calibration": {
11
+ "dataset_id": "abisee/cnn_dailymail",
12
+ "dataset_config": "3.0.0",
13
+ "split": "train",
14
+ "num_samples": 512,
15
+ "max_seq_len": 2048,
16
+ "seed": 42
17
+ },
18
+ "sequential_targets": [
19
+ "Lfm2DecoderLayer"
20
+ ],
21
+ "num_ignored_modules": 1,
22
+ "ignore_patterns": [
23
+ "lm_head"
24
+ ]
25
+ }
recipe.yaml ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ default_stage:
2
+ default_modifiers:
3
+ SmoothQuantModifier:
4
+ requires_calibration_data: true
5
+ smoothing_strength: 0.8
6
+ mappings:
7
+ - - [model.layers.0.conv.in_proj]
8
+ - model.layers.0.operator_norm
9
+ - - [model.layers.0.feed_forward.w1, model.layers.0.feed_forward.w3]
10
+ - model.layers.0.ffn_norm
11
+ - - [model.layers.1.conv.in_proj]
12
+ - model.layers.1.operator_norm
13
+ - - [model.layers.1.feed_forward.w1, model.layers.1.feed_forward.w3]
14
+ - model.layers.1.ffn_norm
15
+ - - [model.layers.2.self_attn.q_proj, model.layers.2.self_attn.k_proj, model.layers.2.self_attn.v_proj]
16
+ - model.layers.2.operator_norm
17
+ - - [model.layers.2.feed_forward.w1, model.layers.2.feed_forward.w3]
18
+ - model.layers.2.ffn_norm
19
+ - - [model.layers.3.conv.in_proj]
20
+ - model.layers.3.operator_norm
21
+ - - [model.layers.3.feed_forward.w1, model.layers.3.feed_forward.w3]
22
+ - model.layers.3.ffn_norm
23
+ - - [model.layers.4.conv.in_proj]
24
+ - model.layers.4.operator_norm
25
+ - - [model.layers.4.feed_forward.w1, model.layers.4.feed_forward.w3]
26
+ - model.layers.4.ffn_norm
27
+ - - [model.layers.5.self_attn.q_proj, model.layers.5.self_attn.k_proj, model.layers.5.self_attn.v_proj]
28
+ - model.layers.5.operator_norm
29
+ - - [model.layers.5.feed_forward.w1, model.layers.5.feed_forward.w3]
30
+ - model.layers.5.ffn_norm
31
+ - - [model.layers.6.conv.in_proj]
32
+ - model.layers.6.operator_norm
33
+ - - [model.layers.6.feed_forward.w1, model.layers.6.feed_forward.w3]
34
+ - model.layers.6.ffn_norm
35
+ - - [model.layers.7.conv.in_proj]
36
+ - model.layers.7.operator_norm
37
+ - - [model.layers.7.feed_forward.w1, model.layers.7.feed_forward.w3]
38
+ - model.layers.7.ffn_norm
39
+ - - [model.layers.8.conv.in_proj]
40
+ - model.layers.8.operator_norm
41
+ - - [model.layers.8.feed_forward.w1, model.layers.8.feed_forward.w3]
42
+ - model.layers.8.ffn_norm
43
+ - - [model.layers.9.self_attn.q_proj, model.layers.9.self_attn.k_proj, model.layers.9.self_attn.v_proj]
44
+ - model.layers.9.operator_norm
45
+ - - [model.layers.9.feed_forward.w1, model.layers.9.feed_forward.w3]
46
+ - model.layers.9.ffn_norm
47
+ - - [model.layers.10.conv.in_proj]
48
+ - model.layers.10.operator_norm
49
+ - - [model.layers.10.feed_forward.w1, model.layers.10.feed_forward.w3]
50
+ - model.layers.10.ffn_norm
51
+ - - [model.layers.11.conv.in_proj]
52
+ - model.layers.11.operator_norm
53
+ - - [model.layers.11.feed_forward.w1, model.layers.11.feed_forward.w3]
54
+ - model.layers.11.ffn_norm
55
+ - - [model.layers.12.conv.in_proj]
56
+ - model.layers.12.operator_norm
57
+ - - [model.layers.12.feed_forward.w1, model.layers.12.feed_forward.w3]
58
+ - model.layers.12.ffn_norm
59
+ - - [model.layers.13.self_attn.q_proj, model.layers.13.self_attn.k_proj, model.layers.13.self_attn.v_proj]
60
+ - model.layers.13.operator_norm
61
+ - - [model.layers.13.feed_forward.w1, model.layers.13.feed_forward.w3]
62
+ - model.layers.13.ffn_norm
63
+ - - [model.layers.14.conv.in_proj]
64
+ - model.layers.14.operator_norm
65
+ - - [model.layers.14.feed_forward.w1, model.layers.14.feed_forward.w3]
66
+ - model.layers.14.ffn_norm
67
+ - - [model.layers.15.conv.in_proj]
68
+ - model.layers.15.operator_norm
69
+ - - [model.layers.15.feed_forward.w1, model.layers.15.feed_forward.w3]
70
+ - model.layers.15.ffn_norm
71
+ - - [model.layers.16.conv.in_proj]
72
+ - model.layers.16.operator_norm
73
+ - - [model.layers.16.feed_forward.w1, model.layers.16.feed_forward.w3]
74
+ - model.layers.16.ffn_norm
75
+ - - [model.layers.17.self_attn.q_proj, model.layers.17.self_attn.k_proj, model.layers.17.self_attn.v_proj]
76
+ - model.layers.17.operator_norm
77
+ - - [model.layers.17.feed_forward.w1, model.layers.17.feed_forward.w3]
78
+ - model.layers.17.ffn_norm
79
+ - - [model.layers.18.conv.in_proj]
80
+ - model.layers.18.operator_norm
81
+ - - [model.layers.18.feed_forward.w1, model.layers.18.feed_forward.w3]
82
+ - model.layers.18.ffn_norm
83
+ - - [model.layers.19.conv.in_proj]
84
+ - model.layers.19.operator_norm
85
+ - - [model.layers.19.feed_forward.w1, model.layers.19.feed_forward.w3]
86
+ - model.layers.19.ffn_norm
87
+ - - [model.layers.20.conv.in_proj]
88
+ - model.layers.20.operator_norm
89
+ - - [model.layers.20.feed_forward.w1, model.layers.20.feed_forward.w3]
90
+ - model.layers.20.ffn_norm
91
+ - - [model.layers.21.self_attn.q_proj, model.layers.21.self_attn.k_proj, model.layers.21.self_attn.v_proj]
92
+ - model.layers.21.operator_norm
93
+ - - [model.layers.21.feed_forward.w1, model.layers.21.feed_forward.w3]
94
+ - model.layers.21.ffn_norm
95
+ - - [model.layers.22.conv.in_proj]
96
+ - model.layers.22.operator_norm
97
+ - - [model.layers.22.feed_forward.w1, model.layers.22.feed_forward.w3]
98
+ - model.layers.22.ffn_norm
99
+ - - [model.layers.23.conv.in_proj]
100
+ - model.layers.23.operator_norm
101
+ - - [model.layers.23.feed_forward.w1, model.layers.23.feed_forward.w3]
102
+ - model.layers.23.ffn_norm
103
+ - - [model.layers.24.self_attn.q_proj, model.layers.24.self_attn.k_proj, model.layers.24.self_attn.v_proj]
104
+ - model.layers.24.operator_norm
105
+ - - [model.layers.24.feed_forward.w1, model.layers.24.feed_forward.w3]
106
+ - model.layers.24.ffn_norm
107
+ - - [model.layers.25.conv.in_proj]
108
+ - model.layers.25.operator_norm
109
+ - - [model.layers.25.feed_forward.w1, model.layers.25.feed_forward.w3]
110
+ - model.layers.25.ffn_norm
111
+ - - [model.layers.26.conv.in_proj]
112
+ - model.layers.26.operator_norm
113
+ - - [model.layers.26.feed_forward.w1, model.layers.26.feed_forward.w3]
114
+ - model.layers.26.ffn_norm
115
+ - - [model.layers.27.self_attn.q_proj, model.layers.27.self_attn.k_proj, model.layers.27.self_attn.v_proj]
116
+ - model.layers.27.operator_norm
117
+ - - [model.layers.27.feed_forward.w1, model.layers.27.feed_forward.w3]
118
+ - model.layers.27.ffn_norm
119
+ - - [model.layers.28.conv.in_proj]
120
+ - model.layers.28.operator_norm
121
+ - - [model.layers.28.feed_forward.w1, model.layers.28.feed_forward.w3]
122
+ - model.layers.28.ffn_norm
123
+ - - [model.layers.29.conv.in_proj]
124
+ - model.layers.29.operator_norm
125
+ - - [model.layers.29.feed_forward.w1, model.layers.29.feed_forward.w3]
126
+ - model.layers.29.ffn_norm
127
+ ignore: []
128
+ algorithm: smoothquant
129
+ QuantizationModifier:
130
+ targets: [Linear]
131
+ ignore: [lm_head]
132
+ scheme: FP8
133
+ bypass_divisibility_checks: false
134
+ requires_calibration_data: true
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:695be7802a0e4b8a81048f0ff5ebb7fc811a0ba5a6be63dbb24deb5a81096f41
3
+ size 17905598
tokenizer_config.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "backend": "tokenizers",
3
+ "bos_token": "<|startoftext|>",
4
+ "clean_up_tokenization_spaces": false,
5
+ "eos_token": "<|im_end|>",
6
+ "is_local": true,
7
+ "legacy": false,
8
+ "local_files_only": false,
9
+ "model_max_length": 1000000000000000019884624838656,
10
+ "pad_token": "<|pad|>",
11
+ "tokenizer_class": "TokenizersBackend",
12
+ "use_default_system_prompt": false
13
+ }