Image-Text-to-Text
PEFT
Safetensors
ocr
document-parsing
lora

Configuration Parsing Warning:In adapter_config.json: "peft.task_type" must be a string

Qwen3.5-0.8B Document OCR LoRA

中文说明

This is a research LoRA adapter for transcribing a single document page image into Markdown, with HTML tables and LaTeX formulas. It requires the pinned Qwen3.5-0.8B base model. It is not a merged checkpoint, a standalone model, or an official Qwen or Ai2 release.

Quickstart

Use a CUDA PyTorch build with BF16 support, a matching torchvision, and transformers==5.3.0, peft==0.19.1, accelerate, safetensors, and Pillow. Run the script on your own page image:

python ocr_page.py /path/to/page.png

The script loads the pinned base processor and checkpoint, applies the released adapter, and prints the new tokens as text. It uses greedy decoding, disables thinking, and sets a 1,048,576-pixel image budget and a 3,072-new-token limit. Use --base-dir to point to a local copy of the pinned base, and --processor-dir if the pinned processor is stored separately. The script does not execute the generated HTML.

Training

  • One epoch, 500 optimizer updates on 2,000 pages; 64 separate pages for teacher-forced validation.
  • LoRA rank 4, alpha 8, applied to the Q/V linear projections in six full-attention language layers. Base language and vision weights were frozen.
  • Micro-batch size 2, two accumulation steps, maximum full training sequence length 2,898. Final validation NLL was 0.107636 over 44,452 supervised tokens; it is not an OCR accuracy score.
  • Transcriptions and source indexing come from Ai2 olmOCR-mix-1025 (00_documents/train); pre-rendered pages come from DBlake-BoxedLogic/Image-2-Markdown. Both databases are labeled ODC-BY 1.0. Original page content may have separate rights; this repository does not redistribute page images, source documents, or transcriptions.

training_recipe.json records the original run settings. The referenced data, training contract, and optimizer state are not included. See the code, setup, and evaluation record. The adapter weight file is unchanged from the final training export; the adapter config replaces the training host path with the pinned Hub base.

Evaluation

B0 and S1 used the same base, images, prompt, and decoding; B0 disabled the LoRA and S1 enabled it. The results below are from two small, separate sets, not leaderboard scores.

Metric B0 S1
In-domain character edit rate against teacher transcriptions, 31 scored pages (lower is better) 81.20% 28.95%
External text edit distance, 12 pages (lower is better) 0.392 0.215
External formula edit distance, 5 pages (lower is better) 0.724 0.511
External table TEDS, 5 tables (higher is better) 0.950 0.758
External reading-order edit distance, 12 pages (lower is better) 0.310 0.308

The external diagnostic uses a 12-page subset of OmniDocBench. One missed table accounted for the table-score decline in this small sample. Teacher agreement is not human-verified OCR accuracy. Formula score is string edit distance, not visual equivalence or CDM.

Limitations

Pages with mixed layouts, small blocks, tables, and formulas can be partly omitted even when decoding ends normally. Output may repeat, be truncated, or fail to preserve structure. This release does not establish multilingual coverage, multi-page reading order, or long-document parsing. Verify output against the image before relying on it.

The adapter is provided under Apache-2.0. The base model and datasets retain their respective terms.

Downloads last month
22
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for yanpeng051821/qwen3.5-0.8b-document-ocr-lora

Adapter
(800)
this model

Datasets used to train yanpeng051821/qwen3.5-0.8b-document-ocr-lora