Views
No views yet
| Feature | Details |
|---|---|
| Base Model | LiquidAI/LFM2.5-230M-Base |
| Fine-tuned Model | LiquidAI/LFM2.5-230M |
| Precision | fp16 (16-bit floating point) |
| Framework | Core ML (Apple's machine learning framework) |
| Architecture | Lfm2ForCausalLM (Hybrid: 8× Double-Gated LIV Convolution + 6× Grouped-Query Attention) |
| Parameters | 230M |
| Context Length | 128,000 tokens |
| Vocabulary | 65,536 tokens |
| License | Other (Check LiquidAI for details) |
| Download Size | ~1.06 GB (.mlpackage + .safetensors) |
| Metric | Value | Notes |
|---|---|---|
| Parameters | 230M | Compact yet powerful. |
| Layers | 14 | 8× Convolution (LIV) + 6× Grouped-Query Attention (GQA). |
| Hidden Size | 1,024 | |
| Intermediate Size | 2,560 | |
| Attention Heads | 16 (8 KV heads) | Grouped-Query Attention for efficiency. |
| Pre-training Tokens | 19T | Including 32K context extension phase. |
| Post-Training | SFT + DPO + Multi-Domain RL | Distilled from LFM2.5-350M for competitive performance. |
| Speed (Edge) | 213 tok/s (S25 Ultra) | 42 tok/s (Raspberry Pi 5). |
💡 Why LFM2.5?
- Faster than SSM hybrids & Gated Delta Networks of similar size.
- Runs everywhere: Cloud GPUs → CPUs → Mobile devices.
- Day-one ecosystem support: llama.cpp, MLX, vLLM, SGLang, ONNX, Core ML.
1git lfs install
2git clone https://huggingface.co/code-and-canvas/lfm2.5-230m-coreML-fp16
3cd lfm2.5-230m-coreML-fp16model.mlpackage into your Xcode project.1import CoreML
2
3// Load the model
4guard let modelURL = Bundle.main.url(forResource: "model", withExtension: "mlpackage") else {
5 fatalError("Model file not found")
6}
7
8do {
9 let model = try MLModel(contentsOf: modelURL)
10 // Use the model for inference
11 let input = try MLDictionaryFeatureProvider(dictionary: ["input": "Your prompt here"])
12 let prediction = try model.prediction(from: input)
13 // Handle output
14} catch {
15 print("Error loading model: \(error)")
16}coremltools (Python)1import coremltools as ct
2
3# Load the model
4model = ct.models.MLModel("model.mlpackage")
5
6# Run inference
7input_data = {"input": "What is the capital of France?"}
8prediction = model.predict(input_data)
9print(prediction)hf_model/).pip install transformers torch1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3model_id = "code-and-canvas/lfm2.5-230m-coreML-fp16"
4tokenizer = AutoTokenizer.from_pretrained(model_id)
5model = AutoModelForCausalLM.from_pretrained(
6 model_id,
7 device_map="auto",
8 torch_dtype="auto"
9)
10
11# Generate text
12inputs = tokenizer("Write a haiku about coding:", return_tensors="pt").to(model.device)
13outputs = model.generate(**inputs, max_new_tokens=50)
14print(tokenizer.decode(outputs[0], skip_special_tokens=True))1from transformers import TextStreamer
2
3streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
4outputs = model.generate(**inputs, streamer=streamer, max_new_tokens=100)1# Example (requires GGUF conversion first)
2llama-cli -m lfm2.5-230m-fp16.gguf -p "Explain quantum computing simply."| Setting | Value |
|---|---|
| Architecture | Lfm2ForCausalLM |
| Layers | 14 (8× Conv + 6× GQA) |
| Hidden Size | 1,024 |
| Intermediate Size | 2,560 |
| Attention Heads | 16 |
| Key-Value Heads | 8 |
| Vocabulary Size | 65,536 |
| Max Position Embeddings | 128,000 |
| ROPE Theta | 1,000,000 |
| Tie Word Embeddings | True |
| Use Cache | True |
1{
2 "bos_token_id": 1,
3 "eos_token_id": 7,
4 "pad_token_id": 0,
5 "do_sample": true,
6 "temperature": 0.1,
7 "top_k": 50,
8 "repetition_penalty": 1.05,
9 "use_cache": true
10}| Token Type | ID |
|---|---|
| BOS | 1 |
| EOS | 7 |
| PAD | 0 |
| File | Description |
|---|---|
model.mlpackage/ | Core ML model (for iOS/macOS integration). |
hf_model/config.json | Hugging Face model configuration. |
hf_model/generation_config.json | Default generation parameters. |
hf_model/model.safetensors | Model weights in safetensors format (fp16). |
hf_model/tokenizer.json | Tokenizer configuration. |
hf_model/tokenizer_config.json | Tokenizer metadata. |
model_config.json | Core ML model configuration. |
| Aspect | LFM2.5-230M (fp16) |
|---|---|
| Size | ~1.06 GB |
| Speed | Very Fast (213 tok/s on high-end mobile) |
| Accuracy | Competitive with larger models (thanks to distillation) |
| Context | 128K tokens (long conversations, documents) |
| Multimodal | ❌ Text-only |
| Fine-Tunable | ✅ Yes (Hugging Face format included) |
💡 Why choose this over larger models?
- Speed: Optimized for real-time on-device inference.
- Size: Fits on mobile devices with limited storage.
- Efficiency: Lower power consumption and memory usage.
LiquidAI/LFM2.5-230M-Base.mlpackage (modern Core ML bundle format).coremltools and Hugging Face ecosystem.What are the key differences between Python and JavaScript?Write a Python function to reverse a linked list in-place.Write a short story about a robot discovering emotions.Act as a personal assistant. My calendar is empty tomorrow. Suggest 3 productive things I could do.1Here's a 500-line Python script. Can you:
21. Summarize what it does.
32. Identify potential bugs.
43. Suggest improvements.
5[Insert long script here...]