Skip to content

Workflow for document comparison.

1

I am trying to build a document comparison application as a part of my work. The documents I work with contains a lot of text and tabular data. They are pdf files with around 100 pages . I want the application to compare two versions of the documents, and I wanted it to show the differences between the two documents. I am using Bedrock for this purpose. I am using recursivetextsplitter for chunking, and not getting accurate results. Can anyone help me with the workflow?(ps: I am not allowed to use any open source llm's or embedding models. I am allowed to only use Anthropic claude)

1 Answer
0

To build a document comparison application using Amazon Bedrock and Anthropic Claude for comparing large PDF documents with text and tabular data, you can consider the following workflow:

  1. Document Preprocessing:

    • Use Amazon Bedrock's document processing capabilities to extract text and structured data from your PDF files.
    • Leverage the multimodal capabilities of Anthropic Claude 3 to accurately extract both textual and tabular data.
  2. Chunking Strategy: Instead of using RecursiveTextSplitter, consider using Amazon Bedrock's built-in chunking methods:

    • For text-heavy sections, use semantic chunking. This method divides text into meaningful chunks based on content, which can improve comparison accuracy.
    • For tabular data, use hierarchical chunking. This allows you to maintain the structure of tables while creating manageable chunks.
  3. Embedding Generation: Use Amazon Bedrock to generate embeddings for each chunk from both documents.

  4. Comparison Process:

    • Compare corresponding chunks between the two documents using their embeddings.
    • Use Anthropic Claude to analyze and describe the differences between chunks.
  5. Difference Highlighting:

    • For text differences, use Claude to generate a summary of changes.
    • For tabular data, use Claude to describe changes in table structure or cell contents.
  6. Result Aggregation: Combine the differences found in individual chunks to create a comprehensive comparison report.

  7. Human Review (Optional): Implement a human-in-the-loop workflow using Amazon Augmented AI (A2I) for reviewing and validating the comparison results, especially for critical sections or when the AI's confidence is low.

  8. Output Generation: Use Claude to generate a final report summarizing all the differences found between the two documents, including both textual and tabular changes.

This workflow leverages Amazon Bedrock's advanced document processing and chunking capabilities, along with Anthropic Claude's powerful language understanding and generation abilities. It should provide more accurate results for your large PDF documents containing both text and tables, without relying on open-source models or embeddings.

Sources
Intelligent document processing using Amazon Bedrock and Anthropic Claude | AWS Machine Learning Blog
Scalable intelligent document processing using Amazon Bedrock | AWS Machine Learning Blog
How content chunking works for knowledge bases - Amazon Bedrock

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.