Skip to main content
Conversations are formatted using special tokens:
  • <|startoftext|> — Start of the conversation.
  • <|im_start|> — Start of the message. Always followed by the role name (system, user, assistant, or tool) and a line break.
  • <|im_end|> — End of the message.
  • <think> / </think> — Start and end of the model’s reasoning, at the beginning of an assistant turn.
LFM3 supports four conversation roles:
  • system — (Optional) Defines who the assistant is and how it should respond.
  • user — Messages from the user containing questions and instructions.
  • assistant — Responses from the model.
  • tool — Results from tool/function execution. Used for tool use workflows.
The complete chat template definition can be found in the chat_template.jinja file in each model’s Hugging Face repository.
Using LFM2 or LFM2.5? See LFM2 and LFM2.5 for their chat template.

Text Models

We recommend storing your conversation as a list of dictionaries as follows:
You can then apply LFM3’s chat template using the .apply_chat_template() method from Transformers:
Output:

Reasoning

Reasoning is enabled by default, so the template opens every assistant turn with <think>. Set enable_thinking=False in apply_chat_template() for direct answers. Reasoning from turns before the latest user message is removed unless preserve_thinking=True.

Vision Models

LFM3-VL models follow the same chat template with additional support for images and videos. Each image is rendered as <|vision_start|><|image|><|vision_end|> and each video as <|vision_start|><|video|><|vision_end|>. The processor’s .apply_chat_template() method inserts these tokens automatically, so do not include them in your message content.
Output:

Audio and Omni Models

LFM3-Omni follows the same chat template. Every input audio clip, image, and video sits inside a <|vision_start|> / <|vision_end|> span, which apply_chat_template() inserts for you. Audio clips render as <|vision_start|><|audio|><|vision_end|>.
In the answer, <|audio_start|> opens speech and <|mixed_start|> opens interleaved text and speech. LFM3-Omni-2B is a non-reasoning model: its template opens every assistant turn with an empty <think></think> block. See LFM3-Audio-2B and LFM3-Omni-2B for the recommended system prompts.

LFM2 and LFM2.5

LFM2 and LFM2.5 use a ChatML-like chat template without the <think> prefill:

LFM2 Text Models

We recommend storing your conversation as a list of dictionaries as follows:
You can then apply LFM2’s chat template using the .apply_chat_template() method from Transformers:
Output:

LFM2 Vision Models

LFM2-VL models follow the same chat template with additional support for images. When formatted, images are represented with a sentinel token (<image>), which is automatically replaced with image tokens by the processor. When creating conversations for vision models, use a structured format with content as a list containing image and text entries:
You can then apply the chat template using the processor’s .apply_chat_template() method:
Output: