Skip to main content
← Back to Liquid Nanos LFM2-350M-Math is a tiny reasoning model optimized for mathematical problem solving. It provides step-by-step solutions while maintaining a small footprint for edge deployment.

Specifications

PropertyValue
Parameters350M
Context Length32K tokens
TaskMathematical Reasoning

Problem Solving

Step-by-step math

Edge Deployment

Tiny model footprint

Education

Tutoring and explanations

Quick Start

Install:
pip install transformers torch
Run:
from transformers import AutoTokenizer, AutoModelForCausalLM

model_id = "LiquidAI/LFM2-350M-Math"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")

messages = [
    {"role": "user", "content": "If a train travels at 60 mph for 2.5 hours, how far does it travel?"}
]

inputs = tokenizer.apply_chat_template(messages, return_tensors="pt").to(model.device)
outputs = model.generate(inputs, max_new_tokens=256)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)