111 lines
4.4 KiB
Markdown
111 lines
4.4 KiB
Markdown
|
|
---
|
||
|
|
base_model:
|
||
|
|
- LiquidAI/LFM2.5-350M
|
||
|
|
library_name: transformers
|
||
|
|
license: other
|
||
|
|
license_name: lfm1.0
|
||
|
|
license_link: LICENSE
|
||
|
|
pipeline_tag: text-generation
|
||
|
|
language:
|
||
|
|
- en
|
||
|
|
tags:
|
||
|
|
- synth
|
||
|
|
- synthlabs
|
||
|
|
- lfm
|
||
|
|
- lfm2
|
||
|
|
- reasoning
|
||
|
|
- text-generation
|
||
|
|
datasets:
|
||
|
|
- PleIAs/SYNTH
|
||
|
|
- mkurman/medical-reasoning-synthlabs-I
|
||
|
|
- mkurman/gsm8k-SynthLabs-reasoning
|
||
|
|
---
|
||
|
|
|
||
|
|
# LFM2.5-350M-SYNTH
|
||
|
|
|
||
|
|
A 350M-parameter **reasoning** model fine-tuned from [LiquidAI/LFM2.5-350M](https://huggingface.co/LiquidAI/LFM2.5-350M) on
|
||
|
|
synthetic reasoning data. It produces explicit chain-of-thought (`<think> … </think>`) before answering, and is small enough
|
||
|
|
to run on CPU or modest GPUs while retaining the base model's 128k context window.
|
||
|
|
|
||
|
|
## Highlights
|
||
|
|
|
||
|
|
- **Reasoning-first**: trained on SynthLabs-style traces for math, medical, and general reasoning.
|
||
|
|
- **Compact & fast**: 350M params on the hybrid **LFM2** architecture (convolution + sparse full-attention blocks), bf16.
|
||
|
|
- **Long context**: inherits the base model's 128k `max_position_embeddings`.
|
||
|
|
- **Chat + tools**: ChatML format with native tool-calling special tokens.
|
||
|
|
|
||
|
|
## Model details
|
||
|
|
|
||
|
|
```
|
||
|
|
│ │ │ │ │
|
||
|
|
────────────────┼──────────────────────────────────────────────────┼──────────┼─────────┼────────┼────
|
||
|
|
Base model │ LiquidAI/LFM2.5-350M │ │ │ │
|
||
|
|
Architecture │ `Lfm2ForCausalLM` (hybrid conv / full-attention) │ │ │ │
|
||
|
|
Parameters │ ~350M │ │ │ │
|
||
|
|
Hidden size │ 1024 │ │ │ │
|
||
|
|
Layers │ 16 (12 conv + 4 full-attention) │ │ │ │
|
||
|
|
Attention heads │ 16 (8 KV heads, GQA) │ │ │ │
|
||
|
|
Vocab size │ 65,536 │ │ │ │
|
||
|
|
Context length │ 128,000 │ │ │ │
|
||
|
|
Precision │ bfloat16 │ │ │ │
|
||
|
|
Chat format │ ChatML (`< │ im_start │ >` / `< │ im_end │ >`)
|
||
|
|
```
|
||
|
|
## Training
|
||
|
|
|
||
|
|
Fully fine-tuned for 4,000 steps on a single A100:
|
||
|
|
|
||
|
|
- Sequence length: 2,048
|
||
|
|
- Effective batch size: 64
|
||
|
|
- Optimizer: AdamW, LR 5e-5, warmup ratio 0.03
|
||
|
|
- Precision: bf16
|
||
|
|
|
||
|
|
Datasets
|
||
|
|
|
||
|
|
- PleIAs/SYNTH (https://huggingface.co/datasets/PleIAs/SYNTH)
|
||
|
|
- mkurman/medical-reasoning-synthlabs-I (https://huggingface.co/datasets/mkurman/medical-reasoning-synthlabs-I)
|
||
|
|
- mkurman/gsm8k-SynthLabs-reasoning (https://huggingface.co/datasets/mkurman/gsm8k-SynthLabs-reasoning)
|
||
|
|
|
||
|
|
## Usage
|
||
|
|
|
||
|
|
```python
|
||
|
|
from transformers import AutoModelForCausalLM, AutoTokenizer
|
||
|
|
import torch
|
||
|
|
|
||
|
|
model_id = "mkurman/LiquidAI-LFM2.5-350M-SYNTH"
|
||
|
|
tok = AutoTokenizer.from_pretrained(model_id)
|
||
|
|
model = AutoModelForCausalLM.from_pretrained(model_id, dtype=torch.bfloat16, device_map="auto")
|
||
|
|
|
||
|
|
messages = [{"role": "user", "content": "Natalia sold 48 clips in April and half as many in May. How many in total?"}]
|
||
|
|
inputs = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
|
||
|
|
|
||
|
|
out = model.generate(inputs, max_new_tokens=512, do_sample=True, temperature=0.6, top_p=0.95)
|
||
|
|
print(tok.decode(out[0][inputs.shape[-1]:], skip_special_tokens=True))
|
||
|
|
```
|
||
|
|
|
||
|
|
The model emits its reasoning inside <think> … </think> followed by the final answer.
|
||
|
|
|
||
|
|
## Evaluation
|
||
|
|
|
||
|
|
TODO
|
||
|
|
|
||
|
|
## Intended use & limitations
|
||
|
|
|
||
|
|
Research and experimentation with small reasoning models. As a 350M model trained largely on synthetic data, it can
|
||
|
|
hallucinate and make reasoning errors. Not intended for medical, legal, or other high-stakes decisions - outputs must be
|
||
|
|
independently verified.
|
||
|
|
|
||
|
|
## License
|
||
|
|
|
||
|
|
Released under the LFM Open License (lfm1.0); see LICENSE (LICENSE).
|
||
|
|
|
||
|
|
## Citation
|
||
|
|
|
||
|
|
```bibtex
|
||
|
|
@misc{kurman2025lfm25synth,
|
||
|
|
title = {LFM2.5-350M-SYNTH},
|
||
|
|
author = {Kurman, Mariusz},
|
||
|
|
year = {2026},
|
||
|
|
url = {https://huggingface.co/mkurman/LiquidAI-LFM2.5-350M-SYNTH}
|
||
|
|
}
|
||
|
|
```
|