Instructions to use lm-kit/lightonocr-3-4b-lmk with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use lm-kit/lightonocr-3-4b-lmk with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf lm-kit/lightonocr-3-4b-lmk:F16 # Run inference directly in the terminal: llama cli -hf lm-kit/lightonocr-3-4b-lmk:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf lm-kit/lightonocr-3-4b-lmk:F16 # Run inference directly in the terminal: llama cli -hf lm-kit/lightonocr-3-4b-lmk:F16
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf lm-kit/lightonocr-3-4b-lmk:F16 # Run inference directly in the terminal: ./llama-cli -hf lm-kit/lightonocr-3-4b-lmk:F16
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf lm-kit/lightonocr-3-4b-lmk:F16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf lm-kit/lightonocr-3-4b-lmk:F16
Use Docker
docker model run hf.co/lm-kit/lightonocr-3-4b-lmk:F16
- LM Studio
- Jan
- Ollama
How to use lm-kit/lightonocr-3-4b-lmk with Ollama:
ollama run hf.co/lm-kit/lightonocr-3-4b-lmk:F16
- Unsloth Desktop
- Pi
How to use lm-kit/lightonocr-3-4b-lmk with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf lm-kit/lightonocr-3-4b-lmk:F16
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "lm-kit/lightonocr-3-4b-lmk:F16" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use lm-kit/lightonocr-3-4b-lmk with Docker Model Runner:
docker model run hf.co/lm-kit/lightonocr-3-4b-lmk:F16
- Lemonade
How to use lm-kit/lightonocr-3-4b-lmk with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull lm-kit/lightonocr-3-4b-lmk:F16
Run and chat with the model
lemonade run user.lightonocr-3-4b-lmk-F16
List all available models
lemonade list
- Hermes Agent
How to use lm-kit/lightonocr-3-4b-lmk with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf lm-kit/lightonocr-3-4b-lmk:F16
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default lm-kit/lightonocr-3-4b-lmk:F16
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use lm-kit/lightonocr-3-4b-lmk with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf lm-kit/lightonocr-3-4b-lmk:F16
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "lm-kit/lightonocr-3-4b-lmk:F16" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
LightOnOCR 3 4B for LM-Kit
This repository holds LightOnOCR-3-4B packaged for LM-Kit.NET, LM-Kit's on-device AI SDK for .NET, and for LM-Kit One.
| File | Content |
|---|---|
lightonocr-3-4b-Q4_K_M.lmk |
The model and its vision projector, both quantized to Q4_K_M, in one archive. This is the file LM-Kit downloads. |
lightonocr-3-4b-F16.gguf |
The language model at full precision (F16). |
lightonocr-3-4b-mmproj-F16.gguf |
The vision projector at full precision (F16). |
About LightOnOCR 3
LightOnOCR 3 is LightOn's third generation of end-to-end OCR models. It comes in three sizes:
| LM-Kit model ID | Architecture | Notes |
|---|---|---|
lightonocr-3:0.8b |
Qwen3.5 vision-language | The fastest size |
lightonocr-3:1b |
LightOnOCR 2 (Pixtral vision encoder, Qwen3 decoder) | A drop-in upgrade for LightOnOCR 2 deployments |
lightonocr-3:4b |
Qwen3.5 vision-language | The most accurate size |
The models have two modes:
- Transcription: the page is returned as clean Markdown in natural reading order, with tables in HTML and formulas in LaTeX.
- Grounding: every block of the page is returned with a label (title, text, list, table, formula, caption, header, footer, page number, footnote, image, chart, ...) and a bounding box. Images get a short description, and charts become an HTML table of their data points.
LM-Kit maps both modes onto VlmOcr intents, so you never write a prompt:
VlmOcrIntent |
Mode | Result |
|---|---|---|
Markdown, PlainText |
Transcription | The page text |
OcrWithCoordinates |
Grounding | The page's text blocks, each with its bounding box in source image pixels and its layout category |
LayoutAnalysis |
Grounding | Every block, figures included, with its category; the JSON payload in VlmOcrResult.NormalizedText |
TableRecognition, FormulaRecognition, ChartRecognition |
Grounding | The page's tables, formulas or chart data tables |
Pages are fed at the resolution the models were trained on (a 2048 px longest edge at ImageDetail.High).
Usage
using LMKit.Document.Conversion;
using LMKit.Extraction.Ocr;
using LMKit.Model;
LM model = LM.LoadFromModelID("lightonocr-3:4b");
// Document to Markdown.
var converter = new DocumentToMarkdown(model);
string markdown = converter.Convert("report.pdf").Markdown;
// Layout analysis: positioned, categorized blocks.
var ocr = new VlmOcr(model, VlmOcrIntent.LayoutAnalysis);
var result = ocr.Run(new LMKit.Data.Attachment("page.png"));
foreach (var element in result.PageElement.TextElements)
{
Console.WriteLine($"{element.Category} at ({element.Left:0}, {element.Top:0}): {element.Text}");
}
License
The model weights are released by LightOn under the Apache License 2.0. See the original model card for training details and the authors' evaluation.
- Downloads last month
- 38
16-bit
Model tree for lm-kit/lightonocr-3-4b-lmk
Base model
lightonai/LightOnOCR-3-4B