Image-Text-to-Text
Safetensors
MLX
mlx-vlm
qwen3_5
ocr
vision-language
document-understanding
grounding
conversational
4-bit precision
Instructions to use AnandSingh/LightOnOCR-3-4B-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use AnandSingh/LightOnOCR-3-4B-4bit with MLX:
# Make sure mlx-vlm is installed # pip install --upgrade mlx-vlm from mlx_vlm import load, generate from mlx_vlm.prompt_utils import apply_chat_template from mlx_vlm.utils import load_config # Load the model model, processor = load("AnandSingh/LightOnOCR-3-4B-4bit") config = load_config("AnandSingh/LightOnOCR-3-4B-4bit") # Prepare input image = ["http://images.cocodataset.org/val2017/000000039769.jpg"] prompt = "Describe this image." # Apply chat template formatted_prompt = apply_chat_template( processor, config, prompt, num_images=1 ) # Generate output output = generate(model, processor, formatted_prompt, image) print(output) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use AnandSingh/LightOnOCR-3-4B-4bit with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "AnandSingh/LightOnOCR-3-4B-4bit"
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "AnandSingh/LightOnOCR-3-4B-4bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent
How to use AnandSingh/LightOnOCR-3-4B-4bit with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "AnandSingh/LightOnOCR-3-4B-4bit"
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 AnandSingh/LightOnOCR-3-4B-4bit
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use AnandSingh/LightOnOCR-3-4B-4bit with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "AnandSingh/LightOnOCR-3-4B-4bit"
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 "AnandSingh/LightOnOCR-3-4B-4bit" \ --custom-provider-id mlx-lm \ --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 — MLX 4-bit
4-bit quantized mlx-vlm weights of
lightonai/LightOnOCR-3-4B
for native inference on Apple Silicon. The model is a Qwen3.5 vision-language
OCR model (model_type: qwen3_5) — runs on mlx-vlm ≥ 0.6.5 with no patches.
Use
pip install -U "mlx-vlm>=0.6.5"
# Transcription (default — call with an empty prompt for full-page Markdown)
mlx_vlm.generate --model AnandSingh/LightOnOCR-3-4B-4bit \
--image receipt.jpeg --prompt "" --max-tokens 2048 --temperature 0.2 --top-p 0.9
# Grounding — every block returned with a label + bounding box (0–1000 coords),
# images described, charts emitted as HTML data tables
mlx_vlm.generate --model AnandSingh/LightOnOCR-3-4B-4bit \
--image page.png --prompt "grounding" --max-tokens 4096 --temperature 0.2 --top-p 0.9
from mlx_vlm import load, generate
from mlx_vlm.prompt_utils import apply_chat_template
model, processor = load("AnandSingh/LightOnOCR-3-4B-4bit")
prompt = apply_chat_template(processor, model.config, "grounding", num_images=1)
result = generate(model, processor, prompt, image=["page.png"],
max_tokens=4096, temperature=0.2, top_p=0.9)
print(result.text)
Prompt modes
| Mode | Prompt | Output |
|---|---|---|
| Transcription | "" (empty) |
All page text as Markdown |
| Grounding | "grounding" |
Blocks prefixed  (0–1000 page coords) |
Thinking is off by default (matches training); apply_chat_template sets
enable_thinking=False automatically. Other prompts are out-of-distribution.
Details / quant
- Precision: 4-bit affine, group size 64, mixed policy (~5.3 bits/weight effective; norms, embeddings, vision kept higher) → ~3 GB file.
- Measured on Apple M4 (25 GB): ~37 tok/s decode, ~3.7 GB peak memory, 600+ tokens for a receipt page.
- BF16 reference for this model:
AnandSingh/LightOnOCR-3-4B-bf16.
Tips
- Render PDFs at 400 DPI, then resize the longest edge to 2048 px (aspect preserved). The bundled Qwen3-VL processor handles patch/merge sizing.
License
Model weights: Apache-2.0 (per source). Quantized MLX conversion provided as-is.
- Downloads last month
- 177
Model size
5B params
Tensor type
U32
·
BF16 ·
Hardware compatibility
Log In to add your hardware
4-bit
Model tree for AnandSingh/LightOnOCR-3-4B-4bit
Base model
lightonai/LightOnOCR-3-4B