Liquid AI正式推出新一代液体基础模型(LFMs)——LFM3。该系列旨在成为专用智能的起点,将文本、视觉、音频、全模态和决策模型整合至同一个共享主干网络中,参数量均控制在20亿(2B)级别。用户可根据模态需求选择特定模型,利用自有数据在单个GPU上进行微调,并直接部署于应用程序运行的环境中。

相较于前代LFM2系列,LFM3实现了四项关键突破:

  • 每参数效能显著提升:凭借新的三混合架构和训练配方,LFM3-1.7B在参数量减少35%的情况下,性能超越LFM2.5-2.6B。
  • 单一主干支持全模态:基于LFM3-1.7B-Base训练的六个2B级模型涵盖文本、视觉、音频、全模态及决策领域,其中包括首款全模态模型及支持视频输入的视觉模型。
  • 专为边缘计算优化:文本模型在4-bit精度下仅需约1GB内存;自研视觉和音频编码器加速了处理流程;256K上下文窗口支持代理(Agent)在设备端运行。
  • 易于专业化定制:所有模型均支持在单个GPU上进行微调,以适应特定数据、术语及部署环境。

构建更具表现力的主干网络

LFM2验证了短卷积与注意力机制混合架构在设备端的高效性。LFM3通过硬件在环架构搜索技术重新设计架构,以适配高每参数能力和长上下文快速推理需求的代理场景。搜索范围覆盖从手机、Raspberry Pi 5到笔记本电脑、云端CPU/GPU及高通Hexagon NPU等14种设备与后端组合。

LFM3-1.7B-Base包含24层,主要改进包括:

  1. 三混合层混合:由13个门控短卷积、5个滑动窗口注意力(SWA)层(窗口大小256 token)和6个全局注意力层组成。卷积核大小从LFM2的3增加至7。
  2. 头级门控注意力:通过Sigmoid门控缩放每个头的输出,在头部无法提供有用信息时将其关闭,从而抑制损害量化性能的激活异常值。
  3. 部分RoPE(旋转位置编码):全局注意力层仅旋转每个头最高频率的一半,使另一半能匹配任意距离的内容;SWA层保留完整RoPE。
  4. 三明治归一化(Sandwich Norm):对每个块的输入和输出同时进行归一化,保持激活值比例适中。

这些改进在长上下文场景中效果显著。在边缘设备上,LFM3-1.7B的短提示处理能力与LFM2-1.2B相当,而在8K token上下文中速度提升约25%。LFM3-1.7B-Base使用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

视觉和音频模型引入了两个新的自研编码器:

  • 视觉编码器:结合卷积和注意力机制,计算量较前代SigLIP2编码器减少3倍。1.64亿参数的编码器在准确性上与Qwen3.5-2B视觉编码器相当,但浮点运算次数(FLOPs)减少2.2倍。视频处理方面,它将每对采样帧嵌入为一个时间切片,使时间序列长度减半。
  • 音频编码器和LiquidCodec:音频编码器混合滑动窗口注意力和短卷积,具备完全因果性,支持说话时预填充,首token延迟低至50毫秒。LiquidCodec作为新音频分词器,在Apple M4 Max单线程CPU上能以约87倍实时速度将token转换为语音,并支持流式解码。

模型详解与应用

所有模型均在transformers库中运行。

LFM3-1.7B

适用于本地代理运行、工具调用、结构化输出生成或特定领域微调基础。经后置训练,兼容Hermes Agent、Pi和OpenClaw等框架。其参数量比LFM2.5-2.6B少35%,性能更优,尤其在代理任务上:WebArena-Verified得分38.42(前代为3.02),在浏览器和商业应用长任务中超越Qwen3.5-9B。

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

首款支持视频输入的LFM视觉模型,提供设备端视觉理解能力。它在回答前逐步推理,能识别物体及其空间位置关系,为机器人技术奠定基础。参数量1.9B(前代3.1B),在62项视觉基准测试中平均分从57.6提升至71.4,与Gemma 4 12B相当。

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])

LFM3-Audio-2B

适用于笔记本或边缘设备上的语音聊天、识别、合成及18种语言翻译。接受文本或音频输入,输出文本、语音或两者兼有,并能将口头请求转化为工具调用。相比LFM2.5-Audio-1.5B,采用新自研音频编码器和语音编解码器,语音质量更高(UTMOSv2得分3.83 vs 3.22),新增音频理解、通用音频推理和工具调用功能。

pip install "transformers>=5.20.2" torch accelerate librosa soundfile
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-Omni-2B

首款全模态模型,能在设备端“看、听、说”,替代单独的ASR、VLM、LLM和TTS模型。支持文本、视觉和音频输入,以及文本和语音输出。它能回答关于图像的语音问题,共同观看并聆听视频,并将所见所闻转化为工具调用。通过LiquidCodec发声,生成的token能以超实时速度转换为语音,实现流式传输。在Daily-Omni、WorldSense和AV-SpeakerBench等基准测试中,击败参数量高达10.7B的模型(如Qwen2.5-Omni-7B)。

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": "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,
))

d1-2B 和 d1-omni-2B

d1系列模型用于快速结构化决策而非文本生成。提供情境(如支持工单、发票、屏幕截图等)和问题列表后,它们能在单次前向传播中回答所有问题,并提供校准后的概率。支持是非判断、选项选择、评分、物体指向、数值读取及范围估算。

  • d1-2B:适用于文本、图片和视频。参数量仅为d1-3B的三分之一,在ImajevBench上得分75.5(前代64.0)。
  • d1-omni-2B:适用于包含音频的输入。以语音代替书面提问时,能保持几乎全部的准确率。
pip install "transformers>=5.19" torch torchvision pillow
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)

为特定任务微调LFM3

LFM3专为专业化设计,小巧快速的模型结构使其能通过简短微调成为熟悉特定数据、术语和工具的专家。所有模型均可在单个GPU上微调,并部署于从设备到私有基础设施再到云端的任何环境。

模型方法任务教程
LFM3-1.7BSFT从混乱文档中提取结构化JSONColab
LFM3-1.7BDPO根据检索文档回答问题或拒绝Colab
LFM3-1.7BGRPO在拥有108个工具的App中调用正确工具Colab
LFM3-1.7BCPT从原始文本中学习新语言(土耳其语)Colab
LFM3-VL-2BSFT将收据照片读取为JSONColab
LFM3-VL-2BGRPO将公式图片转录为LaTeXColab
LFM3-Audio-2BSFT将语音智能家居命令映射为函数调用Colab
LFM3-Audio-2BSFT教模型一种新声音Colab
LFM3-Omni-2BSFT将语音智能家居命令映射为函数调用Colab
LFM3-Omni-2BSFT回答关于医学图像的语音问题Colab

示例:教导LFM3采取行动

LFM3-VL-2B已被适配为三种互补的机器人模型,分别用于编排、导航和操作。编排器通过工具调用操作机械臂,定位物体、测量深度、调用运动规划器并检查结果。导航器利用RGB观测结果遵循路线描述,仅用五个token预测空间目标和航点轨迹。操作VLA在单次前向传播中将图像、语言和机器人状态映射为连续动作的八步块。在15种具身形态联合训练下,VLA在四个LIBERO套件中实现96.2%的平均成功率,在RoboCasa-GR1桌面任务中达到45.7%,在配备TensorRT FP16的Jetson AGX Orin上生成动作块的时间不到50毫秒。

开始使用LFM3

所有LFM3模型均为开放权重,今日已在Hugging Face上线。

引用

@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},
}