Skip to content

design review: Rust-native evidence-first OCR engine #9

Description

@Sam123ben

Parent: #1. Related reviews: #3, #4, #6 and #7.

Direction

Build a Tesserix-owned OCR engine and production runtime in Rust. Established external OCR systems are benchmark competitors only; we do not adopt or copy another project’s runtime, pipeline, source or public contract.

“Our OCR” means Tesserix owns preprocessing, inference pipeline, model contract, deployed artefacts, normalization, evidence, calibration, evaluation and release gates. Training experiments may use Python; production inference remains Rust with signed exported model artefacts.

Product niche

Agent-grade, evidence-first document OCR:

  • immutable original-page evidence for every recognized value;
  • calibrated uncertainty and explicit unusable, unknown and partial outcomes;
  • forms, receipts, invoices, statements, IDs, contracts and mobile scans;
  • deterministic validation and human-review routing;
  • untrusted-content and prompt-injection signals for agents;
  • streaming pages, bounded resources and private/self-hosted execution.

Proposed runtime

  • Rust stable, Tokio, Axum/Tower, SQLx, thiserror, serde and tracing/OTel.
  • ONNX Runtime through a pinned Rust integration as the initial CPU/CUDA/TensorRT execution layer.
  • Separate crates for domain, image transforms, detection, recognition, layout, runtime, evaluation and service.
  • Sandboxed decode/inference workers because codecs, GPU drivers and ONNX Runtime remain native/unsafe dependencies.
  • Models are warmed and pooled per device/version, batched by bounded shape/pixel budgets and promoted independently.

Required design and benchmark gate

  • Approve the first narrow cohort: printed English scans/mobile images plus source geometry and reading order.
  • Select legally usable bootstrap detector/recognizer weights after model-license review.
  • Define signed model manifest, tensor contracts, calibration and rollback predecessor.
  • Build identical-hardware baselines against established open-source and approved cloud OCR.
  • Measure CER/WER, evidence IoU, reading order, layout/table cohorts, p50/p95/p99, pages/s, CPU/GPU/memory and cost.
  • Prove warmed sessions, bounded batching, page streaming and memory ceilings.
  • Prove transforms map all evidence back to immutable original-page coordinates.
  • Fuzz decoders, tensor validation, geometry and post-processing.
  • Prove raw text and field values never enter logs/traces.
  • Keep VLM use limited to bounded low-confidence regions with separate provenance.

Temporal risk gate

Temporal Rust SDK v0.8.0 is Public Preview/pre-release as of 2026-09-02. Before production selection, prove replay, worker versioning, cancellation, signals, child workflows, heartbeats, 300-page history bounds, crash recovery and a 24-hour upgrade soak. If it fails, use a narrow stable Go Temporal runner calling the Rust service; do not build a custom durable state machine merely for language purity.

Approval

  • Rust/service owner
  • OCR/ML owner
  • Model licensing/data-governance owner
  • Temporal/platform owner
  • Security/native supply-chain owner
  • SRE approves measured benefit, cost and failure isolation

Implementation #8 remains blocked until this review records the selected first profile, model artefacts, benchmark thresholds and workflow runtime.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions