Instructions to use moonbox-dev/LFM3-Omni-2B-MLX with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use moonbox-dev/LFM3-Omni-2B-MLX with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] hf download moonbox-dev/LFM3-Omni-2B-MLX --local-dir LFM3-Omni-2B-MLX
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
LFM3-Omni 2B MLX
MLX builds of LFM3-Omni 2B (Liquid AI's LFM3), made by Moonbox for Apple Silicon Macs. Each build is a folder and
a complete mlx-vlm model: weights, config.json, Liquid's tokenizer, chat
template and processor settings. These files are not an official Liquid AI release.
Files
The last column is how far each build is from the original bf16 model (see "Quality" below for what was measured).
| Precision | File | Size | sha256 | Against the original |
|---|---|---|---|---|
| 8bit | 8bit/audio_tokenizer/config.json |
0.5 kB | 04d24ad70085 |
KL 0.0013 nats (p95 0.0036), top-1 agreement 97.9 %, perplexity 28.86 vs 28.86 |
| 8bit | 8bit/audio_tokenizer/model.safetensors |
147.1 MB | 45984a872fdc |
KL 0.0013 nats (p95 0.0036), top-1 agreement 97.9 %, perplexity 28.86 vs 28.86 |
| 8bit | 8bit/chat_template.jinja |
13.5 kB | ea74cc1d1431 |
KL 0.0013 nats (p95 0.0036), top-1 agreement 97.9 %, perplexity 28.86 vs 28.86 |
| 8bit | 8bit/config.json |
55.0 kB | b481c0f41874 |
KL 0.0013 nats (p95 0.0036), top-1 agreement 97.9 %, perplexity 28.86 vs 28.86 |
| 8bit | 8bit/generation_config.json |
0.4 kB | 5f069cac2df1 |
KL 0.0013 nats (p95 0.0036), top-1 agreement 97.9 %, perplexity 28.86 vs 28.86 |
| 8bit | 8bit/model.safetensors |
2.71 GB | 3a6b0836c6c8 |
KL 0.0013 nats (p95 0.0036), top-1 agreement 97.9 %, perplexity 28.86 vs 28.86 |
| 8bit | 8bit/model.safetensors.index.json |
80.4 kB | b358abc8010a |
KL 0.0013 nats (p95 0.0036), top-1 agreement 97.9 %, perplexity 28.86 vs 28.86 |
| 8bit | 8bit/processor_config.json |
2.1 kB | d7475adcb748 |
KL 0.0013 nats (p95 0.0036), top-1 agreement 97.9 %, perplexity 28.86 vs 28.86 |
| 8bit | 8bit/tokenizer.json |
17.9 MB | 41927bd314d1 |
KL 0.0013 nats (p95 0.0036), top-1 agreement 97.9 %, perplexity 28.86 vs 28.86 |
| 8bit | 8bit/tokenizer_config.json |
0.7 kB | ee4860abad5b |
KL 0.0013 nats (p95 0.0036), top-1 agreement 97.9 %, perplexity 28.86 vs 28.86 |
| 8bit | 8bit/video_preprocessor_config.json |
0.7 kB | 1ed75befc55c |
KL 0.0013 nats (p95 0.0036), top-1 agreement 97.9 %, perplexity 28.86 vs 28.86 |
| 6bit | 6bit/audio_tokenizer/config.json |
0.5 kB | 04d24ad70085 |
KL 0.0068 nats (p95 0.019), top-1 agreement 95.1 %, perplexity 28.97 vs 28.86 |
| 6bit | 6bit/audio_tokenizer/model.safetensors |
147.1 MB | 45984a872fdc |
KL 0.0068 nats (p95 0.019), top-1 agreement 95.1 %, perplexity 28.97 vs 28.86 |
| 6bit | 6bit/chat_template.jinja |
13.5 kB | ea74cc1d1431 |
KL 0.0068 nats (p95 0.019), top-1 agreement 95.1 %, perplexity 28.97 vs 28.86 |
| 6bit | 6bit/config.json |
55.0 kB | 7ca2f4739f9e |
KL 0.0068 nats (p95 0.019), top-1 agreement 95.1 %, perplexity 28.97 vs 28.86 |
| 6bit | 6bit/generation_config.json |
0.4 kB | 5f069cac2df1 |
KL 0.0068 nats (p95 0.019), top-1 agreement 95.1 %, perplexity 28.97 vs 28.86 |
| 6bit | 6bit/model.safetensors |
2.28 GB | ae934e105cfe |
KL 0.0068 nats (p95 0.019), top-1 agreement 95.1 %, perplexity 28.97 vs 28.86 |
| 6bit | 6bit/model.safetensors.index.json |
80.4 kB | 3d9ce4ddeff9 |
KL 0.0068 nats (p95 0.019), top-1 agreement 95.1 %, perplexity 28.97 vs 28.86 |
| 6bit | 6bit/processor_config.json |
2.1 kB | d7475adcb748 |
KL 0.0068 nats (p95 0.019), top-1 agreement 95.1 %, perplexity 28.97 vs 28.86 |
| 6bit | 6bit/tokenizer.json |
17.9 MB | 41927bd314d1 |
KL 0.0068 nats (p95 0.019), top-1 agreement 95.1 %, perplexity 28.97 vs 28.86 |
| 6bit | 6bit/tokenizer_config.json |
0.7 kB | ee4860abad5b |
KL 0.0068 nats (p95 0.019), top-1 agreement 95.1 %, perplexity 28.97 vs 28.86 |
| 6bit | 6bit/video_preprocessor_config.json |
0.7 kB | 1ed75befc55c |
KL 0.0068 nats (p95 0.019), top-1 agreement 95.1 %, perplexity 28.97 vs 28.86 |
| 4bit | 4bit/audio_tokenizer/config.json |
0.5 kB | 04d24ad70085 |
KL 0.027 nats (p95 0.083), top-1 agreement 91.0 %, perplexity 29.40 vs 28.86 (dynamic) |
| 4bit | 4bit/audio_tokenizer/model.safetensors |
147.1 MB | 45984a872fdc |
KL 0.027 nats (p95 0.083), top-1 agreement 91.0 %, perplexity 29.40 vs 28.86 (dynamic) |
| 4bit | 4bit/chat_template.jinja |
13.5 kB | ea74cc1d1431 |
KL 0.027 nats (p95 0.083), top-1 agreement 91.0 %, perplexity 29.40 vs 28.86 (dynamic) |
| 4bit | 4bit/config.json |
55.0 kB | 5c1c4c3355f0 |
KL 0.027 nats (p95 0.083), top-1 agreement 91.0 %, perplexity 29.40 vs 28.86 (dynamic) |
| 4bit | 4bit/generation_config.json |
0.4 kB | 5f069cac2df1 |
KL 0.027 nats (p95 0.083), top-1 agreement 91.0 %, perplexity 29.40 vs 28.86 (dynamic) |
| 4bit | 4bit/model.safetensors |
2.09 GB | b4762f0bbf73 |
KL 0.027 nats (p95 0.083), top-1 agreement 91.0 %, perplexity 29.40 vs 28.86 (dynamic) |
| 4bit | 4bit/model.safetensors.index.json |
80.4 kB | 29c77260499a |
KL 0.027 nats (p95 0.083), top-1 agreement 91.0 %, perplexity 29.40 vs 28.86 (dynamic) |
| 4bit | 4bit/processor_config.json |
2.1 kB | d7475adcb748 |
KL 0.027 nats (p95 0.083), top-1 agreement 91.0 %, perplexity 29.40 vs 28.86 (dynamic) |
| 4bit | 4bit/tokenizer.json |
17.9 MB | 41927bd314d1 |
KL 0.027 nats (p95 0.083), top-1 agreement 91.0 %, perplexity 29.40 vs 28.86 (dynamic) |
| 4bit | 4bit/tokenizer_config.json |
0.7 kB | ee4860abad5b |
KL 0.027 nats (p95 0.083), top-1 agreement 91.0 %, perplexity 29.40 vs 28.86 (dynamic) |
| 4bit | 4bit/video_preprocessor_config.json |
0.7 kB | 1ed75befc55c |
KL 0.027 nats (p95 0.083), top-1 agreement 91.0 %, perplexity 29.40 vs 28.86 (dynamic) |
LFM3-Omni 2B (Liquid AI's 2B omni model: LFM3 with a vision encoder, an audio encoder and a speech decoder; no thinking) converted to MLX for Apple Silicon, in three builds. Each folder is a complete mlx-vlm model.
These files were converted by Moonbox from LiquidAI/LFM3-Omni-2B (revision
c01718a5). They are not an official Liquid AI release. They keep every part of the model (bfloat16) besides the language model, so pictures work.
How to run
With mlx-vlm 0.8.0 or later (the first release that runs LFM3 is 0.7.11):
from huggingface_hub import snapshot_download
from mlx_vlm import load, generate
folder = snapshot_download("moonbox-dev/LFM3-Omni-2B-MLX", allow_patterns="6bit/*") + "/6bit"
model, processor = load(folder)
msgs = [{"role": "system", "content": "Respond with text."},
{"role": "user", "content": "Explain in two sentences why the sky is blue."}]
prompt = processor.tokenizer.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True)
print(generate(model, processor, prompt, max_tokens=1024, temperature=0.1, top_k=50, repetition_penalty=1.1).text)
- Chat template. Liquid's ChatML (
<|startoftext|>first,<|im_start|>role ... <|im_end|>), a picture as<|vision_start|><|image|><|vision_end|>, a recording as<|vision_start|><|audio|><|vision_end|>; tools in the system turn. No thinking: every answer opens with an empty<think></think>(the template's default). - Output modality. The model picks text or speech from the system prompt and the input; for text answers, plain
text generation stops where the model would start to speak (
<|audio_start|>,<|mixed_start|>), andRespond with text.in the system prompt makes it explicit. Speech output needs the codec inaudio_tokenizer/(included in every build, bfloat16) and mlx-vlm's speech generation. - Tool calls are XML:
<tool_call>\n<function=name>\n<parameter=key>\nvalue\n</parameter>\n</function>\n</tool_call>. - Sampling (Liquid's card): greedy decoding works well for text;
audio_temperature=0.4,audio_repetition_penalty=1.2for speech. - Memory and speed on a 24 GB MacBook Air (M5), measured through Moonbox's server (greedy, thinking off; a short answer, a 4K-token prompt, a 768 x 512 picture):
| Build | Peak | Decode (short / after 4K) | Prefill 4K | Picture prefill | Load | Runs on |
|---|---|---|---|---|---|---|
8bit |
4.0 GB | 65.2 / 63.4 tok/s | 3042 tok/s | 1643 tok/s | 2.5 s | 8 GB Macs and up |
6bit |
3.6 GB | 82.5 / 79.3 tok/s | 3008 tok/s | 1769 tok/s | 1.9 s | 8 GB Macs and up |
4bit |
3.4 GB | 94.6 / 90.5 tok/s | 3104 tok/s | 1803 tok/s | 1.9 s | 8 GB Macs and up |
The three builds
MLX affine quantization of the language model's linear layers and its embedding (tied to the head); the rest of the model is the publisher's (bfloat16).
| Build | Size | Layout | Mean KL (nats) | Top-1 agreement | Perplexity |
|---|---|---|---|---|---|
8bit |
2.9 GB | 8 bits, group 64, the embedding (tied: the head) too | 0.0013 | 97.9 % | 28.86 |
6bit |
2.5 GB | 6 bits, group 64, the embedding (tied: the head) too | 0.0068 | 95.1 % | 28.97 |
4bit |
2.3 GB | dynamic (d4c): the MLPs' gate and up projections (w1, w3) 4 bits; the down projections (w2), attention, the short convolutions' projections and the embedding (tied: the head too) 6 bits; group 64 | 0.027 | 91.0 % | 29.40 |
Against the bf16 original (perplexity 28.86), teacher-forced through mlx-vlm's own forward, on 16,368 positions of English prose, Python and chat transcripts in the model's own template. The mark this lab uses is top-1 90 % (KL 0.01 ideal). This small model loses more to quantization than larger ones: a plain 4-bit build (every module 4 bits, group 64) is at KL 0.109 and 81.3 %. Liquid AI's own MLX 4-bit (LiquidAI/LFM3-Omni-2B-MLX-4bit, measured the same way) is at KL 0.064 and 87.0 %. Other layouts measured (lab/zoo/lfm3/notes.md in Moonbox's repository names them): d4e 0.016 / 92.8 %; d5 0.011 / 94.1 %.
How these were made
From LFM3-Omni 2B at revision c01718a568, by Moonbox's converter (lab/zoo/lfm3/convert.py in Moonbox's
repository): mlx_vlm.convert with a quantization layout of our own, MLX affine quantization of the language model
only; every other part of the model is kept as the publisher shipped it (bfloat16). The publisher's Python files
(transformers remote code) are left out: mlx-vlm has its own implementation. Each build was checked against the
original before upload (teacher-forced through mlx-vlm's own forward); the sha256 column above is what the files
must hash to.
License
The LFM Open License v1.0 (LICENSE, copied from the original repository), as the original model card declares. These
files are a derivative of the original model: its weights were converted and quantized as described above
(NOTICE.md says so too). Under the licence, commercial use is licensed only to entities below its revenue threshold
(10 million USD a year); read the licence before using these files. The original model card follows unchanged.
Original model card
LFM3-Omni-2B
LFM3-Omni-2B is Liquid AI's first omni-modal model in the LFM3 family: a single end-to-end model that understands text, images, video and audio, and answers in text and speech. It is built for on-device use: one model replaces a separate ASR model, vision-language model, LLM and TTS model.
- Any input, text or speech output: ask about a photo by voice, transcribe or translate speech, chat out loud, or ask questions about a video and its soundtrack together.
- Watches and listens together: for videos with sound, the model sees and hears them at the same time, so it can answer questions that need both.
- Small enough for devices: at 2.2B parameters, it is designed to run efficiently on phones, laptops and other edge hardware.
Find more information about the LFM3 family in our release blog post.
Model details
The LFM3 family includes base, text, vision, audio, omni, and decision models.
| Property | Specification |
|---|---|
| Checkpoint | Post-trained omni-modal model |
| Parameters | 2.17B total |
| Architecture | LFM3 backbone, LFM3 vision encoder, LFM3 causal audio encoder, LiquidCodec audio tokenizer. |
| Inputs | Text, images, video with or without its soundtrack, and 16 kHz audio. Images and video are processed at native resolution; each 2Γ2 block of patches becomes one language token. Video is sampled at 2 fps, with 4 to 384 frames by default. |
| Outputs | Text, 24 kHz speech, or interleaved text and speech |
| Context length | 32K tokens (input + output) |
| Vocabulary | 128,000 text tokens |
| Text languages | English, Arabic, Chinese, French, German, Italian, Japanese, Korean, Portuguese, Spanish, Vietnamese, Thai, Indonesian, Hindi, Russian, Polish |
| Speech languages and locales | Arabic, Danish, German, Greek, British English, American English, Finnish, French, Hebrew, Italian, Japanese, Korean, Dutch, Polish, Portuguese, Spanish, Swedish, Turkish, Chinese |
| License | LFM Open License v1.0 |
This is a non-reasoning model. enable_thinking=True is not supported.
Inference
Choose a checkpoint variant for your inference framework and hardware.
| Checkpoint | Framework | Description |
|---|---|---|
| BF16 | SGLang, Transformers | BF16 weights for GPU inference. SGLang serves text output. |
| GGUF | llama.cpp | Local inference on CPUs and GPUs, including a realtime speech server. |
| OpenVINO INT4, INT8, FP16 | OpenVINO | 4-bit, 8-bit and FP16 weights for Intel hardware. |
Sampling parameters
- Text output: greedy decoding works well.
- Speech or interleaved output: use
audio_temperature=0.4,audio_repetition_penalty=1.2
Generation modes (optional)
To force a generation mode, pass the optional generation_mode argument to model.generate.
| Mode | generation_mode (optional) |
Opening token |
|---|---|---|
| Text | "text" |
none |
| Speech | "audio" |
<|audio_start|> |
| Text and speech, interleaved | "interleaved" |
<|mixed_start|> |
By default, the model selects the output modality based on the system prompt and input modality, typically matching the input modality. To encourage a specific output modality, append the corresponding instructions to the end of your system prompt.
| Mode | System Prompt |
|---|---|
| Text | Respond in text. |
| Text and speech, interleaved | Respond in interleaved text and audio. |
Transformers quick start
Install the dependencies, then load the model and processor with the checkpoint's custom code. The codec implementation is included in this repository, and the processor loads its weights from audio_tokenizer/.
pip install "transformers>=5.20.2" torch torchvision torchcodec accelerate pillow librosa soundfile
import torch
import soundfile as sf
from transformers import AutoModelForMultimodalLM, AutoProcessor
model_id = "LiquidAI/LFM3-Omni-2B"
device = "cuda" if torch.cuda.is_available() else "cpu"
dtype = torch.bfloat16 if device == "cuda" else torch.float32
model = AutoModelForMultimodalLM.from_pretrained(
model_id, dtype=dtype, device_map=device, trust_remote_code=True
).eval()
processor = AutoProcessor.from_pretrained(model_id, trust_remote_code=True)
codec = processor.audio_tokenizer.to(device=device).eval()
Chat template
LFM3-Omni uses a ChatML-like format, which processor.apply_chat_template() renders for you, generated from the checkpoint's chat template:
<|startoftext|><|im_start|>system
Respond with text.<|im_end|>
<|im_start|>user
Name a famous bridge in San Francisco.<|im_end|>
<|im_start|>assistant
<think></think>The Golden Gate Bridge.<|im_end|>
<|im_start|>user
When did it open?<|im_end|>
<|im_start|>assistant
<think></think>
The system turn is optional, and every assistant turn opens with an empty <think></think>. Each image, video or audio clip is wrapped in <|vision_start|> / <|vision_end|>, which the template adds. Here is an image and a spoken question:
<|startoftext|><|im_start|>user
<|vision_start|><|image|><|vision_end|><|vision_start|><|audio|><|vision_end|>Answer in one sentence.<|im_end|>
<|im_start|>assistant
<think></think>
Usage examples
The examples below reuse the model, codec, and processor loaded above. Replace audio.wav, question.wav, recording.wav, photo.jpg, or clip.mp4 with your own files. Audio files are resampled to 16 kHz mono on load.
Speech recognition (ASR)
To use the model for transcription, use the system prompt Perform ASR in <language>., where <language> is the English name of the language.
Below, we transcribe a .wav file containing English speech.
conversation = [
{"role": "system", "content": "Perform ASR in English."},
{"role": "user", "content": [{"type": "audio", "audio": "audio.wav"}]},
]
inputs = processor.apply_chat_template(
conversation,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(device)
with torch.no_grad():
outputs = model.generate(**inputs, max_new_tokens=1024, generation_mode="text")
text = processor.decode(
outputs.sequences[0, inputs["input_ids"].shape[1]:outputs.sequence_lengths[0]],
skip_special_tokens=True,
)
print(text)
Speech synthesis (TTS)
For speech synthesis, use the system prompt Perform TTS in <language> using a <gender> voice..
Use one of the speech languages listed in Model details and a female or male voice. For English, say American English or British English. Pass generation_mode="audio" so the answer opens with <|audio_start|>.
conversation = [
{"role": "system", "content": "Perform TTS in American English using a female voice."},
{"role": "user", "content": "The quick brown fox jumps over the lazy dog"},
]
inputs = processor.apply_chat_template(
conversation,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=256,
generation_mode="audio",
audio_temperature=0.4,
audio_repetition_penalty=1.2,
)
waveform = codec.decode(
outputs.audio_codes[:1, :, :outputs.audio_lengths[0]]
).audio_values[0] # 24 kHz
sf.write("tts.wav", waveform.squeeze(0).float().cpu().numpy(), 24_000)
Voice chat: speech and text responses
In this mode, the model will respond to the user in both speech and text.
The recommended system prompt is Respond with interleaved text and audio..
User input can be either text or audio, and we pass generation_mode="interleaved" so the answer opens with <|mixed_start|>.
The assistant responds in a conversational style with interleaved text and speech. This example saves the complete response.
conversation = [
{"role": "system", "content": "Respond with interleaved text and audio."},
{"role": "user", "content": [{"type": "audio", "audio": "question.wav"}]},
]
inputs = processor.apply_chat_template(
conversation,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=1024,
generation_mode="interleaved",
audio_temperature=0.4,
audio_repetition_penalty=1.2,
)
text = processor.decode(
outputs.sequences[0, inputs["input_ids"].shape[1]:outputs.sequence_lengths[0]],
skip_special_tokens=True,
)
waveform = codec.decode(
outputs.audio_codes[:1, :, :outputs.audio_lengths[0]]
).audio_values[0] # 24 kHz
print(text)
sf.write("reply.wav", waveform.squeeze(0).float().cpu().numpy(), 24_000)
Speech-to-text chat
For a text-only answer, no specific system prompt is needed. Respond with text. makes it explicit. Pass generation_mode="text". LFM3-Omni-2B is a non-reasoning model: every answer opens with an empty <think></think>.
conversation = [
{"role": "user", "content": [{"type": "audio", "audio": "question.wav"}]},
]
inputs = processor.apply_chat_template(
conversation,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(device)
with torch.no_grad():
outputs = model.generate(**inputs, max_new_tokens=1024, generation_mode="text")
text = processor.decode(
outputs.sequences[0, inputs["input_ids"].shape[1]:outputs.sequence_lengths[0]],
skip_special_tokens=True,
)
print(text)
Audio understanding
Include the recording and a question in the user turn. Questions can address speech, music, background sounds, or events. No specific system prompt is required. To ground answers in the recording, use Answer questions about the provided audio clip. Base every answer only on what can be heard..
conversation = [
{
"role": "system",
"content": "Answer questions about the provided audio clip. Base every answer only on what can be heard.",
},
{
"role": "user",
"content": [
{"type": "audio", "audio": "recording.wav"},
{"type": "text", "text": "What is happening in this recording?"},
],
},
]
inputs = processor.apply_chat_template(
conversation,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(device)
with torch.no_grad():
outputs = model.generate(**inputs, max_new_tokens=1024, generation_mode="text")
print(processor.decode(
outputs.sequences[0, inputs["input_ids"].shape[1]:outputs.sequence_lengths[0]],
skip_special_tokens=True,
))
For multiple-choice questions, include the choices in the text part and end it with Please choose the answer from the options.
Translation
Use a system prompt that specifies the source language, target language, and output format:
- Speech to text:
Please translate the following spoken {source} into {target} text.
Replace {source} and {target} with the English names of the source and target languages. For text input, set the user message's content to the text to translate. Translation to or from English generally works best.
Image understanding
Include the image and a question in the user turn. To ground answers in the image, use the system prompt Answer questions about the provided image. Base every answer only on what can be seen.. For captions, use Describe the provided image.. Images are processed at their native resolution, up to 2,048 tokens per image.
conversation = [
{
"role": "system",
"content": "Answer questions about the provided image. Base every answer only on what can be seen.",
},
{
"role": "user",
"content": [
{"type": "image", "image": "photo.jpg"},
{"type": "text", "text": "What is written on the sign?"},
],
},
]
inputs = processor.apply_chat_template(
conversation,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(device)
with torch.no_grad():
outputs = model.generate(**inputs, max_new_tokens=1024, generation_mode="text")
print(processor.decode(
outputs.sequences[0, inputs["input_ids"].shape[1]:outputs.sequence_lengths[0]],
skip_special_tokens=True,
))
Spoken questions about an image
The question can be asked by voice, with the recording in place of the text. Add Respond with text. to the system prompt for a text answer, or follow the voice chat example with Respond with interleaved text and audio. for a spoken one.
conversation = [
{
"role": "system",
"content": "Answer questions about the provided image. Base every answer only on what can be seen. Respond with text.",
},
{
"role": "user",
"content": [
{"type": "image", "image": "photo.jpg"},
{"type": "audio", "audio": "question.wav"},
],
},
]
inputs = processor.apply_chat_template(
conversation,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(device)
with torch.no_grad():
outputs = model.generate(**inputs, max_new_tokens=1024, generation_mode="text")
print(processor.decode(
outputs.sequences[0, inputs["input_ids"].shape[1]:outputs.sequence_lengths[0]],
skip_special_tokens=True,
))
Video understanding
Include the video and a question in the user turn. No specific system prompt is required. Video is sampled at 2 frames per second (4 to 384 frames), and each pair of frames is prefixed with its timestamp.
conversation = [
{
"role": "user",
"content": [
{"type": "video", "video": "clip.mp4"},
{"type": "text", "text": "What happens in this video?"},
],
},
]
inputs = processor.apply_chat_template(
conversation,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(device)
with torch.no_grad():
outputs = model.generate(**inputs, max_new_tokens=1024, generation_mode="text")
print(processor.decode(
outputs.sequences[0, inputs["input_ids"].shape[1]:outputs.sequence_lengths[0]],
skip_special_tokens=True,
))
Video with its soundtrack
To let the model see and hear a video, use the system prompt Answer questions about the video using what you see and hear. and pass two flags:
load_audio_from_video=Truereads the audio track out of the video file.use_audio_in_video=Trueinterleaves that audio with the frames, so each pair of frames is followed by the sound that goes with it.
Without them, the model gets the frames only.
conversation = [
{"role": "system", "content": "Answer questions about the video using what you see and hear."},
{
"role": "user",
"content": [
{"type": "video", "video": "clip.mp4"},
{"type": "text", "text": "What happens here, and what can you hear?"},
],
},
]
inputs = processor.apply_chat_template(
conversation,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
load_audio_from_video=True,
processor_kwargs={"use_audio_in_video": True},
).to(device)
with torch.no_grad():
outputs = model.generate(**inputs, max_new_tokens=1024, generation_mode="text")
print(processor.decode(
outputs.sequences[0, inputs["input_ids"].shape[1]:outputs.sequence_lengths[0]],
skip_special_tokens=True,
))
Video frame rate and frame limit
By default, LFM3-Omni-2B samples video at 2 fps, with at least 4 and at most 384 frames per video. Each frame adds vision tokens, so for long videos a lower frame rate or frame limit uses less context and memory. These settings do not change the soundtrack: the model always hears all of it.
- Transformers: set the frame rate per call with
processor.apply_chat_template(..., processor_kwargs={"fps": 1}). With the soundtrack, useprocessor_kwargs={"use_audio_in_video": True, "fps": 1}. Set the frame limit when you load the processor:AutoProcessor.from_pretrained(model_id, trust_remote_code=True, max_frames=128). - SGLang: change
fps,min_frames, andmax_framesundervideo_processorinprocessor_config.jsonin a local copy of the checkpoint. - llama.cpp: always uses 2 fps and 4 to 384 frames for this model.
--video-fpshas no effect.
Tool calling from spoken requests
Pass function schemas through tools=... to apply_chat_template(). The chat template places them in the system prompt between <tools> and </tools>. Requests may be spoken or written. A tool call looks like this:
<tool_call>
<function=set_volume>
<parameter=volume>
30
</parameter>
</function>
</tool_call>
Values other than strings are written as JSON. Your application parses and runs the calls, then appends the assistant's tool_calls (with arguments as a dict) and a tool message with the results to the conversation. Generate again with the same tools: the model either makes more calls or answers.
import json
import re
tools = [{
"type": "function",
"function": {
"name": "set_volume",
"description": "Set the device speaker volume.",
"parameters": {
"type": "object",
"properties": {
"volume": {"type": "integer", "description": "Volume from 0 to 100."}
},
"required": ["volume"],
},
},
}]
functions = {"set_volume": lambda volume: {"volume": volume}} # your implementations
CALL_RE = re.compile(r"<tool_call>\s*<function=([^>\n]+)>(.*?)</function>\s*</tool_call>", re.DOTALL)
PARAM_RE = re.compile(r"<parameter=([^>\n]+)>\n?(.*?)\n?</parameter>", re.DOTALL)
def parse_tool_calls(text):
calls = []
for name, body in CALL_RE.findall(text):
arguments = {}
for key, value in PARAM_RE.findall(body):
try:
arguments[key] = json.loads(value)
except json.JSONDecodeError:
arguments[key] = value # plain string
calls.append({"type": "function", "function": {"name": name, "arguments": arguments}})
return calls
def respond(conversation):
inputs = processor.apply_chat_template(
conversation,
tools=tools,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(device)
with torch.no_grad():
outputs = model.generate(**inputs, max_new_tokens=1024, generation_mode="text")
return processor.decode(
outputs.sequences[0, inputs["input_ids"].shape[1]:outputs.sequence_lengths[0]],
skip_special_tokens=True,
)
conversation = [
{"role": "user", "content": [{"type": "audio", "audio": "question.wav"}]},
]
text = respond(conversation)
while calls := parse_tool_calls(text):
results = [functions[c["function"]["name"]](**c["function"]["arguments"]) for c in calls]
conversation += [
{"role": "assistant", "tool_calls": calls},
{"role": "tool", "content": json.dumps(results)},
]
text = respond(conversation)
print(text)
See the Tool Use documentation for details.
Fine-tuning
LFM3-Omni-2B is designed for easy customization for a given domain, task, or application with Hugging Face Transformers.
| Training | Use case | Notebook |
|---|---|---|
| SFT | Fine-tune on your own omni data (text, audio, images) with Transformers | |
| SFT | Visual question answering |
Performance
Omni
| Benchmark | LFM3-Omni 2B |
Qwen2.5-Omni 3B |
Qwen2.5-Omni 7B |
Gemma 4 E2B |
Gemma 4 E4B |
Phi-4 multimodal |
|---|---|---|---|---|---|---|
| Total parameters | 2.2B | 6B | 10.7B | 5B | 8B | 5.6B |
| Video + audio understanding | ||||||
| Daily-Omni | 70.09 | 58.81 | 61.32 | 50.63 | 54.14 | 48.87 |
| WorldSense | 47.10 | 44.99 | 45.37 | 38.11 | 43.51 | 42.37 |
| AV-SpeakerBench | 46.79 | 40.44 | 43.24 | 32.32 | 36.36 | 37.95 |
| Image + audio understanding | ||||||
| OmniBench (overall) | 46.32 | 47.11 | 49.65 | 16.81 | 20.67 | 38.97 |
| OmniBench (speech) | 48.25 | 45.65 | 47.99 | 16.08 | 21.27 | 38.91 |
| Spoken visual QA | ||||||
| RealWorldQA | 64.68 | 61.05 | 69.93 | 39.35 | 49.02 | 64.31 |
| MMStar | 51.79 | 50.80 | 57.27 | 38.87 | 44.60 | 54.80 |
| POPE | 83.78 | 85.34 | 85.37 | 74.20 | 77.82 | 83.00 |
| ERQA | 39.43 | 37.34 | 39.16 | 20.63 | 32.12 | 30.81 |
| EmbSpatial | 67.59 | 53.40 | 59.51 | 44.08 | 54.01 | 42.60 |
Vision
| Benchmark | LFM3-Omni 2B |
Qwen2.5-Omni 3B |
Gemma 4 E2B |
Gemma 4 E4B |
Phi-4 multimodal |
Cosmos3 Edge |
|---|---|---|---|---|---|---|
| Total parameters | 2.2B | 6B | 5B | 8B | 5.6B | 4B |
| General | ||||||
| MMStar | 55.67 | 55.67 | 46.47 | 52.00 | 59.33 | 56.07 |
| MMMU (val) | 42.44 | 48.00 | 37.81 | 43.14 | 54.76 | 37.14 |
| MMMU-Pro | 27.28 | 24.80 | 24.34 | 28.67 | 27.63 | 13.76 |
| MMBench | 73.68 | 79.30 | 67.61 | 73.54 | 82.73 | 76.63 |
| SEEDBench (image) | 75.07 | 75.27 | 72.53 | 74.78 | 72.24 | 74.73 |
| RealWorldQA | 66.54 | 63.14 | 48.63 | 53.07 | 64.84 | 72.81 |
| MathVista (mini) | 62.50 | 58.80 | 51.00 | 54.30 | 65.40 | 53.90 |
| POPE | 89.34 | 84.62 | 78.78 | 81.24 | 83.34 | 83.52 |
| Documents and OCR | ||||||
| DocVQA | 92.47 | 92.71 | 73.49 | 77.91 | 92.60 | 84.43 |
| InfoVQA | 64.08 | 74.55 | 38.72 | 48.30 | 65.98 | 60.94 |
| OCRBench | 806 | 863 | 731 | 761 | 795 | 751 |
| Grounding | ||||||
| RefCOCO | 73.55 | 78.76 | 63.18 | 63.36 | β* | 74.53 |
| Video | ||||||
| MVBench | 58.03 | 66.43 | 42.05 | 47.10 | 52.60 | 71.65 |
| Video-MME (no subtitles) | 57.70 | 62.59 | 47.70 | 52.44 | 53.44 | 55.89 |
| Spatial and embodied | ||||||
| ERQA | 38.50 | 40.25 | 35.25 | 34.50 | 35.75 | 41.00 |
| EmbSpatial | 70.55 | 65.58 | 47.64 | 62.28 | 57.83 | 76.24 |
| RoboSpatial | 49.14 | 52.00 | 27.71 | 38.29 | 41.14 | 50.57 |
Audio
| Benchmark | LFM3-Omni 2B |
Qwen2.5-Omni 3B |
Gemma 4 E2B |
Gemma 4 E4B |
Phi-4 multimodal |
|---|---|---|---|---|---|
| Total parameters | 2.2B | 6B | 5B | 8B | 5.6B |
| English ASR WER β |
6.36 | 6.30 | 8.26 | 7.82 | 5.14 |
| Multilingual ASR WER / CER β |
6.72 | 7.41 | 8.08 | 6.54 | ββ |
| English TTS UTMOSv2 β |
3.80 | 3.42 | β | β | β |
| VoiceBench β | 64.73 | 66.37 | 63.28 | 72.90 | 64.97 |
| Tool calling internal eval β |
52.20 | 44.30 | 55.60 | 72.40 | β |
| Audio understanding MMAR β |
51.40 | 54.41 | 44.49 | 49.10 | 44.69 |
Evaluation details
All scores were measured by Liquid AI. Every model uses its own chat template, prompt format, and image and video preprocessing, with greedy decoding for text output. LFM3-Omni-2B speech output uses audio_temperature=0.4 and audio_repetition_penalty=1.2.
Scale: all scores are on a 0β100 scale except OCRBench, which is out of 1,000. DocVQA and InfoVQA use ANLS.
Daily-Omni, WorldSense, and AV-SpeakerBench: video with its soundtrack, multiple-choice accuracy.
OmniBench: an image and an audio clip with each question, scored with the official prompt and answer parser on all 1,142 questions. OmniBench (speech) is the subset whose audio is speech.
Spoken visual QA: the image benchmarks with each question given only as speech.
POPE: F1 over all examples in the adversarial, popular, and random subsets.
MMMU-Pro: vision setting, with the question and options shown in the image.
RefCOCO: boxes are read in each model's native coordinate format. *Phi-4-multimodal does not return bounding boxes in a parseable format (72% of answers fail to parse), so its score is not reported.
MVBench and Video-MME: video frames without audio, sampled with each model's recommended settings. Video-MME is without subtitles.
RoboSpatial: RoboSpatial-Home, scored with the official RoboSpatial-Eval rule, with points read in each model's native coordinate format.
English ASR: average word error rate (WER) in percent on the ESB / Open ASR benchmark suite, lower is better.
Multilingual ASR: mean error rate in percent on FLEURS across English, Spanish, Portuguese, German, French, Italian, Chinese, Japanese, and Korean, lower is better. WER is used for all languages except Chinese, Japanese, and Korean, which use character error rate (CER). β Phi-4-multimodal does not support Korean speech, so its score is not reported.
English TTS: UTMOSv2 speech quality score on Seed-TTS-eval English, on a 1β5 scale, higher is better.
VoiceBench: audio input, text output, mean of the 9 subsets on a 0β100 scale (the three 1β5 judge scores are multiplied by 20), higher is better.
Tool calling: internal evaluation with audio input, percentage score, higher is better.
Audio understanding: MMAR, percentage score, higher is better.
Citation
@article{liquidAI2026LFM3,
author = {Liquid AI},
title = {Introducing LFM3: Every Modality for Specialized Intelligence},
journal = {Liquid AI Blog},
year = {2026},
note = {www.liquid.ai/blog/lfm3},
}
For questions and feedback, join Discord. For custom deployment and fine-tuning support, contact Liquid AI.
Quantized
Model tree for moonbox-dev/LFM3-Omni-2B-MLX
Base model
LiquidAI/LFM3-Omni-2B