Skip to content

add guides section and fine-tuning overview#115

Merged
alay2shah merged 10 commits into
mainfrom
add-guides-section
Jul 9, 2026
Merged

add guides section and fine-tuning overview#115
alay2shah merged 10 commits into
mainfrom
add-guides-section

Conversation

@iamleonie

Copy link
Copy Markdown
Contributor
  • Added a new Guides section under the LFM sidebar, placed below Cloud Inference.
  • Added three new guide pages
    • /guides/hardware-evaluation
    • /guides/use-case-evaluation
    • /guides/migration-guide
  • Added a new Fine-tuning Overview page at /lfm/fine-tuning/overview.
    • Made Fine-tuning Overview the first page in the Fine-tuning sidebar section.
    • Updated /lfm/fine-tuning to redirect to the new Overview page.
  • Updated SGLang migration guidance to match the existing SGLang docs command and lfm2 tool-call parser.
  • Standardized LFM2.5-8B-A1B wording to 1.5B active parameters.

@iamleonie iamleonie requested a review from alay2shah July 9, 2026 10:47
@mintlify

mintlify Bot commented Jul 9, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
liquid-docs 🟢 Ready View Preview Jul 9, 2026, 10:50 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@alay2shah alay2shah left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good after the latest updates.

@alay2shah alay2shah merged commit 12a7d98 into main Jul 9, 2026
8 checks passed
@alay2shah alay2shah deleted the add-guides-section branch July 9, 2026 21:08

@mlabonne mlabonne left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are factual mistakes in the content we need to fix and re-deploy.

We also cannot stretch the maintenance surface that much, even if GTM maintains these pages.


Migration notes:

- **From Qwen:** ChatML is familiar, but token details differ. Use `apply_chat_template`; do not reuse literal Qwen strings.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +16 to +20
| Qwen3-0.6B, Llama-3.2-1B, Gemma-3-270M/1B | [LFM2.5-350M](https://huggingface.co/LiquidAI/LFM2.5-350M) | Classification, extraction, routing. Also consider LFM2.5-230M. |
| Qwen3-1.7B, Llama-3.2-3B, Gemma-3-4B | [LFM2.5-1.2B-Instruct](https://huggingface.co/LiquidAI/LFM2.5-1.2B-Instruct) | The default dense workhorse. |
| Qwen3-4B/8B, Llama-3.1-8B, Gemma-3-12B | [LFM2.5-8B-A1B](https://huggingface.co/LiquidAI/LFM2.5-8B-A1B) | MoE with 8B total and 1.5B active parameters. |
| Qwen3-14B/32B and larger dense models | [LFM2-24B-A2B](https://huggingface.co/LiquidAI/LFM2-24B-A2B) | 24B total and roughly 2.3B active parameters. |
| Qwen3 thinking mode or DeepSeek distills | [LFM2.5-1.2B-Thinking](https://huggingface.co/LiquidAI/LFM2.5-1.2B-Thinking) | Reasoning traces at 1.2B. |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is super accurate. I would bundle the 230M and 350M together. Same with 1.2B Instruct and Thinking (just depends on the acceptable latency). Same with the 2.6B and 8B-A1B.


See the [Complete Model Library](/lfm/models/complete-library) for the full catalog.

LFM2.5 dense models support 32K context, and LFM2.5-8B-A1B supports 128K. If you rely on 128K context in a small dense Qwen or Llama model, check your production context distribution before assuming this is a blocker. Most sub-8B deployments do not exceed 8K tokens.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too model-specific, too hard to maintain.

Comment on lines +46 to +149
<Tabs>
<Tab title="Transformers">
Change the model ID and use the model's chat template:

```python
from transformers import AutoModelForCausalLM, AutoTokenizer

model_id = "LiquidAI/LFM2.5-1.2B-Instruct"
model = AutoModelForCausalLM.from_pretrained(
model_id,
dtype="bfloat16",
device_map="auto",
)
tokenizer = AutoTokenizer.from_pretrained(model_id)

inputs = tokenizer.apply_chat_template(
[{"role": "user", "content": "What is C. elegans?"}],
add_generation_prompt=True,
return_tensors="pt",
return_dict=True,
).to(model.device)

out = model.generate(
**inputs,
max_new_tokens=512,
do_sample=True,
temperature=0.1,
top_k=50,
repetition_penalty=1.05,
)
```

Do not reuse literal Llama-style or Gemma-style prompt strings. They will usually run, but quality will degrade.

See [Transformers](/deployment/gpu-inference/transformers).
</Tab>

<Tab title="vLLM">
Serve the model behind an OpenAI-compatible endpoint:

```bash
vllm serve LiquidAI/LFM2.5-1.2B-Instruct
```

Your OpenAI-client code stays mostly unchanged:

```python
client.chat.completions.create(
model="LiquidAI/LFM2.5-1.2B-Instruct",
messages=messages,
temperature=0.1,
extra_body={"top_k": 50, "repetition_penalty": 1.05},
)
```

If you use OpenAI-style `tools=[...]`, configure the LFM tool-call parser before switching traffic. See [Tool calling](#tool-calling) below and the [vLLM guide](/deployment/gpu-inference/vllm).
</Tab>

<Tab title="SGLang">
Serve the model through SGLang's OpenAI-compatible API and keep your client integration mostly unchanged:

```bash
sglang serve --model-path LiquidAI/LFM2.5-1.2B-Instruct --tool-call-parser lfm2
```

Use LFM sampling defaults and configure the LFM tool-call parser if your evaluation includes tools.

See [SGLang](/deployment/gpu-inference/sglang).
</Tab>

<Tab title="llama.cpp">
Pull the official GGUF and choose the quantization level you plan to deploy:

```bash
llama-server -hf LiquidAI/LFM2.5-1.2B-Instruct-GGUF:Q4_K_M
```

The GGUF embeds the correct chat template. Do not override it with an old Qwen or Llama template.

See [llama.cpp](/deployment/on-device/llama-cpp).
</Tab>

<Tab title="Ollama / LM Studio">
Use the official GGUF artifact and keep the embedded chat template:

```bash
ollama run hf.co/LiquidAI/LFM2.5-1.2B-Instruct-GGUF:Q4_K_M
```

If you are using LM Studio, select the matching GGUF quantization and avoid overriding the prompt template with a previous Qwen, Llama, or Gemma template.

See [Ollama](/deployment/on-device/ollama) and [LM Studio](/deployment/on-device/lm-studio).
</Tab>

<Tab title="MLX / ONNX">
Per-precision repos exist for each model, including `-MLX-4bit` through `-MLX-8bit` and `-ONNX`. Swap the repo ID in `mlx-lm` or your ONNX Runtime pipeline.

See [MLX](/deployment/on-device/mlx) and [ONNX](/deployment/on-device/onnx).
</Tab>

<Tab title="LEAP SDK">
The [LEAP SDK](/deployment/on-device/sdk/quick-start) gives iOS and Android apps a supported runtime with function calling and constrained generation included.
</Tab>
</Tabs>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should really reuse existing code blocks instead of re-writing them here because it will be a nightmare to maintain

Comment on lines +175 to +177
| `temperature` | `0.1` | `0.6` to `0.7`, which can cause drift |
| `top_k` | `50` | disabled |
| `repetition_penalty` | `1.05` | `1.0` |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our gen parameters are actually model-specific so it's not correct :(


What to do:

1. Pass tools through `tokenizer.apply_chat_template(messages, tools=[...])` or the serving runtime's supported tool mechanism.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also maybe link it to the relevant section in apply_chat_template()


1. Pass tools through `tokenizer.apply_chat_template(messages, tools=[...])` or the serving runtime's supported tool mechanism.
2. Parse the Pythonic call list between `<|tool_call_start|>` and `<|tool_call_end|>`.
3. On vLLM or SGLang, configure the LFM tool-call parser instead of a generic JSON parser.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the correct name is "lfm2" (to verify)

2. Parse the Pythonic call list between `<|tool_call_start|>` and `<|tool_call_end|>`.
3. On vLLM or SGLang, configure the LFM tool-call parser instead of a generic JSON parser.
4. Return results as `tool` role messages, with JSON content if useful.
5. For strict schemas, use constrained decoding. See [Constrained Generation](/deployment/on-device/sdk/constrained-generation).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure this is worth mentioning here

3. On vLLM or SGLang, configure the LFM tool-call parser instead of a generic JSON parser.
4. Return results as `tool` role messages, with JSON content if useful.
5. For strict schemas, use constrained decoding. See [Constrained Generation](/deployment/on-device/sdk/constrained-generation).
6. If you fine-tune for tool calling, train on the native Pythonic format and convert to any internal DSL after parsing.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DSL is never defined 👀

Comment thread guides/migration-guide.mdx Outdated
- [ ] Chat template comes from the model
- [ ] Sampling updated for LFM defaults
- [ ] Tool parser configured if tool calling is in scope
- [ ] Context length validated against production p95

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We haven't talked about this, right?

@iamleonie

Copy link
Copy Markdown
Contributor Author

Review findings addressed in #116

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants