Skip to content

Add LFM2.5-VL 3B as a curated llama.cpp OCR model with its own prompt - #14552

Merged
niksedk merged 1 commit into
mainfrom
claude/lfm2-5-ocr-evaluation-83a716
Sep 5, 2026
Merged

Add LFM2.5-VL 3B as a curated llama.cpp OCR model with its own prompt#14552
niksedk merged 1 commit into
mainfrom
claude/lfm2-5-ocr-evaluation-83a716

Conversation

@niksedk

@niksedk niksedk commented Sep 5, 2026

Copy link
Copy Markdown
Member

Adds LiquidAI/LFM2.5-VL-3B-GGUF (Q8_0 + Q8_0 mmproj, 3.5 GB) to the curated llama.cpp OCR model list, ranked second behind GLM-OCR.

Why

Measured 2026-09-05 on the 14-image subtitle corpus (EN/DE/FR/ES/IT/RU/ZH/JA, ♪ cue, SDH # cue, italics, two video-frame burn-ins, small strip), SE's flags/square-pad/temperature 0, llama.cpp b10507:

Model / prompt Exact Text-only Breaks lost ♪ lost Char error s/img
GLM-OCR 0.9B, shared prompt 12/14 13/14 1 0 0.18% 1.3
LFM2.5-VL 3B, shared prompt 0/14 0/14 0 1 6.0% 2.2
LFM2.5-VL 3B, its own prompt 13/14 14/14 0 0 0.00% 3.4

Character recognition is flawless, but it is a general instruction-following VLM: given the shared prompt's "Identify the number of lines, then..." it answers with a bare 2 line before the text, every time, and it drops ♪ unless the prompt mentions symbols. Its one miss with the tuned prompt over-splits a line; it never merges.

How

  • SeOcrDefaults.LlamaCppOcrPromptLfm25Vl and a PromptTemplate on the model entry (reusing the field the translate models already have).
  • LlamaCppServerManager.ResolveOcrPrompt(model, userPrompt): the model's prompt applies only while the shared OCR prompt is still the default. A user who edited the shared prompt drives every model with it, and the prompt box never changes under them, so the earlier per-model-prompt objection does not apply.
  • Wired at the four entry points: OCR window, Video OCR, batch convert, seconv (both local-server and --ocr-url modes; --ocr-prompt still overrides).
  • Tests: LlamaCppOcrPromptResolveTests (6) plus the existing order/mmproj guards.
  • Docs: ocr.md, video-ocr.md, batch-convert.md, command-line.md.

Verified end to end with seconv on a real Blu-ray .sup: no count prefix, line breaks intact.

🤖 Generated with Claude Code

LFM2.5-VL-3B (Liquid AI, Q8_0 + mmproj) measured on the 14-image subtitle
corpus: 0.00% character error across all eight scripts, italics, busy video
backgrounds and small text, where GLM-OCR misreads one Russian word. It is a
general instruction-following vision model, though, and answers the shared
OCR prompt's "identify the number of lines" clause literally - every result
began with a bare "2" line - and drops ♪ marks unless the prompt names them.

So it ships with its own PromptTemplate (13/14 exact, 14/14 text-only, no
merged lines, ♪ kept) and a new LlamaCppServerManager.ResolveOcrPrompt that
applies a model's prompt only while the user's shared prompt is still the
default; an edited shared prompt drives every model. Wired at all four OCR
entry points (OCR window, Video OCR, batch convert, seconv). Ranked second
behind GLM-OCR: 2.5x the download and ~2.5x slower per image.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@niksedk
niksedk merged commit 5a49080 into main Sep 5, 2026
1 check passed
@niksedk
niksedk deleted the claude/lfm2-5-ocr-evaluation-83a716 branch September 5, 2026 06:25
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.

1 participant