Downloads · 30 days
58
13% of all-time downloads
Nichonauta/LFM2.5-350M-ToMoE
LFM2.5-350M-ToMoE is a text generation model from Nichonauta. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as other.
A Mixture-of-Experts (MoE) conversion of LiquidAI/LFM2.5-350M, obtained with the ToMoE method (Dynamic Structural Pruning + Hypernetwork).
Downloads · 30 days
58
13% of all-time downloads
All-time downloads
435
Public
Parameters
322M
1.3 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors1.3 GB · 100%
How the weights are stored.
F32321M · 100%
From the Hugging Face model README
A Mixture-of-Experts (MoE) conversion of LiquidAI/LFM2.5-350M, obtained with the ToMoE method (Dynamic Structural Pruning + Hypernetwork).
The dense 350M instruct model is converted into a channel-MoE where:
| Metric | Dense base | ToMoE MoE |
|---|---|---|
| Total params | 354.5M | 321.4M stored |
| Active params per token | 354.5M | ~205M |
| PPL wikitext-2 (raw, 1810 tok) | 919.9 | 994.4 |
| PPL chat-formatted (prompt + answer) | 21.7 | 314.2 |
| Embeddings (always active) | 67.1M | 67.1M |
Note: LFM2.5-350M is an instruction-tuned model. Its raw-text perplexity is dominated by a strong special-token prior, so the chat-formatted PPL is the more meaningful fidelity metric (14x degradation vs 40x for the 230M conversion).
The pruned budget is p = 0.05 with the ToMoE regularization (lam 64→128, Gumbel base annealed 1.0→−0.25, 8 experts). The attention QK is excluded from the budget (kept full) because the small head-dim (64) collapses under aggressive QK pruning. The hypernetwork was trained with chat-formatted wikitext-103 turns (user/assistant split of the articles) so the KD signal follows the instruct distribution.
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained(
"Nichonauta/LFM2.5-350M-ToMoE",
trust_remote_code=True,
torch_dtype=torch.bfloat16,
device_map="cuda:0",
attn_implementation="eager",
)
tokenizer = AutoTokenizer.from_pretrained("Nichonauta/LFM2.5-350M-ToMoE")
messages = [{"role": "user", "content": "What is the capital of France?"}]
prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=True, return_tensors="pt")
out = model.generate(**prompt, max_new_tokens=64)
print(tokenizer.decode(out[0], skip_special_tokens=True))
Note: this model requires
trust_remote_code=True— the custommodeling_lfm2_moe_final.pydefines theLfm2MoEForCausalLMclass.
lfm1.0)This model is a derivative of LiquidAI/LFM2.5-350M and is released under the LFM Open License v1.0 (see LICENSE).
model.safetensors — the pruned MoE weights (fp32)modeling_lfm2_moe_final.py — the custom model definition (trust_remote_code)config.json — model configuration (with auto_map)tokenizer.json, tokenizer_config.json, chat_template.jinja, generation_config.jsonQuantized GGUF files (BF16, Q8_0, Q4_K_M) are available in the companion repository: Nichonauta/LFM2.5-350M-ToMoE-GGUF.