Skip to main content
MindStudio
Pricing
Blog About
My Workspace

How to Add Vision to a Local AI Agent Without Blowing Your VRAM

Use a small vision model like MiniCPM-V as a specialized sub-agent to handle screenshots and PDFs without loading a full multimodal LLM.

MindStudio Team RSS
How to Add Vision to a Local AI Agent Without Blowing Your VRAM

The VRAM Wall: Why Vision Breaks Local AI Stacks

Adding vision to a local AI agent sounds straightforward — until you check your GPU memory usage. Running a full multimodal LLM like LLaVA-34B or CogVLM alongside your existing text-based agent stack can demand 24–40GB of VRAM. Most consumer and prosumer GPUs top out at 8–16GB.

The result? Your agent either can’t load at all, or you sacrifice your primary reasoning model to squeeze in image support. Neither is a good outcome.

There’s a better pattern: treat vision as a dedicated sub-agent. Instead of loading one enormous multimodal model that does everything, you use a small, focused vision model — like MiniCPM-V — to handle screenshots, images, and PDFs, then pass its output to your main orchestrator as plain text. The automation stays intact. The VRAM stays manageable.

This guide walks through that architecture in detail — what models to use, how to set them up with Ollama, how to wire them into a multi-agent workflow, and where each piece lives.


Why a Sub-Agent Approach Works Better Than a Monolithic Multimodal LLM

The instinct when adding vision is to swap your current LLM for a multimodal one. That approach has real downsides beyond VRAM.

The problems with a monolithic multimodal model

Other agents ship a demo. Remy ships an app.

UI
React + Tailwind ✓ LIVE
API
REST · typed contracts ✓ LIVE
DATABASE
real SQL, not mocked ✓ LIVE
AUTH
roles · sessions · tokens ✓ LIVE
DEPLOY
git-backed, live URL ✓ LIVE

Real backend. Real database. Real auth. Real plumbing. Remy has it all.

First, context window economics. When you shove an image into a multimodal LLM, it tokenizes the image into hundreds or thousands of visual tokens. Those tokens eat into the context window that your agent needs for conversation history, tool outputs, and reasoning chains.

Second, capability trade-offs. Multimodal models often underperform specialized text models on pure reasoning tasks. You’re not getting “the best of both worlds” — you’re getting a compromise.

Third, loading time and cold start. A 20B+ multimodal model takes longer to load and burns more memory even when it isn’t processing any images. If vision is only needed 20% of the time, you’re paying full price 100% of the time.

Why a sub-agent fixes this

When vision is a sub-agent, your architecture looks like this:

  1. Orchestrator (text-only LLM, 7B–13B range) handles reasoning, planning, and tool selection
  2. Vision sub-agent (small multimodal model, 2B–8B range) processes images on request
  3. Output flows back as plain text — descriptions, extracted data, structured JSON — that the orchestrator can use like any other tool result

The vision model is only loaded when needed. The orchestrator stays lean. VRAM usage for the two models together can be lower than one full-size multimodal model.

This is a standard pattern in multi-agent system design — specialized agents handle tasks they’re suited for, and a coordinator routes work to them.


Choosing the Right Vision Model for Low-VRAM Setups

Several small vision models are worth knowing. Not all are equal in what they can handle.

MiniCPM-V 2.6

This is the standout choice for most use cases. MiniCPM-V 2.6 is an 8B-parameter model from OpenBMB that handles high-resolution images, multi-image inputs, and basic video frames. It achieves competitive benchmark scores against much larger models on OCR-heavy and document understanding tasks.

VRAM requirement: ~8GB at 4-bit quantization, ~16GB in full precision. An RTX 3080 or 4080 can run it.

Best for: Screenshots with UI elements, document images, PDFs converted to images, complex charts.

Moondream2

Moondream2 is an extremely lightweight model at ~1.86B parameters. It’s fast, runs on as little as 4GB VRAM, and handles straightforward image description and question answering well.

VRAM requirement: ~4GB at 4-bit, well under 8GB at full precision.

Best for: Simple image descriptions, basic object identification, scenarios where speed matters more than depth.

LLaVA-Phi-3-Mini

Built on Microsoft’s Phi-3-Mini base (3.8B parameters), this model balances capability and efficiency. It’s solid for general visual question answering and understands screenshots reasonably well.

VRAM requirement: ~4–6GB depending on quantization.

Best for: General-purpose vision tasks without high OCR demands.

InternVL2-2B and InternVL2-8B

InternVL2 is a strong performer across the size range. The 2B version is surprisingly capable for document understanding. The 8B version competes with MiniCPM-V 2.6 directly.

VRAM requirement: 2B runs in ~4GB; 8B needs ~8–10GB.

Best for: Document analysis, chart reading, and when you want to tune the model size to your available hardware.

Quick comparison

ModelParametersVRAM (4-bit)OCR/Doc StrengthSpeed
MiniCPM-V 2.68B~8GBHighModerate
Moondream21.86B~4GBLow-moderateFast
LLaVA-Phi-3-Mini3.8B~4-6GBModerateFast
InternVL2-8B8B~8-10GBHighModerate
InternVL2-2B2B~4GBModerateFast

For agents that need to read screenshots, parse document text, or extract structured data from images, MiniCPM-V 2.6 is the best starting point if your hardware can fit 8GB.


Setting Up MiniCPM-V with Ollama

Ollama is the simplest way to run these models locally. It handles model downloads, quantization, and exposes a local API endpoint that your agent can call like any other service.

Step 1: Install Ollama

Download and install Ollama for your operating system from the Ollama website. It runs as a background service on port 11434 by default.

Step 2: Pull the vision model

ollama pull minicpm-v

For Moondream:

ollama pull moondream

Ollama downloads the appropriate quantized version automatically. You can also specify a tag for a different quantization level if you need to optimize further.

Step 3: Verify the model is running

ollama list

You should see minicpm-v in the output with its size and modification date.

Step 4: Test a basic image query

Ollama’s API accepts base64-encoded images. Here’s a minimal Python test:

import ollama
import base64

with open("screenshot.png", "rb") as f:
    image_data = base64.b64encode(f.read()).decode("utf-8")

response = ollama.chat(
    model="minicpm-v",
    messages=[
        {
            "role": "user",
            "content": "Describe what is shown in this screenshot.",
            "images": [image_data]
        }
    ]
)

print(response["message"]["content"])

If this returns a description, your vision sub-agent is ready to receive calls from your orchestrator.

Managing VRAM across models

Ollama keeps models warm in memory by default. If you’re running a text orchestrator alongside MiniCPM-V, you may want to configure Ollama’s OLLAMA_KEEP_ALIVE setting so vision models unload when not actively processing. Set it to something like 5m (5 minutes) to free up memory between vision tasks.


Handling Screenshots and PDFs

Screenshots are the easier case — they’re already images. PDFs require a conversion step.

Processing screenshots

When your agent needs to understand UI state, read error messages, or extract data from a dashboard screenshot:

  1. Capture the screenshot as PNG or JPEG
  2. Base64-encode it
  3. Send to the vision sub-agent with a specific prompt
  4. Return the text output to your orchestrator

Be deliberate with your prompt. “Describe this image” returns vague prose. “Extract all text visible in this screenshot, formatted as a list” or “Identify all form fields and their current values in this UI screenshot” returns actionable structured output.

Converting PDFs to images

PDFs need to be rasterized before a vision model can process them. The standard library for this in Python is pdf2image, which wraps Poppler:

pip install pdf2image
from pdf2image import convert_from_path

pages = convert_from_path("document.pdf", dpi=150)
for i, page in enumerate(pages):
    page.save(f"page_{i}.png", "PNG")

Set DPI to 150–200 for most documents. Higher DPI improves text legibility at the cost of memory during conversion.

For longer documents, process pages in batches and send each page separately to the vision model. Then concatenate the extracted text and pass the combined result to your orchestrator.

Structured extraction prompts

For documents, these prompt patterns work well with MiniCPM-V:

  • Invoice/receipt: "Extract all line items, totals, dates, and vendor information from this document image. Return as JSON."
  • Form/UI: "List all form fields visible and their current values."
  • Chart/graph: "Describe the data shown in this chart. Include axis labels, values, and any trends."
  • Error screenshot: "Identify any error messages or warnings visible in this screenshot and quote them exactly."

Hire a contractor. Not another power tool.

Cursor, Bolt, Lovable, v0 are tools. You still run the project.
With Remy, the project runs itself.

Getting specific about output format in your prompt dramatically improves consistency.


Wiring the Vision Sub-Agent Into Your Orchestrator

The vision model is now running and responding. The question is how your orchestrator knows when to call it and how to use the output.

Option 1: Tool call / function call

If your orchestrator supports function calling (most modern LLMs do), define vision processing as a tool. The orchestrator decides when an image needs interpretation and invokes the vision function automatically.

def analyze_image(image_path: str, question: str) -> str:
    """Send an image to the local vision model and return the result as text."""
    with open(image_path, "rb") as f:
        image_data = base64.b64encode(f.read()).decode("utf-8")
    
    response = ollama.chat(
        model="minicpm-v",
        messages=[{"role": "user", "content": question, "images": [image_data]}]
    )
    return response["message"]["content"]

Register this as a tool in your agent framework (LangChain, LlamaIndex, CrewAI, etc.) and the orchestrator handles routing.

Option 2: Explicit pipeline step

For more deterministic workflows — like a document processing pipeline where vision always runs before analysis — make it an explicit step rather than a tool:

  1. Receive document
  2. Convert to images
  3. Run each image through vision model → extract text
  4. Pass extracted text to orchestrator for analysis/classification/summarization
  5. Return result

This approach is predictable and debuggable. The orchestrator never needs to decide whether to call vision — it always does, in that position in the pipeline.

Option 3: Router agent

For complex workflows handling multiple input types (some images, some plain text, some PDFs), add a lightweight router that classifies the input and sends it to the right sub-agent. The router itself can be a small LLM or even a simple rules-based function.

This multi-agent pattern keeps each component focused and makes it easier to swap or upgrade individual models without rebuilding the whole system.

Common gotchas

Token limits: Some orchestrator frameworks treat the vision model output as part of the conversation history. If you’re processing many pages, extracted text can balloon your context. Summarize or truncate outputs before appending to conversation history.

Error handling: Vision models occasionally return unhelpful outputs like “I cannot determine this” or “The image is unclear.” Add a fallback that retries with a more specific prompt, or flags the item for manual review.

Latency: A single MiniCPM-V inference on an 8-page PDF (8 separate calls) might take 20–60 seconds on a mid-range GPU. Design your agent’s timeout and retry logic accordingly.


How MindStudio Fits This Pattern

If you want to build this kind of multi-agent vision workflow without managing infrastructure yourself, MindStudio’s visual builder handles the architecture described above as a point-and-click workflow.

MindStudio supports local models through Ollama and LMStudio, which means you can point a workflow node at your local MiniCPM-V instance. Your vision model handles image inputs, returns extracted text, and passes it downstream — all wired up visually without writing orchestration code.

The typical build looks like this:

  • Trigger: a webhook, file upload, or scheduled scan
  • Vision node: calls your local Ollama endpoint with the image and a structured extraction prompt
  • Processing node: passes the extracted text to a GPT-4o or Claude node for analysis, classification, or summarization
  • Output node: writes results to Airtable, sends a Slack message, or triggers another workflow
VIBE-CODED APP
Tangled. Half-built. Brittle.
AN APP, MANAGED BY REMY
UIReact + Tailwind
APIValidated routes
DBPostgres + auth
DEPLOYProduction-ready
Architected. End to end.

Built like a system. Not vibe-coded.

Remy manages the project — every layer architected, not stitched together at the last second.

Because MindStudio has 200+ models and 1,000+ integrations built in, the vision step can connect to real business outputs without extra glue code. You’re not building a demo — you’re building something that runs on a schedule and connects to your actual tools.

For teams that want the efficiency of local vision models but don’t want to maintain orchestration infrastructure, this is a practical middle ground. You can try MindStudio free at mindstudio.ai.


Frequently Asked Questions

Can MiniCPM-V run on a CPU instead of a GPU?

Yes, but expect significantly slower inference. On a modern CPU, a single image query might take 30–120 seconds depending on the quantization and available RAM. For interactive workflows this is usually too slow. For batch overnight processing it may be acceptable. Moondream2 handles CPU inference better than larger models due to its size.

What’s the minimum VRAM needed to add vision to a local agent?

You can run Moondream2 in about 4GB of VRAM. If your orchestrator LLM occupies 4–6GB, you’re looking at 8–10GB total for a functioning two-model setup. An RTX 3080 (10GB) can run this configuration. For MiniCPM-V 2.6, plan for ~8GB for vision alone, which means a 16GB GPU (RTX 3080 Ti, 4080, etc.) for a dual-model stack.

How accurate is MiniCPM-V at reading text in screenshots?

For clear, high-contrast screenshots with standard fonts, accuracy is high — comparable to dedicated OCR tools on most content. It degrades on low-resolution images, unusual fonts, rotated text, or complex multi-column layouts. For mission-critical document extraction, run a second-pass validation or pair it with a dedicated OCR library like Tesseract for comparison on sensitive fields.

Should I use a vision model or a dedicated OCR tool for PDFs?

It depends on the PDF type. For native digital PDFs (not scans), a PDF parsing library like pdfplumber or pymupdf will extract text faster, cheaper, and more accurately than a vision model. Use vision models when: the PDF is a scan, the layout matters (tables, forms), the content is mixed text and image, or you need to interpret visual elements like charts or diagrams.

Can I fine-tune a small vision model on my specific document types?

Yes. MiniCPM-V and InternVL2 both support fine-tuning through standard supervised fine-tuning approaches. If your agent regularly processes a specific document type — insurance forms, medical records, shipping manifests — fine-tuning on a few hundred examples dramatically improves extraction accuracy. The OpenBMB team publishes fine-tuning guides for MiniCPM-V on their GitHub repository.

Does running vision as a sub-agent add too much latency?

For most automation use cases, no. The latency is usually 2–15 seconds per image on a modern GPU. In real-time interactive scenarios (a chatbot that needs to respond in under a second) this may be too slow. But for background automation — processing uploaded documents, analyzing screenshots from monitoring systems, extracting data from PDFs — that latency is acceptable. The tradeoff is worth it versus the alternative of not having vision capability at all.


Key Takeaways

  • Use small vision models as sub-agents rather than loading a monolithic multimodal LLM. This keeps VRAM usage manageable and preserves your orchestrator’s reasoning quality.
  • MiniCPM-V 2.6 is the best starting point for screenshot and document work if you have ~8GB of VRAM available. Moondream2 works for lighter needs on 4GB.
  • Ollama makes local vision model deployment straightforward — pull a model, call it via API, get text back.
  • PDFs need to be rasterized first. Use pdf2image at 150–200 DPI before sending pages to your vision model.
  • Prompt specificity matters. Ask for structured output formats explicitly and your vision sub-agent’s responses become far more useful downstream.
  • MindStudio lets you wire this multi-agent vision pattern into production workflows visually, connecting local Ollama models to business tools without managing orchestration infrastructure yourself.

Plans first. Then code.

PROJECTYOUR APP
SCREENS12
DB TABLES6
BUILT BYREMY
1280 px · TYP.
yourapp.msagent.ai
A · UI · FRONT END

Remy writes the spec, manages the build, and ships the app.

If you’re building automation that needs to understand visual content without compromising your GPU budget, the sub-agent architecture is the right approach — start with MindStudio to build and deploy it without the infrastructure overhead.

Presented by MindStudio

No spam. Unsubscribe anytime.