Views
No views yet
| Property | Value |
|---|---|
| Parameters | 8.3B total / 1.5B active |
| Layers | 24 (alternating conv-L + full attention) |
| Experts | 32, top-4 per token |
| MoE intermediate | 1792 per expert |
| Hidden size | 2048 |
| Attention heads | 32 (8 KV heads) |
| Context length | 128K tokens |
| Position encoding | RoPE (θ = 5,000,000) |
| Vocabulary | 128K tokens |
| Tie embeddings | True |
q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj, embed_tokens, norm, router): loaded natively as Linear4bit / Params4bit by from_pretrainedexperts.gate_up_proj, experts.down_proj): stored as raw uint8 Parameter with a companion expert_quant_state.pt file containing the per-weight QuantState needed for dequantizationQuantState restoration after loading. See Usage below.from_pretrained.pip install unsloth bitsandbytes transformers safetensors1from unsloth import FastLanguageModel
2from bitsandbytes.nn import Params4bit as BnbParams4bit
3from safetensors import safe_open
4from pathlib import Path
5import torch
6
7cache_path = "models/lfm2.5-8b-4bit-hf"
8
9model, tokenizer = FastLanguageModel.from_pretrained(
10 model_name=cache_path,
11 max_seq_length=2048,
12 load_in_4bit=True,
13 device_map=0,
14)
15
16# Restore expert quant states
17qs_path = Path(cache_path) / "expert_quant_state.pt"
18st_path = Path(cache_path) / "model.safetensors"
19quant_states = torch.load(str(qs_path), weights_only=False)
20device = next(model.parameters()).device
21
22# Move quant state tensors to GPU once
23for name, qs in quant_states.items():
24 qs.absmax = qs.absmax.to(device, non_blocking=True)
25 qs.code = qs.code.to(device, non_blocking=True)
26 if qs.nested:
27 if qs.offset is not None:
28 qs.offset = qs.offset.to(device, non_blocking=True)
29 if hasattr(qs.state2, "absmax") and qs.state2.absmax is not None:
30 qs.state2.absmax = qs.state2.absmax.to(device, non_blocking=True)
31 if hasattr(qs.state2, "code") and qs.state2.code is not None:
32 qs.state2.code = qs.state2.code.to(device, non_blocking=True)
33
34with safe_open(str(st_path), framework="pt", device="cpu") as f:
35 for name, param in model.named_parameters():
36 if name not in quant_states or "experts" not in name:
37 continue
38 original_data = f.get_tensor(name)
39 new_param = BnbParams4bit(
40 data=param.data,
41 requires_grad=False,
42 quant_state=quant_states[name],
43 blocksize=64,
44 compress_statistics=True,
45 quant_type="nf4",
46 bnb_quantized=True,
47 )
48 new_param.data.copy_(original_data.to(new_param.device))
49 parts = name.split(".")
50 parent = model
51 for p in parts[:-1]:
52 parent = getattr(parent, p)
53 setattr(parent, parts[-1], new_param)
54
55model.config.use_cache = True
56model.eval()
57torch.cuda.empty_cache()1@torch.inference_mode()
2def generate(prompt: str, max_new_tokens: int = 128, temperature: float = 0.7):
3 messages = [{"role": "user", "content": prompt}]
4 inputs = tokenizer.apply_chat_template(
5 messages, tokenize=True, add_generation_prompt=True, return_tensors="pt"
6 ).to(model.device)
7 attention_mask = torch.ones_like(inputs)
8 outputs = model.generate(
9 inputs,
10 attention_mask=attention_mask,
11 max_new_tokens=max_new_tokens,
12 max_length=inputs.shape[1] + max_new_tokens,
13 temperature=temperature,
14 do_sample=temperature > 0,
15 pad_token_id=tokenizer.eos_token_id,
16 )
17 return tokenizer.decode(outputs[0][inputs.shape[1]:], skip_special_tokens=True).strip()
18
19print(generate("What is 2+2?"))| Benchmark | Score |
|---|---|
| IFEval | 91.84 |
| IFBench | 56.47 |
| Multi-IF | 79.93 |
| MATH-500 | 88.76 |
| AIME 2025 | 42.53 |
| BFCL v3 | 64.36 |
| BFCL v4 | 48.50 |
| Tau² Telecom | 88.07 |
| Tau² Retail | 39.82 |
| AA-Omniscience Index | -24.70 |
| AA-Omniscience Accuracy | 8.67 |
| AA-Omniscience Non-Hallucination | 63.47 |
unsloth_zoo's MoE utilities. Loading without Unsloth will produce incorrect outputs for MoE layers.QuantState restoration (see above). A future bitsandbytes release with native Experts4bit support will eliminate this step.expert_quant_state.pt file (125 MB) is required. Without it, expert weights are un-dequantizable raw uint8 tensors.1@article{liquidAI20268BA1B,
2 author = {Liquid AI},
3 title = {LFM2.5-8B-A1B: Personal Assistant On Your Laptop},
4 journal = {Liquid AI Blog},
5 year = {2026},
6 note = {www.liquid.ai/blog/lfm2-5-8b-a1b},
7}1@misc{liquidAI2025LFM2,
2 title = {LFM2 Technical Report},
3 author = {Liquid AI},
4 year = {2025},
5 eprint = {2511.23404},
6 archivePrefix = {arXiv},
7}