Skip to main content
Chunkr integrates Vision-Language Models (VLMs) to provide enhanced content generation, intelligent table processing, formula extraction, and custom segment analysis using visual understanding.

Overview

VLM processing in Chunkr allows you to:
  • Generate enhanced content using fine-tuned models (strategy: LLM)
  • Add custom LLM-powered analysis to any segment type
  • Process complex tables with better structure understanding
  • Extract mathematical formulas as LaTeX
  • Generate custom descriptions for images and diagrams

Generation Strategies

Auto Strategy

Uses heuristic-based generation - fast and efficient:
Best for: Standard text, lists, simple formatting

LLM Strategy

Uses Chunkr’s fine-tuned Vision-Language Models:
Best for: Tables, formulas, pictures, complex layouts
LLM strategy uses the page image as context to generate more accurate structured content

Default VLM Configuration

Some segment types use LLM strategy by default:

Custom LLM Prompts

Add custom LLM-powered analysis to any segment using the llm field:
Python
The LLM output is stored in segment.llm and can be included in chunks via embed_sources.

Extended Context

Use the full page image as context for LLM generation:
Default: false
Extended context provides better results but increases processing time and token usage

Configuring LLM Models

Chunkr supports global LLM configuration to control which models are used for VLM processing.

LLM Processing Configuration

Python
Specify which model to use. Check documentation for available models.

Image Cropping

Control when segment images are cropped and stored:
Default for most segments - Only crop when needed for post-processing
Cropped images are available in segment.image as presigned URLs.

Complete VLM Example

Python

Accessing VLM Output

VLM-generated content is available in multiple fields:
Python

Embed Sources with VLM

Control which VLM outputs are included in chunk embeddings:
Python
Result: The chunk’s embed field will contain:
  1. The HTML table structure (Content)
  2. The LLM summary (LLM)
Order matters! Sources appear in the embed field in the order specified.

Use Cases

VLM provides better table structure understanding, especially for complex or merged cells.
Convert formula images to LaTeX for better searchability and rendering.
Make images searchable by generating detailed text descriptions.
Provide summaries alongside full text for multi-level retrieval.

Performance Considerations

VLM processing increases latency and cost. Use strategically for best results.
Tips:
  • Use strategy: LLM only for complex content (tables, formulas, pictures)
  • Use strategy: Auto for simple text segments
  • Set extended_context: false unless you need full page context
  • Configure max_completion_tokens appropriately to control costs
  • Use temperature: 0.0 for consistent, deterministic output

Error Handling with VLM

Control how VLM errors are handled:
Options:
  • Fail: Stop processing on any error (default)
  • Continue: Continue processing despite LLM refusals or failures
Use Continue for fault-tolerant processing when some VLM failures are acceptable

Best Practices

  1. Use VLM strategically - Only apply to segments that benefit from visual understanding
  2. Write clear prompts - Be specific about what you want in custom llm prompts
  3. Enable high resolution - Set high_resolution: true for better VLM input quality
  4. Test and iterate - Experiment with different prompts and configurations
  5. Monitor costs - VLM processing can be expensive at scale
  6. Choose appropriate models - Different models have different strengths and costs

Next Steps