Deepseek multimodality - closing the gap

There are quite few multimodal proxies and bridges already there (including mine) that turn text only models like V4 into a multimodal one.
however all use regular vlms to process multimodal info. I am curious has anyone worked with specialized image only vlms, like deepseek ocr2? It seems to a perfect match for the job and can be harnessed by the bridge/proxy.

Got this idea while looking for new implementations for metal that just dropped like crazy in last days.

# DeepSeek-OCR-2

DeepSeek-OCR-2 is a powerful OCR model based on the SAM + Qwen2 encoder architecture, optimized for document understanding, text extraction, and visual grounding tasks.

## Model Architecture

                β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                β”‚                      Dynamic Resolution                          β”‚
                β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€

Local Patches β”‚ 768Γ—768 β†’ SAM (12Γ—12Γ—896) β†’ Qwen2 (144Γ—896) β†’ Proj (144Γ—1280) β”‚
(1-6 patches) β”‚ β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
Global View β”‚ 1024Γ—1024 β†’ SAM (16Γ—16Γ—896) β†’ Qwen2 (256Γ—896) β†’ Proj (256Γ—1280)β”‚
(1 image) β”‚ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
↓
[local_patches, global_view, view_separator]
↓
Language Model (DeepSeek-V2)


## Prompt Formats

### Document to Markdown
Convert a document image to structured markdown format:
<|grounding|>Convert the document to markdown. ```

General OCR

Extract all text from an image:

<image>
<|grounding|>OCR this image.

Free OCR (without layout)

Extract text without preserving layout structure:

<image>
Free OCR.

Parse Figures

Extract and describe figures/charts in documents:

<image>
Parse the figure.

Image Description

Get a detailed description of the image:

<image>
Describe this image in detail.

Text Localization (Grounding)

Locate specific text in the image and get bounding box coordinates:

<image>
Locate <|ref|>your text here<|/ref|> in the image.

Output format: <|/ref|><|det|>[[x1, y1, x2, y2]]<|/det|>

Coordinates are normalized to 0-1000 range.

Unlike models with decent capabilities like 35b that are sizeable, ocr2 is tiny, like 3gb and can be run in a corner of spark ram

Explored various OCR models - all weak for anything but the OCR. Claimed DeepSeek positioning in the image (i.e. locating a button or icon in a screenshot) - failed to produce a useful result.

Hence I settled with a dual config:

  • use Qwen 3.6 35b A3B VL as a main vision model on my M5 mac
  • use Qwen 3.0 3B VL as a backup model run on llamacpp on one of the sparks (in case notebook is not available)

Besides backup model API key was added (can use cloud model - tested with Openrouter Gemini) and sampling parameters overrides for all models.

Currently deployed in production