AlgoViz

Visual documents and video evidence

hard 6 min

A visual source carries meaning in location, color, layout and time.

Video lesson · Chapter 1 of 4

Two points are labeled seventy-four

0:00 / 3:56

Theory

Read or listen first. About 2 min.

What it is

A visual source carries meaning in location, color, layout and time. OCR can read every printed value and still lose which line a legend describes. A vision-language pipeline retrieves candidate pages or frames, preserves their coordinates or timestamps and asks a reader to ground a claim in a specific region. Keep extraction, retrieval and reasoning measurable as distinct stages.

Why it exists

A text path can be cheaper for prose; a visual path helps when diagrams and layout convey the relationship. Page-image embeddings can keep multiple vectors per page, preserving patch-level signals for retrieval. They increase storage and ranking work. For video, frame sampling controls which evidence ever reaches the reader. Neither a correct page nor an eloquent explanation proves the cited region supports the answer.

Find the quarter behind a plotted value

Source page → Page index (page representations). Page index → Region reader (candidate page). Source page → Region reader (original resolution). Region reader → Citation resolver (region and claim)
Source page → Page index (page representations). Page index → Region reader (candidate page). Source page → Region reader (original resolution). Region reader → Citation resolver (region and claim)

Inside this chapter

Chapter sources
Visual and text representations
Patch embeddings retain local visual features. Late interaction can match query tokens against different patches, whereas a single pooled representation compresses an entire page. Compare retrieval cost and answer grounding on charts, forms and plain text separately.

A single pooled embedding squeezes a whole page into one vector, which works for prose but blurs charts and forms. Late-interaction models keep one vector per image patch and score a query by matching each query token to its best patch, so local visual cues like a dashed line next to a legend entry can drive retrieval. The price is many vectors per page and heavier scoring, so compare against an OCR baseline separately on charts, forms and plain text.

Example. Two pages contain the number 74. Only one places 74 on the dashed line identified as renewals in the legend.

Another example. An insurance archive of scanned claim forms retrieves better with patch embeddings because the meaning of a ticked box depends on its position; for typed correspondence, OCR plus text embeddings performs as well at a fraction of the storage.

Two pages contain 74, one matches the query

Patch-level matching can use layout and legend cues that plain OCR text loses.
Spatial and temporal grounding
Keep the original coordinate system, page revision, crop transform, frame timestamp and sampling interval. Map a prediction back to the source before exposing a citation.

Readers rarely see the original page: images get cropped, resized and tiled. Store each transform alongside the input so a predicted box can be mapped back to original page coordinates on the exact revision. Video needs the same care in time: the frame timestamp plus any clip offset and the sampling interval. Without this bookkeeping, a correct answer is highlighted in the wrong place.

Example. Coordinates on a half-size image must be rescaled before highlighting the value on the original page. A timestamp in a clipped video must include the clip offset.

Another example. A safety-review tool cites "forklift enters zone at 00:42" from a clip that started at 12:10 into the shift recording. Without adding the clip offset, the reviewer jumps to the wrong moment of the full video.

Map a prediction back to the source
  1. 1Box found in crop(100, 40) on a crop of the half-size page
  2. 2Undo crop offsetadd crop origin (300, 500)
  3. 3Undo downscalemultiply by 2
  4. 4Original page rev 3box at (800, 1080)
  5. 5Highlight citationon the right revision

Illustrative coordinates. Every transform applied on the way in must be inverted on the way out.

Evidence loss at sampling time
A reader cannot recover a short-lived event removed by sampling or tiny text erased during downscaling. Use a coarse pass to find candidate intervals and a finer pass to inspect them, recording both budgets.

Whatever the sampler drops, the reader can never see. Uniform sparse sampling misses short events; aggressive downscaling erases small text. A two-pass approach uses a cheap signal (scene change, motion, OCR text appearing) to flag candidate intervals or regions, then inspects those at full rate or resolution. Record both budgets so evaluation can tell a sampling miss from a reasoning error.

Example. A warning appears between seconds 3.2 and 3.6. Frames sampled only at integer seconds may miss it entirely.

Another example. A dashboard screenshot is downscaled to 512 pixels wide before reading, turning 9-point axis labels into blur. Tiling the image into four full-resolution crops recovers them.

Does the sampler catch a 3.2 to 3.6 s warning?

Sampling planFrames near the eventCaught?
1 frame per second3.0, 4.0no
4 frames per second3.25, 3.5yes
Coarse 1 fps, then 4 fps on changed intervals3.25, 3.5 in the flagged intervalyes, at lower total cost
Figures from the example, plus an illustrative two-pass plan.
Multi-vector index cost
Patch-level retrieval stores many vectors per page instead of one, which multiplies storage and makes scoring heavier. Size the index before choosing it, and consider compressing vectors, pooling patches or using it only for visually dense collections.

A common pattern is a two-stage pipeline: a cheap pooled or text index retrieves a few hundred candidate pages, and multi-vector scoring reranks only those. That keeps the precision benefit while bounding the storage and compute that full multi-vector search would need.

Example. Indexing 10,000 report pages with roughly 1,000 patch vectors each needs about 2.5 GB, against about 31 MB for one pooled vector per page.

Illustrative storage for 10,000 pages

RepresentationVectors per pageBytes per pageTotal
One pooled vector, 768 dims, 32-bit13,072about 31 MB
Patch vectors, 128 dims, 16-bitabout 1,000about 256,000about 2.5 GB
Made-up but representative shapes. Real patch counts and widths depend on the model and image resolution.

How it works

Step through the idea, or press Play.

Step 1 of 4

Source page. Keep the original chart and legend

Understand it

Worked example

Find the quarter behind a plotted value

  1. 1

    Keep the original chart and legend

    Store the source revision, OCR and the page image. Preserve the visual relationship between line style and legend entry.

  2. 2

    Two pages mention 74

    Compare OCR-based results with visual late interaction. Select the page containing the requested series and quarter.

  3. 3

    Check axis, series and point

    Inspect a higher-resolution crop plus its legend. Reading the isolated number is insufficient to identify the business measure.

  4. 4

    Highlight one supported claim

    Return the value, the series and quarter, and an addressable region on the correct page revision.

Follow the handoffs

A text path can be cheaper for prose; a visual path helps when diagrams and layout convey the relationship. Page-image embeddings can keep multiple vectors per page, preserving patch-level signals for retrieval. They increase storage and ranking work. For video, frame sampling controls which evidence ever reaches the reader. Neither a correct page nor an eloquent explanation proves the cited region supports the answer.

Where each failure would be recorded

In the worked question the page is correct, so the failure belongs to region grounding.

Stage-by-stage scorecard

StageCheckResult in the example
Ingestionoriginal page image and legend keptpass
Retrievalpage with the requested series retrievedpass
Region reader74 read from the renewals dashed linefail, read another series
Citationbox on correct revisionnot reached

Summary

The whole topic in one minute.

The candidate page already contains the answer. The failure occurs when matching the value to its visual context.

A text path can be cheaper for prose; a visual path helps when diagrams and layout convey the relationship. Page-image embeddings can keep multiple vectors per page, preserving patch-level signals for retrieval. They increase storage and ranking work. For video, frame sampling controls which evidence ever reaches the reader. Neither a correct page nor an eloquent explanation proves the cited region supports the answer.

Sources