Instructions to use OpenMed/LFM2-1.2B-Longevity-8bit-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use OpenMed/LFM2-1.2B-Longevity-8bit-mlx with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("OpenMed/LFM2-1.2B-Longevity-8bit-mlx") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use OpenMed/LFM2-1.2B-Longevity-8bit-mlx with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "OpenMed/LFM2-1.2B-Longevity-8bit-mlx"
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "OpenMed/LFM2-1.2B-Longevity-8bit-mlx" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use OpenMed/LFM2-1.2B-Longevity-8bit-mlx with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "OpenMed/LFM2-1.2B-Longevity-8bit-mlx"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "OpenMed/LFM2-1.2B-Longevity-8bit-mlx" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenMed/LFM2-1.2B-Longevity-8bit-mlx", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use OpenMed/LFM2-1.2B-Longevity-8bit-mlx with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "OpenMed/LFM2-1.2B-Longevity-8bit-mlx"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default OpenMed/LFM2-1.2B-Longevity-8bit-mlx
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use OpenMed/LFM2-1.2B-Longevity-8bit-mlx with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "OpenMed/LFM2-1.2B-Longevity-8bit-mlx"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "OpenMed/LFM2-1.2B-Longevity-8bit-mlx" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
LFM2-1.2B-Longevity - MLX 8-bit
A native MLX conversion of LiquidAI/LFM2-1.2B-Longevity, affine-quantized to 8-bit (group size 64) with mlx_lm for on-device use on Apple Silicon. The model is Liquid AI and Insilico Medicine's Longevity-LLM fine-tune of LiquidAI/LFM2-1.2B; OpenMed made and published this conversion. For the 4-bit sibling, see OpenMed/LFM2-1.2B-Longevity-4bit-mlx.
Family at a glance:
- PyTorch source (BF16):
LiquidAI/LFM2-1.2B-Longevity-2.18 GiBweights- MLX 4-bit:
OpenMed/LFM2-1.2B-Longevity-4bit-mlx- Apple Silicon,0.61 GiBweights- MLX 8-bit (this repo):
OpenMed/LFM2-1.2B-Longevity-8bit-mlx- Apple Silicon,1.16 GiBweights
Why 8-bit?
| BF16 source | This repo (Q8) | |
|---|---|---|
model.safetensors size |
2.18 GiB | 1.16 GiB (1.9x smaller) |
| Bits per weight, measured from the tensors | 16 | 8.50 |
| Parameters | 1.17 B | 1.17 B (unchanged) |
8-bit at group size 64 is the near-lossless rung: 8 bits plus a 16-bit scale and bias per 64 weights, or 8.5 bits per weight exactly. Reach for it when memory allows and you want the closest thing to the BF16 source that still runs comfortably on Apple Silicon.
Quantization
| Field | Value |
|---|---|
| Bits | 8 |
| Group size | 64 |
| Mode | affine MLX weight-only quantization |
| Tool | mlx_lm.convert (mlx-lm 0.31.3), -q --q-bits 8 --q-group-size 64 |
| Quantized modules | every linear projection and the tied token embedding |
| Kept in BF16 | RMSNorm scales and the short-convolution kernels |
The tokenizer, chat template and generation defaults are the upstream files, unchanged.
What it does
Longevity-LLM (L-LLM) is a family of compact, domain-adapted language models for interpreting heterogeneous aging-biology data - genomic, proteomic and clinical - developed jointly by Insilico Medicine and Liquid AI. This checkpoint was produced by full-parameter supervised fine-tuning of LiquidAI/LFM2-1.2B on aging-related multi-omics and clinical data, and accompanies the study An Open Benchmark and Language Models for AI in Aging Biology (Zhavoronkov et al., 2026). See the upstream model card for the training corpus and evaluation.
Prompts use a ChatML-style template with a dynamic-thinking switch: suffix a user turn with /think for a reasoning trace or /no_think for a direct answer. The template is bundled, so apply_chat_template and mlx_lm handle it for you.
Architecture
| Field | Value |
|---|---|
| Source model type | lfm2 (Lfm2ForCausalLM) |
| Design | Hybrid Liquid model: gated short convolutions with 6 grouped-query attention layers out of 16 |
| Hidden size | 2048 |
| Layers | 16 (6 attention, 10 convolution) |
| Attention | 32 query heads / 8 KV heads |
| Feed-forward width | 12,288 |
| Context length | 32,768 tokens per the upstream card (max_position_embeddings 128,000) |
| Vocabulary | 65,536, tied input/output embeddings |
| Language | English |
File set
| File | Size | Purpose |
|---|---|---|
model.safetensors |
1.16 GiB | MLX weights, affine-quantized |
model.safetensors.index.json |
22.9 KiB | Tensor index |
config.json |
1.7 KiB | Model config with the quantization block |
modeling_lfm2.py |
35.7 KiB | Reference PyTorch modeling file carried from upstream; not used by MLX |
chat_template.jinja |
2.5 KiB | ChatML-style chat template, unchanged from upstream |
tokenizer.json |
4.5 MiB | Tokenizer, unchanged from upstream |
tokenizer_config.json |
0.5 KiB | Tokenizer metadata, unchanged from upstream |
generation_config.json |
0.2 KiB | Default sampling settings, unchanged from upstream |
LICENSE |
10.3 KiB | LFM Open License v1.0 (upstream copy) |
Weights SHA-256: 10a0b76af3ed89706863901b762c1203dd3cb200abd88127ff7a4333e6b15f49
Quick start
With mlx-lm
pip install -U mlx-lm
mlx_lm.generate --model OpenMed/LFM2-1.2B-Longevity-8bit-mlx \
--prompt "Which biomarkers in a routine blood panel are most informative about biological age, and why? /no_think" \
--max-tokens 400
from mlx_lm import load, generate
model, tokenizer = load("OpenMed/LFM2-1.2B-Longevity-8bit-mlx")
messages = [
{"role": "system", "content": "You are a biomedical AI specialized in aging biology, trained on genomic, proteomic, and clinical data."},
{"role": "user", "content": "A 58-year-old has HbA1c 6.1%, hs-CRP 3.4 mg/L and an epigenetic age 6 years above chronological age. What do these point to, and what would you want measured next? /no_think"},
]
prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True)
print(generate(model, tokenizer, prompt=prompt, max_tokens=500))
With LM Studio
Download the repository into your LM Studio models directory (or search for OpenMed/LFM2-1.2B-Longevity-8bit-mlx in the app); the MLX engine loads it directly.
Outputs are model predictions for research use, not clinical advice.
Provenance and license
This repository is a quantized derivative of LiquidAI/LFM2-1.2B-Longevity. model.safetensors was produced by mlx_lm.convert from the upstream BF16 weights and config.json carries the added quantization block; every other file is an unchanged upstream copy. It is distributed under the upstream LFM Open License v1.0: free for research and for commercial use by entities below the license's revenue threshold (US$10M annual revenue), and not licensed for commercial use above it - read the LICENSE before shipping. Copyright in the model remains with Liquid AI, Inc. and Insilico Medicine; OpenMed claims none.
Citation
Please cite the upstream work:
@article{zhavoronkov2026longevitybench,
title = {An Open Benchmark and Language Models for AI in Aging Biology},
author = {Zhavoronkov, Alex and Naumov, Vladimir and Sidorenko, Denis and Aliper, Alex and Aladinskiy, Vladimir and Hasani, Ramin and Amini, Alexander and Nasto, Katerina and Reymond, Mathieu and Shayakhmetov, Rim and Miftakhutdinov, Zulfat and Gladyshev, Vadim N. and Galkin, Fedor},
journal = {Cell},
volume = {189},
pages = {5980--5994},
year = {2026},
doi = {10.1016/j.cell.2026.08.026},
url = {https://www.cell.com/cell/fulltext/S0092-8674(26)00999-2},
}
- Downloads last month
- 18
8-bit