paddleocr-vl on Tenstorrent p150
Derived from PaddlePaddle's PaddleOCR-VL (PaddlePaddle/PaddleOCR-VL-1.6, PaddlePaddle/PaddleOCR-VL-1.5, PaddlePaddle/PaddleOCR-VL), with unmodified weights downloaded from PaddlePaddle's repositories. Official code: PaddlePaddle/PaddleOCR and the repositories'
trust_remote_codefiles. This is a third-party port, not affiliated with or endorsed by Baidu or the PaddlePaddle team. See the original model cards for training details.
PaddleOCR-VL-0.9B is the element recognizer of PaddlePaddle's document parser: a NaViT-style vision encoder (27 layers, width 1152, 2-D rotary positions) that reads an image at its own resolution (up to about one megapixel for 1.5 / 1.6, 2.8 megapixels for the first version), a projector that merges 2 x 2 patches into one token, and the ERNIE-4.5-0.3B language model that writes the answer. Prompted with a task, it recognizes text (109 languages), tables (as an OTSL cell sequence, converted to HTML by this package), formulas (LaTeX) and charts; 1.5 and 1.6 add text spotting (lines with their polygons) and seal recognition. Three checkpoints are served from one image as serve profiles: 1.6 (default), 1.5 and vl. The package includes the official image pre-processing, chat template and task presets; the vision encoder and the prefill run on the device as traced tt-nn graphs (bfloat16 weights) and every decoded token as one launch of a decoder megakernel (block-float-8 weights) with on-device greedy decoding / sampling. The page layout stage of the official pipeline (PP-DocLayout) is not included: send element crops, or whole pages with the ocr / spotting tasks.
Runs on Tenstorrent p150 — see the serving profiles below.
Packaged and published with tt-model-manager 0.1.0 (manifest schema 5.1).
At a glance
| Hardware | p150 |
| License | apache-2.0 |
Intended use
Low-latency recognition of document elements on one Tenstorrent p150, one request at a time: text lines and paragraphs, tables, formulas, charts, seals, and text spotting on whole pages; the recognition stage behind a layout detector of your choice. Not included: the page-layout stage of the official PaddleOCR-VL pipeline (PP-DocLayout finds and orders the elements of a page; its weights are published only in PaddlePaddle's own format, so it is a separate port), hence no full-document parsing endpoint.
Prerequisites
- The Tenstorrent CLI,
tt:uv tool install tenstorrent(or use tt-model alone, see the Quickstart) - Docker
- Tenstorrent hardware: p150
- About 2 GB of free disk per served profile for its checkpoint (fetched once into the Hugging Face cache, 5.8 GB for all three), plus the container image
- The first start of a profile compiles the device programs of every bucket (about 1 500 kernels:
18 minutes for20 s); both are kept in tt-model's cache, so later starts are ready in about a minute (1.6on a busy 8-core host) and packs the decoder megakernel's weights (1.6: 66 s). Fewer buckets (PADDLEOCR_VIS_BUCKETS,PADDLEOCR_MAX_PIXELS) shorten it - Images as PNG, JPEG, WebP, BMP, TIFF or GIF (first frame), sent as base64 / data URLs
Quickstart
tt serve changh95/PaddleOCR-VL
tt serve downloads the Docker image and all three required checkpoints: PaddlePaddle/PaddleOCR-VL-1.6 at 132c45f52c0a26ed5a6b2f6bd8e3985794cc27dd, PaddlePaddle/PaddleOCR-VL-1.5 at 1e5216083435c7851caad5d691ef55aab81b5949, PaddlePaddle/PaddleOCR-VL at dae2996584399c9fb7eabfeecf8acd2c7cae95b7 (into your HF cache; they are not in the image), then starts the model's own HTTP server on port 20000 (or the next free port, if that one is busy). The first start compiles kernels for your device, which takes several minutes; the server is ready when it logs Application startup complete.
Without tt-cli: tt-model serve changh95/PaddleOCR-VL.
Default profile (1.6), on the port tt serve reported:
curl -sLO https://huggingface.co/changh95/PaddleOCR-VL/resolve/main/code/tt_paddleocr/samples/table_simple.png
curl -s localhost:20000/ocr -H 'Content-Type: application/json' \
-d "{\"image\": \"$(base64 -w0 table_simple.png)\", \"task\": \"table\"}"
# {"text": "<fcel>Model<fcel>Params<fcel>Latency (ms)<fcel>Score<nl>...", "result": {"html": "<table>...", ...}, ...}
curl -s localhost:20000/ocr -F file=@table_simple.png -F task=table -F stream=true # SSE text deltas
Serving profiles
Select a different serving profile using --profile.
| profile | hardware | mesh | description |
|---|---|---|---|
1.6 (default) |
p150 | P150 | PaddleOCR-VL-1.6: the most accurate (the default); OCR, table, formula, chart, spotting, seal |
1.5 |
p150 | P150 | PaddleOCR-VL-1.5: OCR, table, formula, chart, spotting, seal |
vl |
p150 | P150 | PaddleOCR-VL (first version): OCR, table, formula, chart; images up to 2.8 megapixels |
Capabilities
This package exposes the model's own HTTP server on port 20000, not an OpenAI-compatible chat API — its request and response shapes are the model's own. See the author's notes for the payload it expects.
The model's own server implements POST /v1/chat/completions in the OpenAI shape (the generic line above is
tt-model's note for this kind of package; it is not a tt-model-provided chat front end): one user message with
one image and a task prompt; the OpenAI Python client works against it:
import base64
from openai import OpenAI
client = OpenAI(base_url="http://localhost:20000/v1", api_key="unused")
url = "data:image/png;base64," + base64.b64encode(open("table_simple.png", "rb").read()).decode()
r = client.chat.completions.create(model="paddleocr-vl", messages=[{"role": "user", "content": [
{"type": "image_url", "image_url": {"url": url}}, {"type": "text", "text": "Table Recognition:"}]}])
print(r.choices[0].message.content)
| task | prompt (chat text) | output | profiles |
|---|---|---|---|
ocr |
OCR: |
text (lines, paragraphs, whole pages) | all |
table |
Table Recognition: |
OTSL cells (<fcel>, <lcel>, <ucel>, <nl>, ...); /ocr adds result.html |
all |
formula |
Formula Recognition: |
LaTeX; /ocr adds result.latex without the delimiters |
all |
chart |
Chart Recognition: |
the chart's data as a pipe-separated table; /ocr adds result.rows |
all |
spotting |
Spotting: |
text lines, each with its location tokens (coordinates 0..1000); /ocr adds result.items with polygons in pixels |
1.5, 1.6 |
seal |
Seal Recognition: |
the text of a seal / stamp | 1.5, 1.6 |
| request field | default | meaning |
|---|---|---|
| image | required | chat: an image_url part (data URL; http(s) URLs only with PADDLEOCR_ALLOW_URLS=1); /ocr: image (base64 or data URL), a multipart file, or the raw body (image/*) |
| task / prompt | ocr |
chat: the text part is a task prompt or a task name, or a custom prompt; /ocr: task and / or prompt |
max_tokens (chat) / max_new_tokens (/ocr) |
512 (1.5, 1.6), 1024 (vl) | generated-token limit, up to PADDLEOCR_MAX_NEW_TOKENS (4096) and the room the prompt leaves: on 1.5 / 1.6 prompt + output <= 4,096 tokens (longer requests are cut to that silently, finish_reason length); on vl up to 7,808 positions, beyond 4,096 on the tt-nn decode engine (~6 ms per token) |
temperature |
0 | 0 = greedy (the official decoding); > 0 samples on the device (with top_k <= 64, top_p, seed) |
top_k, top_p, seed |
0, 1, random | sampling controls (extensions to the OpenAI fields); on the device sampler top_k 0 = the 64 most likely tokens |
repetition_penalty |
1 (off) | 1 .. 2 (HF's rule over prompt + generated tokens); every profile: the decoder megakernel produces the logits and the host applies the penalty and chooses (about 2.5-3 ms per token greedy instead of ~1.5, about 20-27 ms per token when also sampling with temperature > 0, because the host then samples over the full vocabulary) |
max_pixels, min_pixels |
the profile's preset | the resize bounds of the image (the task presets: spotting upscales small pages 2x and allows 1.6 megapixels) |
stream |
false | Server-Sent Events: chat chat.completion.chunk deltas (stream_options.include_usage), /ocr delta then done events |
/ocranswerstext(the model's output),result(tablehtml/otsl/rows, spottingitemswithboxandpoints, formulalatex, chartrows),usage,timings(preprocess, vision, prefill, first token, decode, per token, in ms) andimage(sizes, the patch grid).GET /healthreports readiness,GET /infothe profile, tasks, weights and their commits, the device, the engines, the configuration, the buckets and the limits;GET /v1/modelslists the served model.- Errors: 400 with the reason, 413 body too large, 415 content type, 422 malformed body, 429 queue full
(
Retry-After), 503 while starting or afterPADDLEOCR_QUEUE_TIMEOUT_S, 500 on a device failure. - A Python API with the same parameters (
tt_paddleocr.api.PaddleOCRVL) is described incode/PYTHON.md.
Configuration
The server builds its device programs for one configuration when it starts; change it with environment variables
and start it again. GET /info reports it.
| item | environment variable | values | default |
|---|---|---|---|
| checkpoint | PADDLEOCR_PROFILE (the serve profiles set it) |
1.6, 1.5, vl |
1.6 |
| largest image (pixels after the resize) | PADDLEOCR_MAX_PIXELS |
3136 .. 16777216 | 1605632 (1.5, 1.6: the spotting preset), 2822400 (vl) |
| smallest image | PADDLEOCR_MIN_PIXELS |
3136 .. max | 112896 (1.5, 1.6), 147384 (vl) |
| tokens per request | PADDLEOCR_MAX_NEW_TOKENS |
16 .. 16384 | 4096 (cap of max_tokens; the KV capacity bounds prompt + output: 4,096 on 1.5 / 1.6, 7,808 on vl) |
| prompt text tokens | PADDLEOCR_MAX_PROMPT_TOKENS |
16 .. 1024 | 64 |
| device engines | PADDLEOCR_ENGINE |
dec=mk (megakernel) or dec=ttnn |
vis=ttnn,pre=ttnn,dec=mk |
| weight formats | PADDLEOCR_PRECISION |
vis, vis_mlp, pre_attn, pre_mlp, pre_head = bf16 / bfp8; mk = bf16 / bfp8 / bfp8h8; vis_fid, pre_fid = HiFi4 / HiFi2 / LoFi |
vision bf16 + HiFi2, prefill bf16 (MLP bfp8) + HiFi4, megakernel bfp8h8 |
| compiled shapes | PADDLEOCR_VIS_BUCKETS, PADDLEOCR_PRE_BUCKETS, PADDLEOCR_WARMUP |
patch / token counts; all, none or a list |
derived from the largest image; all |
largest top_k |
PADDLEOCR_K_MAX |
1 .. 64 | 64 |
| streaming granularity | PADDLEOCR_POLL_TOKENS |
1 .. 64 decode steps per poll | 8 |
| queue | PADDLEOCR_QUEUE_DEPTH, PADDLEOCR_QUEUE_TIMEOUT_S |
waiting requests, seconds | 8, 300 |
| uploads | PADDLEOCR_MAX_BODY_MB, PADDLEOCR_MAX_IMAGE_MPIX, PADDLEOCR_ALLOW_URLS |
MB, megapixels, 0 / 1 | 64, 64, 0 |
Example output
Images rendered for this demo (a table with merged header cells, a formula, a Korean notice), each sent to this
package's container on a p150 (default profile 1.6) as POST /ocr with the task shown and otherwise the
defaults (greedy decoding). The right half of each image draws the answer as returned: the response's
result.html (converted by the server from the model's OTSL cells) as a grid, the LaTeX as source and
re-rendered with matplotlib, the text as is. media/demos.json has the exact requests
(plus a fourth, the notice in simplified Chinese), the whole answers with their timings, and the official
float32 model's answers.
The table's answer as the model wrote it (text of the response, "task": "table"; result.html holds the same
table as HTML):
<fcel>Station<fcel>Rainfall (mm)<lcel><lcel><lcel><fcel>Total<nl><ucel><fcel>Jan<fcel>Feb<fcel>Mar<fcel>Apr<ucel><nl><fcel>Harbor<fcel>81.2<fcel>64.5<fcel>70.3<fcel>52.8<fcel>268.8<nl><fcel>Hillside<fcel>95.0<fcel>77.4<fcel>88.1<fcel>60.2<fcel>320.7<nl><fcel>Airport<fcel>58.6<fcel>49.9<fcel>55.0<fcel>41.3<fcel>204.8<nl><fcel>Valley<fcel>72.4<fcel>61.0<fcel>66.7<fcel>47.5<fcel>247.6<nl>
| input | task | image tokens | output tokens | first token | decoding | whole request (server) | client round trip |
|---|---|---|---|---|---|---|---|
| table, 788 x 324 | table |
336 | 145 | 131 ms | 608 tokens/s | 0.37 s | 0.38 s |
| formula, 820 x 160 | formula |
174 | 49 | 103 ms | 635 tokens/s | 0.18 s | 0.19 s |
| Korean notice, 1130 x 510 | ocr |
720 | 131 | 196 ms | 545 tokens/s | 0.44 s | 0.46 s |
Chinese notice, 1130 x 442 (demos.json only) |
ocr |
640 | 65 | 253 ms | 552 tokens/s | 0.37 s | 0.39 s |
The second request of each input on a warm server (the first gave the same answer); the server times come from
the answer's timings (first token: preprocess + first_token; decoding: 1000 / per_token; whole request:
request), the round trip is on loopback. Against the greedy answers of the official float32 model on the CPU
(the same weights with their trust_remote_code files, transformers 5.24.1), the table, Korean and Chinese
answers are identical; the formula differs in one of its 49 tokens (\operatorname where float32 writes
\mathsf, before "s o f t m a x"). The p150 and the float32 model both read the Chinese notice's underlined
title as LaTeX, \(\underline{\text{图书馆使用须知}}\).
Expected performance
Agreement with PaddlePaddle's own float32 code on the CPU (the repositories' trust_remote_code files,
transformers 5.24.1, same weights and prompts, greedy) on synthetic element crops (English / Chinese / mixed-script
text lines, a paragraph, vertical text, a tiny crop, a table, two formulas, a chart, a seal) and a page (OCR; text
spotting on 1.5 / 1.6). Reference drift = PaddlePaddle's own model run in bfloat16 on the same inputs.
| eval | vl | 1.5 | 1.6 |
|---|---|---|---|
| Outputs identical to the float32 outputs | 11 / 11 | 12 / 13 | 12 / 13 |
| Character error rate vs the float32 outputs (mean) | 0 | 0.00015 | 0.00044 |
| Next-token distribution, total-variation distance per step, mean / worst-case p95 (bfloat16 reference: mean <= 0.005) | <= 0.0062 / 0.041 | <= 0.0122 / 0.043 | <= 0.0069 / 0.034 |
| Top-1 next token equal (teacher-forced) | 1.000 | 1.000 (spotting 0.991) | 1.000 |
| Vision embedding PCC, projector output (worst case; bfloat16 reference worst case) | 0.9988 (0.9988) | 0.9944 (0.9910) | 0.9959 (0.9957) |
The two outputs that differ are the text-spotting pages: the text is identical, single location tokens differ
by one step (1 / 1000 of the page). Megakernel decoding with on-device greedy selection gives the same tokens as
the float32 code on every element; sampling (temperature > 0) is reproducible for a fixed seed.
Real scans (an independent check on 15 inputs cut from 9 public-domain page images: a NASA technical note and its table, typewritten equations, a 1969 typed memo, an 1870 census table, Playfair's 1786 chart, a 1920s Chinese letter and its seal, an 1871 French book page; all three profiles, 40 greedy requests compared):
| eval (real scans) | result |
|---|---|
| Outputs identical to the float32 greedy outputs | 24 / 40 requests (6,166 tokens) |
| The other 16 | each diverges at a step where float32 itself is split: 15 at a near tie (its top two within 0.06: a whitespace, a LaTeX command, a digit, a location token), one at an uncertain digit of a 2,085-token table (0.575 / 0.376); where checked, PaddlePaddle's own bfloat16 model makes the device's choice. Character error rate vs float32 0.002-0.11, except the 1.6 Playfair chart (0.56: a whitespace tie at step 21, after which float32's numbers degenerate and the device's stay plausible) and the 1870 census table (0.24-0.29) |
| Next-token distribution vs float32, TVD mean / top-1 (teacher-forced) | text, tables, pages 0.0001-0.006 / 0.985-1.000; formulas and the chart 0.003-0.013 (1.6-2.7x the bfloat16 drift) |
| Text spotting (1.5 / 1.6, two real pages each) | location tokens equal to float32's at 1,249 / 1,264 steps (the others 1-2 / 1000 of the page away), text tokens at 2,567 / 2,569 |
| Vision embedding PCC, projector output | 0.9941-0.9999 (43 runs) |
Two inputs are outside the model's competence: the seal stamp of the 1920s letter (every profile and float32 read it wrongly; on 1.6 the device's next-token distributions are further from float32 than the bfloat16 model's, TVD 0.10 vs 0.02, with the same greedy output) and the 1870 census table, on which the checkpoints themselves loop (they restart the table after its "Total" row until the token budget ends; float32 does the same).
Speed on one p150 (batch 1, warm, traced; median of 5 runs; time from the decoded image to the last token; ms):
| speed (batch 1, warm) | vl | 1.5 | 1.6 |
|---|---|---|---|
| Decoder time per token (megakernel), element crops / page / spotting page | 1.49-1.54 / 2.38 / - | 1.48-1.56 / 2.10 / 2.60 | 1.48-1.56 / 2.08 / 2.61 |
| Time to the first token, text-line crop (vision + prefill) | 53 | 44 | 43 |
| Text line (22 tokens), end to end | 85 | 76 | 75 |
| Table crop (67 tokens), end to end | 157 | 136 | 134 |
| Formula / chart crop, end to end | 97 / 134 | 87 / 135 | 89 / 141 |
| Page OCR (152-168 tokens), end to end | 967 | 653 | 648 |
| Text-spotting page (559-572 tokens), end to end | - | 2138 | 2187 |
For comparison, the same pipeline with the tt-nn decode step instead of the megakernel (1.6): 5.1-5.9 ms per token; text line 162 ms, table 384 ms, page 1153 ms. A served request adds the HTTP and image decoding / resize (~5-15 ms for a crop).
Limitations
- Element recognition only: the official pipeline's layout stage (PP-DocLayout, which finds and orders the
elements of a page) is not included. Its weights are in PaddlePaddle's own format (only the first version's
repository carries one, PP-DocLayoutV2; 1.5 / 1.6 use a newer one that is not in their repositories). Crop the
elements with a layout detector of your choice, or send whole pages with
ocr/spotting. - Batch 1: requests are served one at a time in arrival order (
PADDLEOCR_QUEUE_DEPTHmay wait). - One image per request, one user turn; no system prompt, no multi-turn chat.
- Images larger than
PADDLEOCR_MAX_PIXELSafter the official resize are scaled down to it, as the official processor does with its own limit; the aspect ratio must stay below 200. - Prompt + output fit 4,096 tokens on 1.5 / 1.6 (the decoder megakernel's KV; no tt-nn decode engine is built by
default): a request for more is cut to the room left and ends with
finish_reasonlength. Spotting and full-page prompts take 1,250-2,030 tokens, so a dense page gets at most about 2,000-2,800 output tokens.PADDLEOCR_TTNN_FALLBACK=1adds the tt-nn decode engine (up toPADDLEOCR_MAX_POSITIONS, ~6 ms per token, longer start-up).vlbuilds it by default (7,808 positions). - Sampling (
temperature> 0) on the megakernel draws from the 64 most likely tokens (PADDLEOCR_K_MAX;top_papplies within them); requests withrepetition_penaltyor on the tt-nn decode engine sample the full vocabulary on the host. Greedy decoding, the official default, is exact on every path. - EXIF orientation is ignored, as in the official processor: rotate photos before sending them.
- Accuracy is measured on synthetic images and on 15 real scans (no public benchmark run): outputs equal PaddlePaddle's float32 greedy outputs on most inputs; on real scans a near tie in float32 (a few per cent apart) is occasionally resolved the other way, after which the rest of the output can differ (one chart of 15 inputs differed substantially); on spotting pages single location tokens may differ by one step. On an out-of-distribution seal stamp the device's next-token distributions are further from float32 than PaddlePaddle's bfloat16 model's, with the same output.
Licensing
- Weights (not redistributed here;
tt servedownloads them from PaddlePaddle's repositories at these commits), all Apache-2.0: PaddlePaddle/PaddleOCR-VL-1.6132c45f5, PaddlePaddle/PaddleOCR-VL-1.51e521608, PaddlePaddle/PaddleOCR-VLdae29965. Notices:code/tt_paddleocr/licenses/NOTICE.md. - This package is a derivative work of PaddleOCR-VL: the inference code is written anew (the image pre-processing, chat template, 3-D rotary positions and task presets follow the official code), the networks run on the device in tt-nn operations and a custom decoder megakernel, and the weights are loaded unmodified. The decoder megakernel, its on-device sampler and the ttnn decoder are adapted from the same author's earlier p150 language-model ports (Apache-2.0; the ttnn decoder pattern from tt-metal's Qwen3-TTS demo, Copyright Tenstorrent AI ULC, Apache-2.0).
- The language model inside PaddleOCR-VL is ERNIE-4.5-0.3B (Baidu,
baidu/ERNIE-4.5-0.3B-Paddle, Apache-2.0); the official
trust_remote_codefiles the port follows are Copyright 2025 PaddlePaddle Authors, Apache-2.0. - Port, server and scripts (
code/) and the tt-metal patches inpatches/: Apache-2.0. - Samples:
code/tt_paddleocr/samples/holds synthetic images made for this package (CC0 1.0); provenance in theirATTRIBUTION.md. - Demo images in
media/: inputs rendered for this demo from text written for it, and this package's answers, CC0 1.0 (fonts: DejaVu, Bitstream Vera licence; Noto Sans CJK KR / SC, SIL OFL 1.1); attributions inmedia/ATTRIBUTION.md.
Related packages
- changh95/DepthPro2: Apple Depth Pro 2 metric depth on p150.
- changh95/all-MiniLM-L6-v2: sentence embeddings on p150.
Feedback
Questions or problems with this package: open a discussion at https://huggingface.co/changh95/PaddleOCR-VL/discussions — that is what reaches its author. A problem with the tt tooling itself: tt report issue (collects your environment and opens a prefilled issue against tenstorrent/tt-cli). Product feedback: support@tenstorrent.com.
Provenance
The exact sources the image was built from — code/ in this repo is byte-identical to the model code inside the image:
| component | built from |
|---|---|
| tt-metal | 44d66500520fda9f2c7060c0f6b41ec48f7ab37e (dirty tree — the image includes uncommitted changes) |
code/ digest |
bc06eccad85db606 (sha256, first 16 hex digits) |
| built | 2026-12-01T12:28:04+00:00 by tt-model 0.1.0 |


