Menu
AWS Architecture Blog·June 2, 2026

Building an AI-Powered Contract Intelligence Platform on AWS: Doczy.ai Architecture

This article details the architecture of Doczy.ai, an intelligent contract interpretation solution built on AWS, leveraging generative AI to transform unstructured legal documents into structured, actionable insights. It highlights the use of AWS services like S3, Lambda, Textract, and large language models, alongside proprietary "smart chunking" and dual clustering algorithms, to achieve high accuracy and scalability in document processing.

Read original on AWS Architecture Blog

Doczy.ai addresses the significant challenge of extracting critical business information from large volumes of unstructured legal documents. Traditional manual or rules-based approaches are unscalable, error-prone, and inefficient. Doczy.ai uses a cloud-native, AI-driven approach to automate this process, achieving high accuracy and delivering substantial cost savings and operational efficiencies for clients in healthcare and financial services.

Core Architecture Overview

The Doczy.ai platform is built entirely on AWS, designed to manage the full document processing lifecycle. It processes documents from user upload through intelligent extraction, semantic and structural analysis, and finally, structured data generation for business intelligence. Key AWS services form the backbone of this scalable and secure architecture.

Key Architectural Components and Flow

  • Frontend & Authentication: A secure Next.js frontend handles user interaction, with Amazon Cognito managing user authentication and authorization.
  • Document Ingestion: Users upload documents directly to Amazon S3, which provides durable and scalable object storage.
  • Text Extraction: An AWS Lambda function triggers Amazon Textract to extract raw text and metadata from various document formats.
  • Smart Chunking (Proprietary): A patented algorithm goes beyond simple text extraction. It preserves hierarchical structure and one-to-many relationships by decomposing text into meaningful, context-aware chunks using semantic and keyword search. Dynamic parameters ensure logical relationships are maintained, and sequential identifiers organize chunks into field groups, handling overlaps and duplications.
  • Dual Clustering Engine (Semantic & Structural): This is a core innovation. Documents are simultaneously analyzed from two perspectives: a. Semantic Analysis: Extracted text is converted into embeddings, grouping similar ideas. b. Structural Analysis: Pattern-recognition algorithms identify clause types, formatting, table layouts, and hierarchical organization.
  • Unified Document Model: Projection algorithms compare semantic and structural clusters to synthesize a unified, enriched document model, capturing both meaning and context. This convergence is critical for the 99% accuracy rate.
  • Structured Output Generation: Advanced Large Language Models (LLMs) generate structured output based on the dual-clustered intelligence. The system determines file class and generates tailored prompts using few-shot and multi-shot prompting, incorporating a feedback loop for continuous accuracy improvement.
  • Data Repository & Monitoring: The resulting structured data flows into Snowflake for centralized storage, powering intelligent dashboards. Amazon CloudWatch monitors performance in real-time, and AWS Secrets Manager secures sensitive information.
💡

System Design Lessons

This architecture demonstrates a robust pattern for building AI-powered document processing systems. It highlights the importance of leveraging specialized services (like Textract for OCR), employing proprietary algorithms for data preparation (smart chunking), and combining different AI approaches (embeddings for semantics, pattern recognition for structure, LLMs for generation) to achieve high accuracy and handle complex unstructured data. The iterative prompting with a feedback loop is a key technique for improving LLM performance in specific domains.

Doczy.ai has successfully processed 2.5 million contracts (50 million pages) and handled billions of tokens with 137 million API calls to Amazon Bedrock, demonstrating its production readiness and scalability. This approach has led to a 97% reduction in manual processing time and significant financial savings for clients.

Impact and Scalability

AWSGenerative AIDocument ProcessingLLMTextractData ExtractionServerlessSystem Architecture

Comments

Loading comments...