Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ Every inference example must use the correct sampling params from the upstream H
|---|---|---|---|---|---|
| LFM2.5-1.2B-Instruct | 0.1 | 50 | — | — | 1.05 |
| LFM2.5-1.2B-Thinking | 0.1 | 50 | 0.1 | — | 1.05 |
| LFM2.5-8B-A1B | 0.1 | 50 | — | — | 1.05 |
| LFM2.5-8B-A1B | 0.2 | 80 | — | — | 1.05 |
| LFM2-24B-A2B | 0.1 | 50 | — | — | 1.05 |
| LFM2 text + LFM2.5-JP | 0.3 | — | — | 0.15 | 1.05 |
| All VL models | 0.1 | — | — | 0.15 | 1.05 |
Expand Down
41 changes: 37 additions & 4 deletions lfm/models/lfm25-8b-a1b.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

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

LFM2.5-8B-A1B is Liquid AI's Mixture-of-Experts model, combining 8B total parameters with only 1.5B active parameters per forward pass with a 128K context window and chain of thought reasoning. This model delivers exceptional performance in tool calling and agentic tasks while running on-device.

Check warning on line 13 in lfm/models/lfm25-8b-a1b.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

lfm/models/lfm25-8b-a1b.mdx#L13

Did you really mean 'agentic'?

Check warning on line 13 in lfm/models/lfm25-8b-a1b.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai-main) - vale-spellcheck

lfm/models/lfm25-8b-a1b.mdx#L13

Did you really mean 'agentic'?

<div style={{display: 'flex', gap: '0.5rem', margin: '0.5rem 0 1.5rem 0'}}>
<a href="https://huggingface.co/LiquidAI/LFM2.5-8B-A1B" style={{padding: '0.35rem 0.7rem', borderRadius: '4px', fontSize: '0.85rem', fontWeight: 600, textDecoration: 'none', backgroundColor: '#fbbf24'}}><span style={{color: '#000'}}>HF</span></a>
Expand Down Expand Up @@ -39,7 +39,7 @@
</Card>

<Card title="Tool Calling" icon="wrench">
Native function calling for agentic workflows

Check warning on line 42 in lfm/models/lfm25-8b-a1b.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

lfm/models/lfm25-8b-a1b.mdx#L42

Did you really mean 'agentic'?

Check warning on line 42 in lfm/models/lfm25-8b-a1b.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai-main) - vale-spellcheck

lfm/models/lfm25-8b-a1b.mdx#L42

Did you really mean 'agentic'?
</Card>

</CardGroup>
Expand All @@ -49,15 +49,48 @@

<Tabs>
<Tab title="Transformers">
<TextTransformers modelId="LiquidAI/LFM2.5-8B-A1B" samplingParams="do_sample=True, temperature=0.1, top_k=50, repetition_penalty=1.05, "></TextTransformers>
Quick start with Transformers (compatible with `transformers>=5.0.0`):

```python
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer

model_id = "LiquidAI/LFM2.5-8B-A1B"
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,
).to(model.device)

output = model.generate(
input_ids,
do_sample=True,
temperature=0.2,
top_k=80,
repetition_penalty=1.05,
max_new_tokens=8192,
streamer=streamer,
)
```
</Tab>
<Tab title="llama.cpp">
<TextLlamacpp ggufRepo="LiquidAI/LFM2.5-8B-A1B-GGUF" samplingFlags="--temp 0.1 --top-k 50 --repeat-penalty 1.05"></TextLlamacpp>
<TextLlamacpp ggufRepo="LiquidAI/LFM2.5-8B-A1B-GGUF" samplingFlags="--temp 0.2 --top-k 80 --repeat-penalty 1.05"></TextLlamacpp>
</Tab>
<Tab title="vLLM">
<TextVllm modelId="LiquidAI/LFM2.5-8B-A1B" samplingParams="temperature=0.1, top_k=50, repetition_penalty=1.05, "></TextVllm>
<TextVllm modelId="LiquidAI/LFM2.5-8B-A1B" samplingParams="temperature=0.2, top_k=80, repetition_penalty=1.05, " maxTokens="8192"></TextVllm>
</Tab>
<Tab title="SGLang">
<TextSglang modelId="LiquidAI/LFM2.5-8B-A1B" toolCallParser="lfm2"></TextSglang>
<TextSglang modelId="LiquidAI/LFM2.5-8B-A1B" toolCallParser="lfm2" samplingParams={'temperature=0.2,\n extra_body={"top_k": 80, "repetition_penalty": 1.05},'}></TextSglang>
</Tab>
</Tabs>
4 changes: 2 additions & 2 deletions scripts/generate_snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
},
"text-vllm": {
"component_name": "TextVllm",
"props": "{ modelId, samplingParams }",
"props": "{ modelId, samplingParams, maxTokens }",
"replacement_group": "text",
"source": "config",
"sections": [
Expand All @@ -90,7 +90,7 @@
"\n"
'llm = LLM(model="${modelId}")\n'
"\n"
"sampling_params = SamplingParams(${samplingParams}max_tokens=512)\n"
"sampling_params = SamplingParams(${samplingParams}max_tokens=${maxTokens || 512})\n"
"\n"
'output = llm.chat("What is machine learning?", sampling_params)\n'
"print(output[0].outputs[0].text)"
Expand Down
4 changes: 2 additions & 2 deletions snippets/quickstart/text-sglang.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const TextSglang = ({ modelId, toolCallParser }) => (
export const TextSglang = ({ modelId, toolCallParser, samplingParams }) => (
<div>
<p><strong>Install:</strong></p>
<pre className="shiki shiki-themes github-light github-dark" style={{backgroundColor: '#fff', '--shiki-dark-bg': '#24292e', color: '#24292e', '--shiki-dark': '#e1e4e8'}} language="bash">
Expand Down Expand Up @@ -32,7 +32,7 @@ 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?"}],
temperature=0.3,
${samplingParams || "temperature=0.3,"}
)

print(response.choices[0].message.content)`.split('\n').map((line, i) => <span key={i} className="line">{line}{'\n'}</span>)}
Expand Down
4 changes: 2 additions & 2 deletions snippets/quickstart/text-vllm.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const TextVllm = ({ modelId, samplingParams }) => (
export const TextVllm = ({ modelId, samplingParams, maxTokens }) => (
<div>
<p><strong>Install:</strong></p>
<pre className="shiki shiki-themes github-light github-dark" style={{backgroundColor: '#fff', '--shiki-dark-bg': '#24292e', color: '#24292e', '--shiki-dark': '#e1e4e8'}} language="bash">
Expand All @@ -13,7 +13,7 @@ export const TextVllm = ({ modelId, samplingParams }) => (

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

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

output = llm.chat("What is machine learning?", sampling_params)
print(output[0].outputs[0].text)`.split('\n').map((line, i) => <span key={i} className="line">{line}{'\n'}</span>)}
Expand Down
Loading