Skip to main content

What is Multi-Modal Prompting?

Multi-modal prompting is a technique that enables AI models to process and respond to multiple types of input media, such as combining text with images, audio, or documents. Unlike traditional text-only prompts, multi-modal prompting allows for richer interactions by incorporating visual context, enabling applications like image analysis, document processing, and visual reasoning.

Why Use Multi-Modal Prompting?

  • Enhanced Context: Visual content provides information that’s difficult to express in text alone
  • Improved Accuracy: Models can “see” what they’re analyzing rather than relying on descriptions
  • Complex Reasoning: Combines visual perception with textual reasoning for sophisticated tasks
  • Natural Interaction: Mimics human ability to process multiple sensory inputs simultaneously
  • Application Versatility: Enables new use cases like visual QA, document analysis, and content moderation
  • Reduced Ambiguity: Images provide concrete references that minimize misinterpretations

Basic Implementation in Latitude

Here’s a simple multi-modal prompting example using Latitude:
Image Analysis
In the Playground, the input_image parameter will automatically be configured with an image upload button, while the analysis_request will be a standard text field. This configuration is based on the parameter types specified in the YAML header.

Advanced Implementation with Multiple Media Types

This example shows how to work with both images and text in a more sophisticated workflow:

Setting Up Multi-Modal Parameters

Latitude offers several ways to configure and use multi-modal parameters:

Parameter Configuration in YAML

You can define parameter types directly in your prompt’s configuration YAML:

Parameter Input Methods in the Playground

When testing multi-modal prompts in the Playground, you can use these input methods:
  1. Manual Upload: Directly upload images and files through the parameter input fields
  2. Dataset Integration: Load images from a dataset for batch testing across multiple visual examples
  3. History Reuse: Access previously used images from your parameter history
For detailed information, see the Playground Parameter Input Methods guide.

Working with Multi-Modal Inputs in the Playground

When testing multi-modal prompts in the Latitude Playground, you’ll encounter specific controls for image and file inputs:
  1. Image Parameters:
    • Click the upload button to select an image from your device
    • Optionally, use the image preview to verify you’ve selected the correct file
    • For vision models, images will be appropriately encoded and embedded in the prompt
    Image Parameter
  2. File Parameters:
    • Upload PDF documents or other supported file types
    • The Playground will process these files according to the provider’s requirements
    • Some providers may have file size or type limitations
    File Parameter
  3. Dataset Testing:
    • Create datasets that include image or file URLs for batch testing
    • Test your multi-modal prompts across a variety of visual inputs
    • Compare performance with different visual content types
For complex multi-step prompts with visual components, you can use the Playground to observe how the model processes visual information at each step of the chain. This is particularly useful for debugging visual reasoning flows.

Document Processing Implementation

This example demonstrates how to process document files (PDFs) using multi-modal capabilities:

Best Practices for Multi-Modal Prompting

Image Quality Guidelines:
  • Resolution: Provide images with sufficient resolution (min. 512px on shortest side)
  • Clarity: Ensure images are well-lit and in focus
  • Framing: Center the relevant subject in the frame
  • Compression: Minimize compression artifacts that might affect analysis
  • Aspect Ratio: Use standard aspect ratios when possible
Image Type Considerations:
  • Photographs: Work best for general object/scene identification
  • Screenshots: Useful for UI analysis, but text may be analyzed separately
  • Diagrams/Charts: Effective for technical analysis
  • Illustrations: May be interpreted differently than photographs
Text-Image Integration:
  • Place image reference before the main question/instruction
  • Clearly separate image and text with formatting
  • Reference the image explicitly in your instructions
  • Be precise about what aspect of the image to focus on
Question Framing:
  • Ask specific questions rather than open-ended ones
  • Break complex visual tasks into simpler components
  • Use bullet points for multiple questions about the same image
  • Provide context before questions to prime the model’s attention
Visual Classification:
  • Specify the taxonomy or categories you want used
  • For ambiguous cases, ask for confidence levels
  • Request alternative classifications when appropriate
Visual QA:
  • Frame questions to focus attention on relevant image areas
  • Provide examples of desired answer format/detail level
  • For subjective questions, specify the perspective to take
Description Generation:
  • Indicate desired detail level (brief vs. comprehensive)
  • Specify aspects to focus on (colors, shapes, text, etc.)
  • Request structured output for consistent descriptions
Model Selection:
  • Choose models specifically designed for multi-modal tasks
  • Consider context window limitations when sending large images
  • Test smaller/lighter models for simpler visual tasks
Performance Optimization:
  • Resize very large images before sending
  • Consider black and white conversion for non-color tasks
  • Use image cropping to focus on relevant regions
  • Test with multiple prompt variations for optimal results

Advanced Techniques

Visual Chain-of-Thought

Implement a step-by-step visual reasoning process:
Visual CoT

Multi-Image Comparison

Compare and analyze multiple images simultaneously:

Visual Information Extraction

Extract structured data from visually rich content:
Visual Extraction
Multi-modal prompting works well when combined with other prompting techniques:
  1. Chain-of-Thought: Break down visual reasoning into explicit steps for complex image analysis.
  2. Self-Consistency: Generate multiple interpretations of an image and select the most consistent one.
  3. Template-Based Prompting: Use templates to standardize visual analysis across different images.
  4. Retrieval-Augmented Generation: Combine image analysis with retrieved textual information for contextual understanding.
  5. Few-Shot Learning: Provide examples of image-text pairs to guide the model’s visual interpretation.

Real-World Applications

Multi-modal prompting is particularly valuable in these domains:
  • Content Moderation: Analyzing images for policy violations or inappropriate content
  • E-commerce: Automated product photo analysis, comparison, and description generation
  • Healthcare: Reviewing medical images alongside patient records (with appropriate regulatory compliance)
  • Document Processing: Extracting information from forms, receipts, and ID documents
  • Accessibility: Generating detailed image descriptions for vision-impaired users
  • Education: Creating interactive learning experiences with visual elements
  • Quality Control: Inspecting products or materials for defects or compliance issues

Advanced Configuration for Multi-Modal Parameters

Parameter Definition Options

Parameters in multi-modal prompts can be configured with several advanced options:

Parameter Types for Multi-Modal Inputs

Latitude supports these parameter types for multi-modal prompting:
  1. Image Parameters (type: image):
    • Supported by models with vision capabilities (e.g., GPT-4o, Claude 3)
    • Rendered in the prompt using {{ parameter_name }}
    • Appears as an image upload button in the Playground
    • Most models support common formats: JPEG, PNG, WebP, GIF
  2. File Parameters (type: file):
    • Supported by models with document processing capabilities
    • Different providers support different file types:
      • Claude: PDF documents
      • GPT-4o: Various document formats
    • Enables document analysis, data extraction, and PDF processing
  3. Text Parameters (type: text):
    • Standard text input that can be used alongside multi-modal inputs
    • Can contain instructions for processing the visual content
For complete details on parameter configuration, refer to the Configuration guide.

Multi-Modal Content in PromptL

When working with multi-modal content in Latitude’s PromptL syntax, you can reference images and files directly in your messages:
Or for document content:
This explicit content tag syntax is an alternative to direct variable insertion and works well in more complex prompt structures.