DeepSeek’s official repository records the DeepSeek-OCR 2 release on January 27, 2026. The model can become one stage of a document pipeline, but it does not replace source provenance, PDF rendering, schema validation, and human review. The official environment calls for specific CUDA, PyTorch, vLLM, and FlashAttention combinations. Without suitable hardware, do not invent execution results; build the pipeline contract around a mock first.

Keep the source immutable

When a PDF or image arrives, compute SHA-256 and record byte count, detected MIME type, receipt time, and product origin. Put the original object in read-only storage and make every derived artifact reference its hash. A filename and uploader-declared content type are not trustworthy. Reject encrypted, oversized, excessive-page, and unsupported files before model work.

from dataclasses import dataclass
from hashlib import sha256
from pathlib import Path

@dataclass(frozen=True)
class SourceDocument:
    path: Path
    sha256: str
    size: int

def register_source(path: Path) -> SourceDocument:
    data = path.read_bytes()
    return SourceDocument(path=path, sha256=sha256(data).hexdigest(), size=len(data))

A production implementation hashes as a stream instead of loading a large object into memory. The upload directory is non-executable. Parse PDFs in a sandboxed process with CPU, memory, and wall-time bounds, because a parser sees attacker-controlled bytes before the model does.

Version page rendering separately

Render a PDF to page images using a pinned renderer. Record page number, DPI, color space, rotation, and crop. The model should not silently define page boundaries. Rendering failure, blank pages, and abnormal dimensions need explicit states. A source hash plus renderer version and parameters creates a cacheable page artifact.

Denoising, deskewing, tiling, and resizing change model input. Give preprocessing its own configuration hash and preserve the relationship between original and transformed page. A reviewer must be able to see what the model saw. Do not add an undocumented manual crop to improve one evaluation example.

Protect against decompression bombs and enormous pixel dimensions. A ten-megabyte compressed image can require far more memory after decoding. Enforce limits on decoded shape before placing it in a GPU batch.

Pin model and execution environment

Record the model repository revision, weight hash, code revision, prompt, generation configuration, CUDA, driver, PyTorch, inference runtime, and GPU type. trust_remote_code=True executes Python from the model repository. Pin a revision, review the code, and run it in isolation; never trust a moving default branch by habit.

Official hardware and throughput figures describe an official setup, not your service-level objective. Measure representative pages for GPU memory, per-page latency, batching, failures, and output size. Reject unsupported CPU or small-GPU configurations clearly rather than allowing a job to stall forever.

Warm-up, compilation, and model-loading time are separate from steady-state inference. Report them separately so a batch worker and an interactive endpoint are not compared with misleading averages.

Separate raw OCR from structured records

Retain the model’s raw text and layout output. A deterministic parser converts that artifact into paragraphs, tables, fields, and bounding boxes. Each extracted field carries page, source span, parser version, and review status. The schema must not let a model invent arbitrary business fields.

Domain rules validate money, dates, identity information, and contract terms. A total inconsistent with line items, a changed table column count, or a missing required field enters human review. Model-reported confidence alone cannot approve a record. Calibrate thresholds for each field category against labeled data.

Preserve coordinates and page images so reviewers can compare extraction with evidence. Editing a field creates a new reviewed value with reviewer identity and reason; it does not rewrite raw OCR.

Make every stage replayable

Stages expose pending, running, succeeded, failed, or review, and jobs carry idempotency keys. Retrying inference must not register the source twice or overwrite an approved result. Keep an error category and safe summary. GPU out-of-memory, corrupt image, and parser defects need different policies.

When a new model or parser ships, replay a frozen labeled set and create versioned results rather than replacing history. Segment evaluation by document type. Measure text error, field accuracy, table structure, citation localization, and abstention. A business pipeline often cares more about fields and provenance than one average OCR score.

Operations also need queue-age and review-backlog alerts. A model service can remain technically healthy while documents wait for hours or uncertain fields overwhelm reviewers. Capacity planning must include both GPU inference and the human review stage.

A traceable OCR system is organized around data lineage: source hash, rendering configuration, model revision, raw output, parser version, and human decision. DeepSeek-OCR 2 supplies a recognition component. Production trust comes from isolated execution, deterministic structuring, field validation, and replayable versions. Without those boundaries, a stronger OCR model merely produces unauditable text faster.