Default Model Used by olmOCR: Qwen2.5-VL-7B-Instruct Configuration
The default model used by olmOCR is Qwen/Qwen2.5-VL-7B-Instruct, a 7-billion parameter vision-language model defined in the ModelConfig dataclass within olmocr/train/config.py.
The allenai/olmocr repository implements a complete OCR pipeline built on large language models capable of processing document images and text. Understanding the default model configuration is essential for running training jobs or inference, as this vision-language checkpoint powers the core text extraction and page-level understanding capabilities.
Default Model Configuration
The olmOCR training system centers around a configuration architecture that specifies which base model to load for OCR tasks.
Where the Default is Defined
According to the olmOCR source code in olmocr/train/config.py (lines 177-182), the ModelConfig dataclass sets the default model name:
@dataclass
class ModelConfig:
name: str = "Qwen/Qwen2.5-VL-7B-Instruct"
trust_remote_code: bool = False
device_map: str = "auto"
load_in_8bit: bool = False
load_in_4bit: bool = False
When you call create_default_config() from the same file, it instantiates a ModelConfig object with this default value unless explicitly overridden by a user-supplied YAML configuration.
Why Qwen2.5-VL-7B-Instruct?
The Qwen2.5-VL-7B-Instruct checkpoint is a multimodal LLM that processes both text and image inputs. This architecture selection provides several advantages for OCR pipelines:
- Vision-language instruction following capabilities handle complex document understanding tasks without additional fine-tuning
- 7-billion parameter size balances model performance against GPU memory requirements, making it practical for large-scale document processing
- Hugging Face integration allows automatic model downloading when the pipeline initializes using standard transformers loaders
How to Verify and Override the Default Model
You can inspect or customize the default model configuration through the Python API or YAML configuration files.
Checking the Current Configuration
To confirm which model olmOCR will use in your environment:
from olmocr.train.config import create_default_config
cfg = create_default_config()
print(f"Default olmOCR model: {cfg.model.name}")
# Output: Default olmOCR model: Qwen/Qwen2.5-VL-7B-Instruct
Customizing via YAML Configuration
Create a custom configuration file to override the default model while preserving other training settings:
# my_config.yaml
model:
name: "google/gemma-3-4b-it"
trust_remote_code: true
load_in_4bit: true
Load the custom configuration using the Config class:
from olmocr.train.config import Config
cfg = Config.from_yaml("my_config.yaml")
print(f"Using model: {cfg.model.name}")
# Output: Using model: google/gemma-3-4b-it
Implementation Across the Pipeline
The default model name propagates through several critical components of the olmOCR system:
olmocr/train/train.py — Initializes the base model using AutoModelForCausalLM.from_pretrained(cfg.model.name, ...) with quantization settings (load_in_8bit, load_in_4bit) and device mapping parameters from the ModelConfig instance.
olmocr/train/dataloader.py — Constructs preprocessing pipelines that format image tensors and text prompts according to the vision-language model's expected input schema, including special tokens for document understanding.
olmocr/pipeline.py — Orchestrates the full OCR workflow, invoking the loaded model via generate() methods for page-level text extraction and structured response generation.
tests/test_pipeline.py — Validates end-to-end functionality using the default model configuration in test fixtures, ensuring the Qwen2.5-VL integration remains functional across updates.
Summary
- The default model used by olmOCR is
Qwen/Qwen2.5-VL-7B-Instruct, hardcoded in theModelConfigdataclass withinolmocr/train/config.py. - This vision-language model provides native multimodal capabilities for processing both document images and text instructions.
- Override the default by creating YAML config files and loading them via
Config.from_yaml()before initializing the training pipeline. - The model configuration flows through
train.py,dataloader.py, andpipeline.pyto execute OCR tasks with automatic Hugging Face Hub integration.
Frequently Asked Questions
What is the default model used by olmOCR?
The default model used by olmOCR is Qwen/Qwen2.5-VL-7B-Instruct, specified in the ModelConfig dataclass at lines 177-182 of olmocr/train/config.py. This vision-language model from Alibaba Cloud's Qwen2.5 family is pre-configured to handle multimodal OCR tasks involving both visual document understanding and text generation.
Why does olmOCR use Qwen2.5-VL-7B-Instruct as the default?
This model provides native instruction-following capabilities for vision-language tasks while maintaining computational efficiency through its 7-billion parameter architecture. The checkpoint is hosted on Hugging Face, enabling seamless integration with the transformers library and automatic downloading when users initialize the olmOCR training or inference pipeline.
How do I change the default model in olmOCR?
Create a YAML configuration file specifying your alternative model under the model.name key, then load it using Config.from_yaml("your_config.yaml"). This overrides the default Qwen/Qwen2.5-VL-7B-Instruct setting while preserving other configuration defaults from create_default_config().
Is the default model downloaded automatically when running olmOCR?
Yes, when the training script or inference pipeline initializes, the system calls AutoModelForCausalLM.from_pretrained() and AutoProcessor.from_pretrained() using the model name from cfg.model.name. If the checkpoint is not present in your local Hugging Face cache, the transformers library automatically downloads it from the Hugging Face Hub.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →