Efficiently navigating legal documents with multi-agent systems and graph-based retrieval

Written byCapria Value-Add
September 27, 2024

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /home/u876752588/domains/capria.vc/public_html/wp-content/plugins/jet-engine/includes/components/blocks-views/dynamic-content/manager.php on line 113

Handling legal documents for tasks like compliance management is often complex, as clauses frequently reference other sections, footnotes, or external definitions. A multi-agent system with graph-based retrieval provides a structured method to extract comprehensive information from such documents, making the process faster and more accurate.

Capria Ventures - pikaso edit 12

Key Components and Tools

  1. Document Structure Graphing: Legal documents have a hierarchical structure, which can be modeled as a “lexical graph.” Using tools like Reducto, you can break down a document into smaller chunks such as sections, clauses, and sub-clauses. This helps organize the document so that each part is connected in a structured way.
  2. Multi-Agent System: Multi-agent systems delegate specific tasks to different agents. Here’s a breakdown of the agents and their roles:
    • Definition Agent: Looks up terms in a predefined “definition graph” to fetch accurate definitions of legal terms used in the document.
    • Router Agent: Based on the retrieved nodes, it decides if additional linked sections or footnotes need to be retrieved.
    • Recursive Retrieval Agent: If a clause refers to other parts of the document, this agent retrieves those references recursively until all necessary information is gathered.
    • Answering Agent: This agent compiles and synthesizes the final response by combining all the retrieved information in a way that answers the original query.
  3. Graph Types:
    • Lexical Graph: This graph maps the document’s structure (e.g., sections and subsections) and how they are interrelated. Clauses and paragraphs are connected, allowing easy traversal during searches.
    • Definition Graph: Legal documents often have a glossary or specific terms that need definitions. This graph links legal terms to their definitions, which are fetched by the Definition Agent during retrieval.

Workflow: Answering Queries Using Multi-Graph Systems

For legal queries like “How can the Board and the CCO manage control functions?”, the system follows these steps:

  1. Extract Document Structure: Using Reducto, the document is parsed, and its structure is transformed into a graph. Each section and clause is mapped to create the Lexical Graph.
  2. Initial Query Search: When a user submits a query, it is first passed to the Initial Search Agent. This agent performs a search (e.g., vector search or BM25) to retrieve relevant chunks of text or clauses from the document.
  3. Definition Lookup: If specific legal terms need clarification, the Definition Agent is triggered. It searches the Definition Graph for the required terms, such as “Chief Compliance Officer (CCO)” or “Board,” and augments the answer with their definitions.
  4. Recursive Retrieval: If a retrieved clause contains references to other sections, the Router Agent checks if further traversal is needed. The Recursive Retrieval Agent then fetches these referenced clauses, ensuring that all necessary context is included.
  5. Answer Construction: Finally, the Answering Agent consolidates the gathered information into a comprehensive response. For instance, if two relevant paragraphs are in reference, the agent ensures both sections are included in the answer, providing full context.

Detailed Breakdown of a Query Workflow

  • Query Example: “How can the Board and the CCO manage control functions?”
    1. The Initial Search Agent retrieves the most relevant sections or clauses from the document based on the query.
    2. The Definition Agent looks up key terms from the definition graph and includes their definitions in the answer.
    3. The Router Agent identifies any references, such as footnotes or links, within the retrieved sections that may point to additional relevant content.
    4. The Recursive Retrieval Agent follows those references, retrieving further sections or clauses, and ensuring all necessary context is gathered.
    5. Finally, the Answering Agent compiles the complete response, integrating both the content from the retrieved sections and the relevant definitions, providing a comprehensive answer to the query.

Graph Construction and Management

  • Lexical Graph: Created by parsing the document structure (sections, sub-sections, clauses). This is the backbone of the document traversal process. Each section points to related sections based on the hierarchical order of the document.
  • Definition Graph: Extracts and structures definitions from the document. For example, if the document has a section defining terms like “Chief Compliance Officer,” this graph helps in retrieving these definitions efficiently.

Tools Involved:

  • Reducto: Breaks down documents into their structural components and creates the Lexical Graph.
  • WhyHow.AI: Used for managing and querying the graphs.
  • LangGraph: Helps create a multi-agent workflow for the query-answering process.
  • LlamaIndex: Supports various retrieval mechanisms like BM25 and keyword-based searches, improving accuracy and precision in legal text searches.

Using a multi-agent system with graph-based retrieval significantly improves the efficiency of navigating legal documents. By structuring documents into graphs and delegating tasks to specific agents, the system can handle complex queries, retrieve all relevant sections, and ensure complete, accurate answers. This approach is essential for legal compliance, document analysis, or any scenario involving large, structured documents.

Subscribe to GAIN Newsletter

Be the first to hear the latest investment updates, AI tech trends, and partner insights from Capria Ventures by subscribing to our monthly newsletter. 

Report a Grievance

Capria Ventures and its related entities are committed to the highest standards of ethics and strictly enforce a zero-tolerance anti-corruption policy. Please report any suspicious activity to grievance@capria.vc. All reports will be treated with utmost urgency and resolved appropriately.

Unitus Ventures is now Capria India

Unitus Ventures, a leading venture capital firm in India, is joining forces with its US affiliate Capria Ventures, a Global South specialist, to operate with a unified global strategy under a single brand, Capria Ventures. 

Chat with Capria GainBot
Hello! I'm GAINBOT, here to share interesting insights from Capria's webpages. Feel free to search for anything you'd like to learn about.