AWS Demonstrates Flexible Document Processing with Amazon Bedrock
New pipeline offers on-demand and batch options for extracting data from large document volumes using generative AI

Takeaways
- ›AWS's new pipeline offers both on-demand and batch document processing using Amazon Bedrock LLMs
- ›The system can dynamically apply different prompts to varied document types, improving extraction accuracy
- ›While powerful, the solution has limitations in image processing and prompt management that users should consider
AWS has unveiled a new approach to document processing that leverages Amazon Bedrock's large language models (LLMs) to extract data from both paper and electronic documents. This system aims to address a common challenge faced by many organizations: how to efficiently process vast archives of documents that may contain valuable business intelligence.
The solution offers two distinct pipelines: an on-demand option for time-sensitive requests, and a batch processing option for cost optimization when handling large volumes. A key feature is the ability to dynamically specify the LLM and prompts at the document level, allowing the system to handle multiple document types through the same infrastructure.
How the On-Demand Pipeline Works
The on-demand pipeline is designed for quick, individual document processing. It begins with an AWS SQS FIFO (First-In, First-Out) queue that receives messages containing essential metadata: document ID, LLM model ID, and prompt information. This queue triggers an AWS Lambda function, which handles the core processing tasks:
- Retrieving the PDF document from Amazon S3
- Converting PDF pages to PNG images (if necessary)
- Fetching relevant prompts from Amazon Bedrock Prompt Management
- Composing the message for the LLM
- Saving the extraction results to Amazon DynamoDB
The use of a FIFO queue ensures reliable, ordered message delivery, which is crucial for maintaining processing consistency.
Batch Processing for Scale
For larger document volumes, the batch inference pipeline offers a more cost-effective approach. This pipeline uses a standard AWS SQS queue for high throughput and includes several key components:
- An Amazon EventBridge Scheduler to initiate batch processing on a set schedule
- A Batch Inference Lambda function that prepares documents and submits the batch job
- An Amazon EventBridge rule to monitor job completion
- A post-processing Lambda function to handle results
The batch system can handle a minimum of 100 records per job, making it suitable for processing substantial backlogs of documents.
Flexible Prompt Management
A notable feature of both pipelines is the integration with Amazon Bedrock Prompt Management. This allows users to store and version different prompts tailored to specific document formats. By specifying prompt IDs and versions in the SQS messages, the system can dynamically retrieve the appropriate prompt for each document, enhancing extraction accuracy across varied document types.
Handling Document Variations
The solution is designed to accommodate the reality that documents, even within the same category (such as land leases), can vary significantly in format. Some may present information in numbered lists, others in tables, and some might even include land drawings. By allowing for document-specific prompts, the system can adapt its extraction strategy to these variations.
Limitations and Considerations
While powerful, the system does have some constraints to be aware of:
- The Claude 4 Sonnet model (used in the example) has a limit of 20 images per multimodal invocation, requiring larger documents to be split into chunks.
- There's a service limit of 50 prompts per region and 10 versions per prompt in Amazon Bedrock Prompt Management.
- The batch inference system requires a minimum of 100 records per job, which may not be suitable for smaller-scale processing needs.
Why This Matters
This flexible document processing pipeline represents a significant step forward in leveraging AI for data extraction at scale. By combining on-demand and batch processing options, organizations can balance speed and cost-efficiency based on their specific needs. The ability to dynamically apply different prompts and models to varied document types within the same system is particularly valuable for enterprises dealing with diverse document archives.
However, it's important to note that while this system can greatly accelerate data extraction, it still requires careful prompt engineering and ongoing refinement to achieve optimal results across different document types. Organizations considering such a system should be prepared for an iterative process of improving prompts and potentially fine-tuning models to their specific document domains.
Related reads
Amazon Bedrock AI Explained: Document Processing Pipeline, OCR, Context Understanding
4 min read
AWS PDF Extractor Explained: Real-Time Text from S3 PDFs
4 min read
Amazon Bedrock Healthcare Claims Pipeline Explained: Automation, Validation, FHIR Integration
3 min read
MiniMax M2.5 on Amazon Bedrock: How It Works, Capabilities
4 min read
AWS Data Mesh for AI Agents: How It Works, Pros and Cons
4 min read
Multimodal AI for Searchable Aerial Imagery: Insights from AWS and Vexcel
4 min read
Reported and explained by AI·Reporter.