ComoRAG  by EternityJune25

Cognitive RAG for stateful long narrative reasoning

Created 2 months ago
296 stars

Top 89.4% on SourcePulse

GitHubView on GitHub
Project Summary

ComoRAG is a Retrieval-Augmented Generation (RAG) framework engineered for complex, stateful reasoning over long documents and multi-document collections. It targets researchers and practitioners needing advanced capabilities in question answering, information extraction, and knowledge graph construction from extensive narratives. ComoRAG offers significant performance gains on challenging long-context benchmarks by adopting a cognitive-inspired, iterative reasoning approach that mimics human memory processes.

How It Works

ComoRAG addresses the limitations of stateless, single-step RAG systems in handling intricate, long-range narrative comprehension. Its core innovation lies in a cognition-inspired methodology that models narrative reasoning as a dynamic interplay between acquiring new evidence and consolidating past knowledge. This is achieved through iterative reasoning cycles, where the system generates targeted "probing queries" to explore new evidence paths. Retrieved information is integrated into a "global memory pool," progressively building a coherent context for the query. This "Reason → Probe → Retrieve → Consolidate → Resolve" cycle enables principled, stateful retrieval-based reasoning, outperforming strong RAG baselines by up to 11% on benchmarks exceeding 200K tokens.

Quick Start & Requirements

  • Installation: Clone the repository and install dependencies using pip install -r requirements.txt.
  • Prerequisites: Python 3.10+ is recommended. CUDA 12.x is supported and recommended for GPU acceleration. Environment variables for OpenAI API keys or local LLM/embedding model paths are required.
  • Data Format: Input data should be provided in corpus.jsonl (documents) and qas.jsonl (questions).
  • Execution: Use main_openai.py for OpenAI API integration or main_vllm.py for local vLLM server deployment.
  • Resources: Detailed setup time and resource footprint are not specified, but GPU acceleration is highly recommended.
  • Links: arXiv Paper, DeepWiki.

Highlighted Details

  • Achieves up to 11% relative gains over strong RAG baselines on long-context narrative benchmarks (200K+ tokens).
  • Supports diverse LLMs (OpenAI, vLLM) and embedding models (local/remote).
  • Features graph-augmented retrieval and reasoning capabilities.
  • Offers flexible data preprocessing, chunking methods, and multiple evaluation metrics (F1, EM).
  • Modular and extensible design facilitates customization and integration.

Maintenance & Community

The project is marked as active. Contributions are welcomed via Issues or Pull Requests. No specific community channels (like Discord/Slack) or notable contributors/sponsorships are listed in the README.

Licensing & Compatibility

The project is released under the MIT License, which generally permits broad use, modification, and distribution, including for commercial purposes, with minimal restrictions.

Limitations & Caveats

A known issue exists with remote embedding models deployed via vLLM, where missing local tokenizer files can cause failures. Planned features include support for additional embedding model providers.

Health Check
Last Commit

2 months ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
28 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.