LFM3-1.7B-int4-ov
Description
This is LFM3-1.7B model converted to the OpenVINO™ IR (Intermediate Representation) format with weights compressed to INT4 by NNCF.
Quantization Parameters
Weight compression was performed using optimum-cli export openvino (nncf.compress_weights) with the following parameters:
- mode: INT4_ASYM
- ratio: 1.0
- group_size: 64
For more information on quantization, check the OpenVINO model optimization guide.
Compatibility
The provided OpenVINO™ IR model is compatible with:
- OpenVINO version 2026.5.0 (currently available as nightly builds) and higher
- OpenVINO GenAI version 2026.5.0 (currently available as nightly builds) and higher
- Optimum Intel with LFM3 support from huggingface/optimum-intel#2087 (until it is merged and released)
Running Model Inference with Optimum Intel
- Install packages required for using Optimum Intel integration with the OpenVINO backend:
pip install "git+https://github.com/huggingface/optimum-intel.git@refs/pull/2087/head" --extra-index-url https://download.pytorch.org/whl/cpu
pip install -U --pre openvino openvino-tokenizers --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly
pip install "transformers==5.20.0"
- Run model inference:
from transformers import AutoTokenizer
from optimum.intel.openvino import OVModelForCausalLM
model_id = "OpenVINO/LFM3-1.7B-int4-ov"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = OVModelForCausalLM.from_pretrained(model_id, trust_remote_code=True)
messages = [{"role": "user", "content": "What is OpenVINO?"}]
inputs = tokenizer.apply_chat_template(
messages, add_generation_prompt=True, enable_thinking=False, return_dict=True, return_tensors="pt"
)
outputs = model.generate(**inputs, max_new_tokens=200)
print(tokenizer.decode(outputs[0, inputs["input_ids"].shape[1] :], skip_special_tokens=True))
Reasoning is enabled by default in the model chat template. Remove
enable_thinking=Falseto let the model think before answering.
For more examples and possible optimizations, refer to the Inference with Optimum Intel.
Running Model Inference with OpenVINO GenAI
- Install packages required for using OpenVINO GenAI.
pip install -U --pre openvino-genai --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly
pip install huggingface_hub
- Download model from HuggingFace Hub
import huggingface_hub as hf_hub
model_id = "OpenVINO/LFM3-1.7B-int4-ov"
model_path = "LFM3-1.7B-int4-ov"
hf_hub.snapshot_download(model_id, local_dir=model_path)
- Run model inference:
import openvino_genai as ov_genai
device = "CPU"
pipe = ov_genai.LLMPipeline(model_path, device)
history = ov_genai.ChatHistory([{"role": "user", "content": "What is OpenVINO?"}])
# Reasoning is enabled by default; disable it for a direct answer.
history.set_extra_context({"enable_thinking": False})
print(pipe.generate(history, max_new_tokens=200))
More GenAI usage examples can be found in OpenVINO GenAI library docs and samples.
You can find more detailed usage examples in OpenVINO Notebooks:
Running Model with OpenAI client and OpenVINO Model Server
Use an OVMS build that includes OpenVINO and OpenVINO GenAI 2026.5.0 or higher with LFM3 support. If the
latestDocker image does not yet include these versions, replace it with a compatible build.
1a. Deploy model on Windows using the binary package:
mkdir C:\models
curl -o ovms.zip https://storage.openvinotoolkit.org/repositories/openvino_model_server/packages/weekly/latest/ovms_windows.zip
tar -xf ovms.zip
ovms.exe --rest_port 8000 --source_model OpenVINO/LFM3-1.7B-int4-ov --model_repository_path C:\models
1b. Deploy model in a Docker container on Linux:
mkdir -p ${HOME}/models
export GPU_ARGS=$(if ls /dev/dri/render* >/dev/null 2>&1; then echo "--device /dev/dri --group-add $(stat -c '%g' /dev/dri/render* | head -n1)"; fi)
docker run -d ${GPU_ARGS} --rm --user $(id -u):$(id -g) -p 8000:8000 -v ${HOME}/models:/models openvino/model_server:latest --rest_port 8000 --source_model OpenVINO/LFM3-1.7B-int4-ov --model_repository_path /models
- Install the client library:
pip install openai
- Wait for the model to load, then run the client:
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="unused")
stream = client.chat.completions.create(
model="OpenVINO/LFM3-1.7B-int4-ov",
messages=[{"role": "user", "content": "What is OpenVINO?"}],
max_tokens=200,
stream=True
)
printing_reasoning_started = False
printing_content_started = False
for chunk in stream:
if not chunk.choices:
continue
delta = chunk.choices[0].delta
content = getattr(delta, "content", None)
reasoning = getattr(delta, "reasoning_content", None)
if content:
if not printing_content_started:
printing_content_started = True
print("\ncontent:\n", end="", flush=True)
print(content, end="", flush=True)
if reasoning:
if not printing_reasoning_started:
printing_reasoning_started = True
print("reasoning_content:\n", end="", flush=True)
print(reasoning, end="", flush=True)
Limitations
Check the original model card for limitations.
Legal information
The original model is distributed under the LFM Open License v1.0. More details can be found in LFM3-1.7B.
Disclaimer
Intel is committed to respecting human rights and avoiding causing or contributing to adverse impacts on human rights. See Intel's Global Human Rights Principles. Intel's products and software are intended only to be used in applications that do not cause or contribute to adverse impacts on human rights.
- Downloads last month
- 70