Skip to content

OCR Changes Merged To development (2026-04-01 to 2026-04-03)

This note summarizes the OCR-facing changes already merged into development, centered on commit 489698e (deepseek reliability hardening).

Use it as a short operator/developer changelog for the April 1-3 rollout.

Runtime reliability

  • DeepSeek multi-GPU OCR now runs through a durable SQLite work queue instead of fragile fixed subprocess assignment.
  • Work items heartbeat while running and are requeued if a worker dies or goes stale.
  • Failed work items now default to one retry (max_attempts=2 total attempts), then become terminal failures for operator follow-up instead of bouncing forever.
  • Repair work is durable too: first-pass batches populate a second repair queue that workers drain after the main queue is empty.
  • Workers are launched in their own process groups so respawn can clean up orphaned runtime processes and recover GPU memory.

Throughput and observability

  • vLLM OCR now renders pages into memory and feeds a bounded render queue directly into inference, removing the temporary image-file round trip.
  • Rendering and inference overlap during the first pass.
  • Empty pages are detected before inference and skipped early.
  • Per-worker runtime JSON, GPU preflight output, GPU telemetry, durable queue state, and the final runtime summary now live under sidecars/ocr_runtime/.
  • Runtime summaries now expose steady-state inference timestamps so long-run throughput can be measured without startup noise.

Output contract and repair behavior

  • Canonical OCR outputs remain one markdown/<stem>.md and one json/metrics/<stem>.metrics.json per source PDF.
  • Page boundaries are annotated with <!-- page:N --> comments alongside the page split markers.
  • Internal shard markdown and shard metrics move under sidecars/ocr_shards/ so downstream stages do not mistake them for canonical outputs.
  • If a repair retry hits the garbage cutoff again, GlossAPI now blanks that page slot instead of preserving the failed garbage text.
  • Repair queue durability and repair execution packing are separate concerns: queue accounting stays item-granular, while workers are allowed to combine multiple repair items into one larger execution batch.

Fresh-node setup implications

  • The runner now auto-discovers wheel-managed CUDA libraries inside the selected DeepSeek virtualenv and prepends them to LD_LIBRARY_PATH.
  • Fresh A100 nodes should be validated first with:
python -m glossapi.scripts.deepseek_runtime_report --repo-root <repo-root>
  • The currently validated fleet baseline is:
  • Ubuntu 22.04.5
  • NVIDIA driver 590.48.01
  • A100 40GB
  • torch 2.10.0+cu130
  • vllm 0.18.0
  • transformers 4.57.6
  • workers_per_gpu=1

Test coverage added with the merge

  • durable queue requeue / retry behavior
  • repair queue enqueue and phase switching
  • repair execution packing
  • worker runtime summaries and runner contracts

What this doc does not cover

This note only summarizes OCR work already merged into development.

It does not describe the still-in-progress branch work for:

  • fresh-node bootstrap hardening beyond development
  • stronger OCR metadata continuity
  • canonical text-bearing OCR parquet outputs
  • additional extract-clean-ocr integration validation