> ## Documentation Index
> Fetch the complete documentation index at: https://docs.liquid.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# LFM2.5-24B-A2B

> 24B parameter Mixture-of-Experts reasoning model with 2B active parameters and 131K context, built for fast, private agents on-device

export const TextSglang = ({modelId, toolCallParser, samplingParams}) => <div>
<p><strong>Install:</strong></p>
<CodeBlock language="bash">
{`uv pip install "sglang>=0.5.10"`}
</CodeBlock>
<p><strong>Launch server:</strong></p>
<CodeBlock language="bash">
{toolCallParser ? `sglang serve \\
    --model-path ${modelId} \\
    --host 0.0.0.0 \\
    --port 30000 \\
    --tool-call-parser ${toolCallParser}` : `sglang serve \\
    --model-path ${modelId} \\
    --host 0.0.0.0 \\
    --port 30000`}
</CodeBlock>
<p><strong>Query (OpenAI-compatible):</strong></p>
<CodeBlock language="python">
{`from openai import OpenAI

client = OpenAI(base_url="http://localhost:30000/v1", api_key="None")

response = client.chat.completions.create(
    model="${modelId}",
    messages=[{"role": "user", "content": "What is machine learning?"}],
    ${samplingParams || "temperature=0.3,"}
)

print(response.choices[0].message.content)`}
</CodeBlock>
</div>;

export const TextVllm = ({modelId, samplingParams, maxTokens}) => <div>
<p><strong>Install:</strong></p>
<CodeBlock language="bash">
{`pip install vllm==0.14`}
</CodeBlock>
<p><strong>Run:</strong></p>
<CodeBlock language="python">
{`from vllm import LLM, SamplingParams

llm = LLM(model="${modelId}")

sampling_params = SamplingParams(${samplingParams}max_tokens=${maxTokens || 512})

output = llm.chat("What is machine learning?", sampling_params)
print(output[0].outputs[0].text)`}
</CodeBlock>
</div>;

export const TextLlamacpp = ({ggufRepo, samplingFlags}) => <div>
<p><strong>Install:</strong></p>
<CodeBlock language="bash">
{`brew install llama.cpp`}
</CodeBlock>
<p><strong>Run:</strong></p>
<CodeBlock language="bash">
{`llama-cli -hf ${ggufRepo} --conversation \\
    ${samplingFlags}`}
</CodeBlock>
<p>The <code>-hf</code> flag downloads the model directly from Hugging Face. For other installation methods and advanced usage, see the <a href="/deployment/on-device/llama-cpp">llama.cpp guide</a>.</p>
</div>;

<a href="/lfm/models/text-models" className="back-button">← Back to Text Models</a>

LFM2.5-24B-A2B is Liquid AI's largest Mixture-of-Experts model, combining 24B total parameters with only 2B active parameters per token and a 131K context window. It is a reasoning model that always thinks before it answers, post-trained for tool calling and multi-step agentic tasks on-device.

<div style={{display: 'flex', gap: '0.5rem', margin: '0.5rem 0 1.5rem 0'}}>
  <a href="https://huggingface.co/LiquidAI/LFM2.5-24B-A2B" style={{padding: '0.35rem 0.7rem', borderRadius: '4px', fontSize: '0.85rem', fontWeight: 600, textDecoration: 'none', backgroundColor: '#fbbf24'}}><span style={{color: '#000'}}>HF</span></a>
  <a href="https://huggingface.co/LiquidAI/LFM2.5-24B-A2B-Base" style={{padding: '0.35rem 0.7rem', borderRadius: '4px', fontSize: '0.85rem', fontWeight: 600, textDecoration: 'none', backgroundColor: '#fdba74'}}><span style={{color: '#000'}}>Base</span></a>
  <a href="https://huggingface.co/LiquidAI/LFM2.5-24B-A2B-GGUF" style={{padding: '0.35rem 0.7rem', borderRadius: '4px', fontSize: '0.85rem', fontWeight: 600, textDecoration: 'none', backgroundColor: '#60a5fa'}}><span style={{color: '#000'}}>GGUF</span></a>
  <a href="https://huggingface.co/LiquidAI/LFM2.5-24B-A2B-MLX-8bit" style={{padding: '0.35rem 0.7rem', borderRadius: '4px', fontSize: '0.85rem', fontWeight: 600, textDecoration: 'none', backgroundColor: '#c4b5fd'}}><span style={{color: '#000'}}>MLX</span></a>
  <a href="https://huggingface.co/LiquidAI/LFM2.5-24B-A2B-ONNX" style={{padding: '0.35rem 0.7rem', borderRadius: '4px', fontSize: '0.85rem', fontWeight: 600, textDecoration: 'none', backgroundColor: '#86efac'}}><span style={{color: '#000'}}>ONNX</span></a>
</div>

## Specifications

| Property | Value |
| - | - |
| Parameters | 24B (2B active) |
| Context Length | 131K tokens |
| Architecture | LFM2.5 (MoE), 40 layers (30 gated short convolution + 10 GQA), 64 experts per MoE block with top-4 routing |
| Vocabulary Size | 128K |
| Languages | English, Arabic, Chinese, French, German, Italian, Japanese, Korean, Portuguese, Spanish, Vietnamese, Thai, Indonesian, Hindi, Russian, Polish |
| Generation Parameters | `temperature=0.1`, `top_k=50`, `repetition_penalty=1.05` |

<div className="use-cases">
  <CardGroup cols={3}>
    <Card title="Local Agents" icon="robot">
      Post-trained inside agent harnesses for reliable tool calling
    </Card>

    <Card title="Reasoning" icon="brain">
      Thinks before it answers, at 2B active cost per token
    </Card>

    <Card title="131K Context" icon="text-width">
      Long agent trajectories, documents, and conversations
    </Card>
  </CardGroup>
</div>

## Quick Start

<Tabs>
  <Tab title="Transformers">
    Quick start with Transformers (compatible with `transformers>=5.0.0`):

    ```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
    from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer

    model_id = "LiquidAI/LFM2.5-24B-A2B"
    model = AutoModelForCausalLM.from_pretrained(
        model_id,
        device_map="auto",
        dtype="bfloat16",
    #   attn_implementation="flash_attention_2" <- uncomment on compatible GPU
    )
    tokenizer = AutoTokenizer.from_pretrained(model_id)
    streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)

    prompt = "What is C. elegans?"

    input_ids = tokenizer.apply_chat_template(
        [{"role": "user", "content": prompt}],
        add_generation_prompt=True,
        return_tensors="pt",
        tokenize=True,
    )["input_ids"].to(model.device)

    output = model.generate(
        input_ids,
        do_sample=True,
        temperature=0.1,
        top_k=50,
        repetition_penalty=1.05,
        max_new_tokens=512,
        streamer=streamer,
    )
    ```
  </Tab>

  <Tab title="llama.cpp">
    <TextLlamacpp ggufRepo="LiquidAI/LFM2.5-24B-A2B-GGUF" samplingFlags="--temp 0.1 --top-k 50 --repeat-penalty 1.05" />
  </Tab>

  <Tab title="MLX">
    **Install** (requires `mlx-lm>=0.32.0`, earlier versions route the experts incorrectly):

    ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
    pip install -U "mlx-lm>=0.32.0"
    ```

    **Run:**

    ```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
    from mlx_lm import load, generate
    from mlx_lm.sample_utils import make_sampler, make_logits_processors

    model, tokenizer = load("LiquidAI/LFM2.5-24B-A2B-MLX-4bit")

    prompt = "What is C. elegans?"

    if tokenizer.chat_template is not None:
        messages = [{"role": "user", "content": prompt}]
        prompt = tokenizer.apply_chat_template(
            messages, add_generation_prompt=True
        )

    sampler = make_sampler(temp=0.1, top_k=50)
    logits_processors = make_logits_processors(repetition_penalty=1.05)

    response = generate(
        model, tokenizer, prompt=prompt, max_tokens=4096,
        sampler=sampler, logits_processors=logits_processors,
        verbose=True,
    )
    ```

    5-bit, 6-bit, and 8-bit builds are also available: [MLX-5bit](https://huggingface.co/LiquidAI/LFM2.5-24B-A2B-MLX-5bit), [MLX-6bit](https://huggingface.co/LiquidAI/LFM2.5-24B-A2B-MLX-6bit), [MLX-8bit](https://huggingface.co/LiquidAI/LFM2.5-24B-A2B-MLX-8bit).
  </Tab>

  <Tab title="vLLM">
    <TextVllm modelId="LiquidAI/LFM2.5-24B-A2B" samplingParams="temperature=0.1, top_k=50, repetition_penalty=1.05, " maxTokens="4096" />
  </Tab>

  <Tab title="SGLang">
    <TextSglang modelId="LiquidAI/LFM2.5-24B-A2B" toolCallParser="lfm2" samplingParams={'temperature=0.1,\n    extra_body={"top_k": 50, "repetition_penalty": 1.05},'} />
  </Tab>
</Tabs>

## Reasoning

Unlike LFM2-24B-A2B, LFM2.5-24B-A2B always thinks before it answers. The chat template opens every assistant turn with a `<think>` tag, so responses contain an explicit chain of thought before the final answer. Leave enough room in your max token budget for the reasoning trace. See [Chat Template](/lfm/key-concepts/chat-template) and [Tool Use](/lfm/key-concepts/tool-use) for the message format.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.