LFM3 是我们新一代的液体基础模型(Liquid Foundation Models,简称 LFMs),旨在成为专用智能的起点。它将文本、视觉、音频、全能(omni)和决策模型整合到同一个共享主干网络中,参数量均在 20 亿级别。这意味着您可以为所需的模态选择模型,在单块 GPU 上使用自己的数据进行微调,并将其部署在您应用程序运行的地方。
与上一代 LFM2 系列相比,LFM3 带来了四项主要变革:
每参数能力更强:新的三混合架构和训练配方使 LFM3-1.7B 能够在参数量减少 35% 的情况下,超越 LFM2.5-2.6B 的性能。
所有模态共享一个主干网络:六个 20 亿级别模型(文本、视觉、音频、全能和决策)均从 LFM3-1.7B-Base 训练而来,其中包括我们的首个全能模型以及视觉模型的视频输入功能。
专为边缘计算打造:文本模型在 4 位精度下仅需约 1 GB 内存,全新的自研视觉和音频编码器加快了处理速度,而文本模型的 256K 上下文窗口使得智能体能够在设备端运行。
旨在实现专用化:每个模型均可在单块 GPU 上进行微调,因此您可以根据自身数据、术语和部署环境对其进行适配。
我们如何构建更具表现力的主干网络
LFM2 证明了短卷积与注意力机制的混合可以在设备端快速运行而不牺牲质量。对于 LFM3,我们利用硬件闭环架构搜索重新设计了该架构,以适用于需要更高每参数能力和长上下文快速推理的智能体用例。现在的搜索涵盖了 14 种设备和后端组合,从手机和 Raspberry Pi 5 到笔记本电脑、云端 CPU、GPU 以及高通 Hexagon NPU。
LFM3-1.7B-Base 拥有 24 层结构,包含四项主要变更:
三混合层混合:包括 13 个门控短卷积、5 个滑动窗口注意力(SWA)层(窗口大小为 256 个 token)以及 6 个全局注意力层。卷积使用的核大小从 LFM2 的 3 增加到 7。
按头门控注意力:一个 sigmoid 门控对每个头的输出进行缩放,以便在某个头没有贡献时将其关闭。这有助于抑制损害量化效果的激活值异常值。
部分 RoPE(旋转位置编码):全局注意力层仅旋转每个头的最高频率的一半,使得另一半无论距离如何都能匹配内容。SWA 层保留完整的 RoPE。
三明治归一化:每个块对其输入和输出都进行归一化,以保持激活值的尺度合理。
长上下文场景下的收益显著。在边缘设备上,按参数计算,LFM3-1.7B 在短提示词上与 LFM2-1.2B 表现相当,而在包含 8K token 的上下文中速度提升了约 25%。LFM3-1.7B-Base 使用与 LFM2.5-8B-A1B 相同的 128K 词汇表进行了 22T token 的预训练。最后的 3.5T token 是一个中期训练阶段,使用了经过筛选的数据,其中包含更大比例的智能体轨迹和工具调用数据,这也将上下文窗口扩展到了 256K token。
一个主干网络对应六个模型
每个 LFM3 模型都衍生自 LFM3-1.7B-Base。您无需运行一个庞大的通用模型,而是选择适合您输入数据的模型,对其进行定制,并在设备端运行。
| 模型 | 输入 | 输出 | 基于 |
|---|---|---|---|
| LFM3-1.7B | 文本 | 文本 | LFM3-1.7B-Base |
| LFM3-VL-2B | 文本、图像、视频 | 文本 | LFM3 主干网络 + 视觉编码器 |
| LFM3-Audio-2B | 文本、音频 | 文本、语音 | LFM3 主干网络 + 音频编码器、音频解码器和 LiquidCodec |
| LFM3-Omni-2B | 文本、图像、视频、音频 | 文本、语音 | LFM3 主干网络 + 视觉和音频编码器及音频解码器 |
| d1-2B | 文本、图像、视频 | 校准后的答案 | LFM3-VL-2B |
| d1-omni-2B | 文本、图像、视频、音频 | 校准后的答案 | LFM3-Omni-2B |
视觉和音频模型还获得了两个新的自研编码器:
视觉编码器:它结合了卷积和注意力机制,计算量比前代 LFM VL 模型中使用的 SigLIP2 编码器减少了三倍。我们拥有 1.64 亿参数的编码器在准确性上与 Qwen3.5-2B 的视觉编码器相当,同时所需的浮点运算次数(FLOPs)减少了 2.2 倍(两者均使用相同的 LFM2.5-230M 语言主干网络进行测量)。对于视频处理,它将每对采样的帧嵌入到一个时间切片中,从而将时间序列长度减半。
音频编码器与LiquidCodec:该音频编码器结合了滑动窗口注意力机制和短卷积,且完全因果(causal),因此模型可以在你说话的同时进行预填充(prefill),首字延迟低至50毫秒。LiquidCodec是我们全新的音频分词器,能在Apple M4 Max的单核CPU线程上以约87倍实时速度将生成的token转换为语音,并支持流式解码。
如何使用LFM3模型
每个模型均在transformers中运行。以下代码片段摘自各模型的说明文档,其中还列出了每个模型支持的其他推理引擎。
LFM3-1.7B
当你需要本地代理、工具调用、结构化输出或用于特定领域微调的基础模型时,请选择LFM3-1.7B。它经过后置训练,可在Hermes Agent、Pi和OpenClaw等代理框架中运行。其参数量比前代LFM2.5-2.6B减少了35%,性能却更胜一筹,在代理任务上的提升尤为显著:在WebArena-Verified基准测试中,它取得了38.42分的成绩,而前代仅为3.02分;甚至在浏览器和业务应用的长任务中,它也超越了Qwen3.5-9B。更多详情请参阅LFM3-1.7B模型说明文档。
要运行LFM3-1.7B,请安装最新版本的transformers:
pip install -U transformers
然后加载并运行模型:
from transformers import pipeline
generator = pipeline(
"text-generation",
model="LiquidAI/LFM3-1.7B",
trust_remote_code=True,
)
messages = [{"role": "user", "content": "What is C. elegans?"}]
output = generator(
messages,
do_sample=True,
temperature=0.1,
top_k=50,
repetition_penalty=1.1,
max_new_tokens=2048,
)
print(output[0]["generated_text"][-1]["content"])
有关本地代理设置,请参阅代理框架指南。
LFM3-VL-2B
当你需要设备端视觉理解能力时,请选择LFM3-VL-2B。它是首款支持视频输入的LFM视觉模型;它在回答前会逐步推理,并能识别物体及其空间布局关系,为机器人技术奠定了坚实基础。与LFM2.5-VL-3B相比,其参数量更少(19亿对31亿),但在62个视觉基准测试中的平均分从57.6提升至71.4,与参数量是其六倍多的Gemma 4 12B模型持平。更多详情请参阅LFM3-VL-2B模型说明文档。
要运行LFM3-VL-2B,请安装transformers>=5.21.0及其视觉依赖库:
pip install "transformers>=5.21.0" torch torchvision pillow
然后加载并运行模型:
import torch
from transformers import AutoModelForImageTextToText, AutoProcessor
model_id = "LiquidAI/LFM3-VL-2B"
model = AutoModelForImageTextToText.from_pretrained(model_id, dtype=torch.bfloat16, device_map="auto", trust_remote_code=True)
processor = AutoProcessor.from_pretrained(model_id, trust_remote_code=True)
messages = [
{
"role": "user",
"content": [
{"type": "image", "url": "https://placecats.com/300/200"},
{"type": "text", "text": "Describe this image."},
],
}
]
inputs = processor.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(model.device)
with torch.inference_mode():
output_ids = model.generate(
**inputs,
do_sample=True,
temperature=0.1,
top_k=50,
repetition_penalty=1.1,
max_new_tokens=16384,
)
generated_ids = output_ids[:, inputs["input_ids"].shape[1]:]
print(processor.batch_decode(generated_ids, skip_special_tokens=True)[0])
有关工具调用、工具搜索以及使用llama.cpp进行设备端推理的详情,请参阅LFM3-VL-2B模型说明文档。
LFM3-Audio-2B
当您在笔记本电脑或边缘设备上需要语音聊天、语音识别、语音合成或跨 18 种语言的翻译时,请使用 LFM3-Audio-2B。它以文本或音频作为输入,并以文本、语音或两者兼有的形式响应,还能将口语请求转化为工具调用。与 LFM2.5-Audio-1.5B 相比,它采用了全新的自研音频编码器和语音编解码器,语音质量更高(UTMOSv2 得分为 3.83,而前者为 3.22),并增加了音频理解、通用音频推理和工具调用功能。您可以在 LFM3-Audio-2B 模型卡片中找到更多详细信息。
要运行 LFM3-Audio-2B,请安装 transformers>=5.20.2 及其音频依赖项:
pip install "transformers>=5.20.2" torch accelerate librosa soundfile
直接从 Hugging Face Hub 加载模型和处理器:
import torch
import soundfile as sf
from transformers import AutoModelForMultimodalLM, AutoProcessor
model_id = "LiquidAI/LFM3-Audio-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 ()
然后大声提问并获得文本和语音回复:
conversation = [
{ "role" : "system" , "content" : "Respond with interleaved text and audio." },
{ "role" : "user" , "content" : [{ "type" : "audio" , "audio" : "question.wav" }]},
{ "role" : "assistant" , "content" : "<|mixed_start|>" },
]
inputs = processor.apply_chat_template(
conversation,
continue_final_message= True ,
tokenize= True ,
return_dict= True ,
return_tensors= "pt" ,
).to(device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens= 1024 ,
audio_temperature= 1.0 ,
audio_top_k= 128 ,
audio_repetition_penalty= 1.1 ,
audio_repetition_window= 4096 ,
return_dict_in_generate= True ,
)
text = processor.decode(
outputs.sequences[ 0 , inputs[ "input_ids" ].shape[ 1 ]:],
skip_special_tokens= True ,
)
waveform = codec.decode(
outputs.audio_codes[: 1 , :, :outputs.audio_lengths[ 0 ]]
).audio_values[ 0 ]
print (text)
sf.write( "reply.wav" , waveform. float ().cpu().numpy(), 24_000 )
请参阅 LFM3-Audio-2B 模型卡片,了解实时语音识别、语音合成、音频理解和工具调用功能。
LFM3-Omni-2B
当您需要一个能在设备上同时实现视觉感知、听觉捕捉和语音交互的单一模型,以替代单独的 ASR 模型、视觉语言模型、LLM 和 TTS 模型时,请使用 LFM3-Omni-2B。它可以回答关于图像的口语问题,共同观看并聆听视频,并将所见所闻转化为工具调用。这是我们首款全能模型(omni model),支持文本、视觉和音频输入,以及文本和语音输出,并保留了独立 LFM3 模型的核心能力,包括视觉问答、语音识别、语音合成和指令遵循。与 LFM3-Audio-2B 一样,它通过 LiquidCodec 进行语音输出,该编解码器能将生成的 token 转化为语音的速度超过实时,因此口语回复会随着模型的生成而流式传输。在音频视觉视频理解方面,它在 Daily-Omni、WorldSense 和 AV-SpeakerBench 等基准测试中击败了高达 107 亿参数的模型,例如 Qwen2.5-Omni-7B。您可以在 LFM3-Omni-2B 模型卡片中找到更多详细信息。
要运行 LFM3-Omni-2B,请安装 transformers>=5.20.2 及其视觉和音频依赖项:
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 ()
然后通过语音向照片提问:
conversation = [
{
"role" : "system" ,
"content" : "回答关于所提供图像的问题。仅基于可见内容给出答案。以文本形式回复。" ,
},
{
"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 ,
))
请参阅 LFM3-Omni-2B 模型卡片,以获取语音输出、带音轨的视频以及工具调用示例。
d1-2B 和 d1-omni-2B
当你需要快速的结构化决策而非生成文本时,请使用 d1 系列模型。向其提供情境(如支持工单、发票、应用屏幕截图、照片或语音备忘录)和问题列表,它们将在单次前向传播中回答所有问题,并为每个答案提供校准后的概率。除了是/否判断、选项选择和评分之外,它们现在还能指向对象、从文档中读取数值、估算带范围的数字,并选出所有适用的选项。更多详细信息请参阅 d1-2B 和 d1-omni-2B 的模型卡片。
在这两个 d1 模型之间:
d1-2B :适用于文本、图片和视频。它用比 d1-3B 少三分之一的参数量,在所有四项决策测试套件中得分更高,例如在 ImajevBench 上得分为 75.5,而 d1-3B 为 64.0。
d1-omni-2B :当输入包含音频时选择它。如果你通过语音而非文字提问,它能保持几乎全部的准确率。
要运行 d1-2B,请安装 transformers>=5.19 及其视觉依赖库:
pip install "transformers>=5.19" torch torchvision pillow
然后加载 d1-2B 并在单次传递中向它提出关于一个支持工单的多个问题:
import torch
from transformers import AutoModel
device = "cuda" if torch.cuda.is_available() else "mps" if torch.backends.mps.is_available() else "cpu"
dtype = torch.float32 if device == "cpu" else torch.bfloat16
model = AutoModel.from_pretrained( "LiquidAI/d1-2B" , trust_remote_code= True , dtype=dtype).to(device)
questions = {
"refund" : { "type" : "noul" , "instructions" : "客户是否在要求退款?" },
"team" : { "type" : "choice" , "instructions" : "哪个团队应处理此问题?" ,
"criteria" : { "billing" : "收费、退款、发票" , "shipping" : "配送和包裹" ,
"technical" : "应用或网站故障" }},
"topics" : { "type" : "choice" , "multiple" : True , "instructions" : "该消息涉及哪些主题?" ,
"criteria" : { "billing" : "付款和收费" , "delivery" : "配送和包裹" ,
"login" : "登录账户" }},
"urgency" : { "type" : "score" , "instructions" : "此工单的紧急程度如何?" , "criteria" : [ "low" , "medium" , "high" ]},
}
out = model.system_one( "我被收取了两次费用,而且我的包裹从未送达。请退还其中一笔费用。" , questions)
a = out[ "answers" ]
urgency = a[ "urgency" ][ "legend" ][ str ( int (a[ "urgency" ][ "score" ]))]
print ( round (a[ "refund" ][ "noul" ], 2 ), a[ "team" ][ "choice" ], a[ "topics" ][ "choices" ], urgency)
为简洁起见,此处仅包含 d1-2B 的示例。请参阅 d1-omni-2B 模型卡片以获取音频片段和语音提问示例。
针对你的任务微调 LFM3
LFM3 专为专业化而构建。前沿模型是功能强大的通用专家,但它们未必能在你的特定应用场景中成为行家里手。LFM3 将额外的容量压缩进一个小型且快速的模型中,因此只需进行简短的微调,即可将其转化为依赖你自身数据、术语和工具的可靠任务专家。由于其体量小巧,你可以将微调后的模型部署在应用程序运行的任何地方,从终端设备到私有基础设施,再到云端。
每个模型均可在单块 GPU 上进行微调,这些笔记本教程将引导你完成针对文本、视觉、音频以及全能(omni)模型的完整任务流程,涵盖从数据准备到评估的各个环节。
模型
方法
任务
笔记本链接
LFM3-1.7B
SFT
从杂乱文档中提取结构化 JSON
在 Colab 中打开
LFM3-1.7B
DPO
根据检索到的文档作答,或选择拒绝回答
在 Colab 中打开
LFM3-1.7B
GRPO
在拥有 108 个工具的手机应用中调用正确的工具
在 Colab 中打开
LFM3-1.7B
CPT
从原始文本中学习一门新语言(土耳其语)
在 Colab 中打开
LFM3-VL-2B
SFT
将收据照片读取为 JSON 格式
在 Colab 中打开
LFM3-VL-2B
GRPO
Tran
LFM3 is our new generation of Liquid Foundation Models (LFMs), built to be the starting point for specialized intelligence. It brings text, vision, audio, omni, and decision models onto one shared backbone, all in the 2B parameter range. This means you can pick the model for your modality, fine-tune it on your own data on a single GPU, and deploy it where your application runs.
LFM3 brings four main changes compared to our previous LFM2 family:
More capability per parameter: a new tri-hybrid architecture and training recipe allow LFM3-1.7B to outperform LFM2.5-2.6B while using 35% fewer parameters.
Every modality on one backbone: six 2B-class models (text, vision, audio, omni, and decision) trained from LFM3-1.7B-Base, including our first omni model and video input for our vision model.
Built for the edge: the text model fits in about 1 GB at 4-bit precision, new in-house vision and audio encoders speed up processing, and the text model’s 256K context window lets agents run on-device.
Made to be specialized: every model fine-tunes on a single GPU, so you can adapt it to your data, terminology, and deployment environment.
How we built a more expressive backbone
LFM2 showed that a hybrid of short convolutions and attention can run fast on-device without sacrificing quality. For LFM3, we used our hardware-in-the-loop architecture search to redesign that architecture for agentic use cases, which need more capability per parameter and fast inference over long contexts. The search now covers 14 device and backend combinations, from phones and a Raspberry Pi 5 to laptops, cloud CPUs, GPUs, and the Qualcomm Hexagon NPU.
LFM3-1.7B-Base has 24 layers and four main changes:
Tri-hybrid layer mix: 13 gated short convolutions, 5 sliding-window attention (SWA) layers with a 256-token window, and 6 global attention layers. The convolutions use a kernel size of 7, up from 3 in LFM2.
Head-wise gated attention: a sigmoid gate scales each head's output, so a head can switch off when it has nothing to add. This can help suppress activation outliers that hurt quantization.
Partial RoPE: global attention layers rotate only the highest-frequency half of each head, so the other half matches on content regardless of distance. SWA layers keep full RoPE.
Sandwich norm: each block normalizes both its input and its output to keep activations well-scaled.
The payoff shows at long context. Per parameter, LFM3-1.7B matches LFM2-1.2B on short prompts across edge devices, and with 8K tokens in context it is about 25% faster. LFM3-1.7B-Base was pre-trained on 22T tokens with the same 128K vocabulary as LFM2.5-8B-A1B . The final 3.5T tokens are a mid-training stage on curated data with a larger share of agentic traces and tool calls, which also extends the context window to 256K tokens.
One backbone for six models
Every LFM3 model branches from LFM3-1.7B-Base. Instead of running one large general-purpose model, you pick the one that fits your inputs, customize it, and run it on-device.
Model
Input
Output
Built on
LFM3-1.7B
Text
Text
LFM3-1.7B-Base
LFM3-VL-2B
Text, images, video
Text
LFM3 backbone + vision encoder
LFM3-Audio-2B
Text, audio
Text, speech
LFM3 backbone + audio encoder, audio decoder, and LiquidCodec
LFM3-Omni-2B
Text, images, video, audio
Text, speech
LFM3 backbone + vision and audio encoders and audio decoder
d1-2B
Text, images, video
Calibrated answers
LFM3-VL-2B
d1-omni-2B
Text, images, video, audio
Calibrated answers
LFM3-Omni-2B
The vision and audio models also get two new in-house encoders:
Vision encoder: it combines convolution and attention and uses 3x less compute than the SigLIP2 encoder in previous LFM VL models. Our 164M-parameter encoder matches Qwen3.5-2B's vision encoder in accuracy while requiring 2.2x fewer FLOPs (both measured with the same LFM2.5-230M language backbone). For video, it embeds each pair of sampled frames into one temporal slice, halving the temporal sequence length.
Audio encoder and LiquidCodec: the audio encoder mixes sliding-window attention and short convolutions and is fully causal, so the model can prefill while you speak, with time to first token as low as 50 ms. LiquidCodec, our new audio tokenizer, turns generated tokens into speech at about 87x real time on a single CPU thread on Apple M4 Max and supports streaming decoding.
How to use the LFM3 models
Each model runs in transformers . The snippets below come from the model cards, which also list the other inference engines each model supports.
LFM3-1.7B
Reach for LFM3-1.7B when you need local agents, tool calling, structured outputs, or a base for domain-specific fine-tuning. It is post-trained to run in agentic harnesses such as Hermes Agent, Pi, and OpenClaw. It outperforms its predecessor, LFM2.5-2.6B, with 35% fewer parameters, and the biggest gains are on agentic tasks: on WebArena-Verified, it scores 38.42 against 3.02, and it even beats Qwen3.5-9B on long tasks in browsers and business apps. You can find more details in the LFM3-1.7B model card .
To run LFM3-1.7B, install the latest version of transformers :
pip install -U transformers
Then load and run the model:
from transformers import pipeline
generator = pipeline(
"text-generation" ,
model= "LiquidAI/LFM3-1.7B" ,
trust_remote_code= True ,
)
messages = [{ "role" : "user" , "content" : "What is C. elegans?" }]
output = generator(
messages,
do_sample= True ,
temperature= 0.1 ,
top_k= 50 ,
repetition_penalty= 1.1 ,
max_new_tokens= 2048 ,
)
print (output[ 0 ][ "generated_text" ][- 1 ][ "content" ])
For local agent setup, see the Agent Harnesses guide .
LFM3-VL-2B
Reach for LFM3-VL-2B when you need on-device visual understanding. It is the first LFM vision model that takes video as input; it reasons step by step before it answers, and it finds objects and reasons about how they are placed, a strong foundation for robotics. Compared with LFM2.5-VL-3B, it has fewer parameters (1.9B against 3.1B) yet raises the average across 62 vision benchmarks from 57.6 to 71.4, on par with Gemma 4 12B, a model more than six times larger. You can find more details in the LFM3-VL-2B model card .
To run LFM3-VL-2B, install transformers>=5.21.0 with its vision dependencies:
pip install "transformers>=5.21.0" torch torchvision pillow
Then load and run the model:
import torch
from transformers import AutoModelForImageTextToText, AutoProcessor
model_id = "LiquidAI/LFM3-VL-2B"
model = AutoModelForImageTextToText.from_pretrained(model_id, dtype=torch.bfloat16, device_map= "auto" , trust_remote_code= True )
processor = AutoProcessor.from_pretrained(model_id, trust_remote_code= True )
messages = [
{
"role" : "user" ,
"content" : [
{ "type" : "image" , "url" : "https://placecats.com/300/200" },
{ "type" : "text" , "text" : "Describe this image." },
],
}
]
inputs = processor.apply_chat_template(
messages,
add_generation_prompt= True ,
tokenize= True ,
return_dict= True ,
return_tensors= "pt" ,
).to(model.device)
with torch.inference_mode():
output_ids = model.generate(
**inputs,
do_sample= True ,
temperature= 0.1 ,
top_k= 50 ,
repetition_penalty= 1.1 ,
max_new_tokens= 16384 ,
)
generated_ids = output_ids[:, inputs[ "input_ids" ].shape[ 1 ] :]
print (processor.batch_decode(generated_ids, skip_special_tokens= True )[ 0 ])
See the LFM3-VL-2B model card for tool calling, tool search, and on-device inference with llama.cpp.
LFM3-Audio-2B
Reach for LFM3-Audio-2B when you need voice chat, speech recognition, speech synthesis, or translation across 18 languages on a laptop or edge device. It takes text or audio as input and responds with text, speech, or both, and it can turn spoken requests into tool calls. Compared with LFM2.5-Audio-1.5B, it uses a new in-house audio encoder and speech codec, speaks with higher quality (UTMOSv2 3.83 against 3.22), and adds audio understanding, general-purpose audio reasoning, and tool calling. You can find more details in the LFM3-Audio-2B model card .
To run LFM3-Audio-2B, install transformers>=5.20.2 with its audio dependencies:
pip install "transformers>=5.20.2" torch accelerate librosa soundfile
Load the model and processor directly from the Hugging Face Hub:
import torch
import soundfile as sf
from transformers import AutoModelForMultimodalLM, AutoProcessor
model_id = "LiquidAI/LFM3-Audio-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 ()
Then ask a question aloud and get a reply in text and speech:
conversation = [
{ "role" : "system" , "content" : "Respond with interleaved text and audio." },
{ "role" : "user" , "content" : [{ "type" : "audio" , "audio" : "question.wav" }]},
{ "role" : "assistant" , "content" : "<|mixed_start|>" },
]
inputs = processor.apply_chat_template(
conversation,
continue_final_message= True ,
tokenize= True ,
return_dict= True ,
return_tensors= "pt" ,
).to(device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens= 1024 ,
audio_temperature= 1.0 ,
audio_top_k= 128 ,
audio_repetition_penalty= 1.1 ,
audio_repetition_window= 4096 ,
return_dict_in_generate= True ,
)
text = processor.decode(
outputs.sequences[ 0 , inputs[ "input_ids" ].shape[ 1 ]:],
skip_special_tokens= True ,
)
waveform = codec.decode(
outputs.audio_codes[: 1 , :, :outputs.audio_lengths[ 0 ]]
).audio_values[ 0 ]
print (text)
sf.write( "reply.wav" , waveform. float ().cpu().numpy(), 24_000 )
See the LFM3-Audio-2B model card for live speech recognition, speech synthesis, audio understanding, and tool calling.
LFM3-Omni-2B
Reach for LFM3-Omni-2B when you need one on-device model that sees, listens, and talks back, in place of a separate ASR model, vision-language model, LLM, and TTS model. It can answer spoken questions about an image, watch and listen to a video together, and turn what it sees and hears into tool calls. It is our first omni model, with text, vision, and audio input and both text and speech output, and it keeps the core capabilities of the standalone LFM3 models, including visual question answering, speech recognition, speech synthesis, and instruction following. Like LFM3-Audio-2B, it speaks through LiquidCodec, which turns generated tokens into speech faster than real time, so spoken replies stream as the model generates them. On audio-visual video understanding, it beats models up to 10.7B parameters, such as Qwen2.5-Omni-7B, on Daily-Omni, WorldSense, and AV-SpeakerBench. You can find more details in the LFM3-Omni-2B model card .
To run LFM3-Omni-2B, install transformers>=5.20.2 with its vision and audio dependencies:
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 ()
Then ask a question about a photo by voice:
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 ,
))
See the LFM3-Omni-2B model card for speech output, video with its soundtrack, and tool calling.
d1-2B and d1-omni-2B
Reach for the d1 models when you need fast, structured decisions instead of generated text. Give them a situation (a support ticket, an invoice, an app screen, a photo, a voice note) and a list of questions, and they answer all of them in a single forward pass, each with a calibrated probability. Beyond yes/no, choices, and scores, they can now point at objects, read values from documents, estimate numbers with a range, and pick every option that applies. You can find more details in the model cards for d1-2B and d1-omni-2B .
Between the two d1 models:
d1-2B : choose it for text, pictures, and video. It replaces d1-3B with a third fewer parameters and scores higher on all four of our decision suites, for example, 75.5 against 64.0 on ImajevBench.
d1-omni-2B : choose it when your inputs include audio. If you ask by voice instead of in writing, it keeps nearly all of its accuracy.
To run d1-2B, install transformers>=5.19 with its vision dependencies:
pip install "transformers>=5.19" torch torchvision pillow
Then load d1-2B and ask it several questions about one support ticket in a single pass:
import torch
from transformers import AutoModel
device = "cuda" if torch.cuda.is_available() else "mps" if torch.backends.mps.is_available() else "cpu"
dtype = torch.float32 if device == "cpu" else torch.bfloat16
model = AutoModel.from_pretrained( "LiquidAI/d1-2B" , trust_remote_code= True , dtype=dtype).to(device)
questions = {
"refund" : { "type" : "noul" , "instructions" : "Is the customer asking for a refund?" },
"team" : { "type" : "choice" , "instructions" : "Which team should handle this?" ,
"criteria" : { "billing" : "Charges, refunds, invoices" , "shipping" : "Delivery and parcels" ,
"technical" : "App or site faults" }},
"topics" : { "type" : "choice" , "multiple" : True , "instructions" : "Which topics does the message raise?" ,
"criteria" : { "billing" : "Payments and charges" , "delivery" : "Shipping and parcels" ,
"login" : "Signing in to the account" }},
"urgency" : { "type" : "score" , "instructions" : "How urgent is this ticket?" , "criteria" : [ "low" , "medium" , "high" ]},
}
out = model.system_one( "I was charged twice and my parcel never arrived. Please refund one charge." , questions)
a = out[ "answers" ]
urgency = a[ "urgency" ][ "legend" ][ str ( int (a[ "urgency" ][ "score" ]))]
print ( round (a[ "refund" ][ "noul" ], 2 ), a[ "team" ][ "choice" ], a[ "topics" ][ "choices" ], urgency)
For brevity, we only include the example for d1-2B. See the d1-omni-2B model card for audio clips and spoken questions.
Fine-tune LFM3 for your task
LFM3 is built to be specialized. Frontier models are powerful generalists, but they are not necessarily experts in your use case. LFM3 packs extra capacity into a small, fast model, so a short fine-tune can turn it into a reliable expert on your task, with your data, terminology, and tools. Because it is small, you can deploy the fine-tuned model where your application runs, from devices to private infrastructure to the cloud.
Every model can be fine-tuned on a single GPU, and these notebooks walk you through a complete task for the text, vision, audio, and omni models, from data preparation to evaluation.
Model
Method
Task
Notebook
LFM3-1.7B
SFT
Extract structured JSON from messy documents
Open in Colab
LFM3-1.7B
DPO
Answer from retrieved documents, or decline
Open in Colab
LFM3-1.7B
GRPO
Call the right tools in a 108-tool phone app
Open in Colab
LFM3-1.7B
CPT
Learn a new language (Turkish) from raw text
Open in Colab
LFM3-VL-2B
SFT
Read receipt photos into JSON
Open in Colab
LFM3-VL-2B
GRPO
Tran
首次收录 · 2026-10-28 · 10.71 分