Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Decentralized Meta-Analysis Framework

A multi-agent system for biomedical research that transforms academic papers into interactive agents to conduct unbiased meta-analyses through structured discussions.

System Architecture

┌─────────────────────────────────────────────────────────────────────────┐
│                        DECENTRALIZED META-ANALYSIS                       │
└─────────────────────────────────────────────────────────────────────────┘
                                    │
                                    ▼
┌─────────────────┐         ┌──────────────┐         ┌──────────────────┐
│  PDF Processing │         │  Structured  │         │  Agent Creation  │
│                 │──OCR───▶│  Extraction  │──Data──▶│                  │
│  (Mistral OCR)  │         │  (LM Studio) │         │  (Paper Agents)  │
└─────────────────┘         └──────────────┘         └──────────────────┘
                                                                │
                                                                ▼
┌─────────────────────────┐                        ┌─────────────────────┐
│                         │                        │                     │
│  Meta-Analysis Report   │◀────Synthesis──────────│  Agent Discussion   │
│                         │                        │                     │
└─────────────────────────┘                        └─────────────────────┘
                                                             │
                                                             ▼
                                                     ┌───────────────────┐
                                                     │                   │
                                                     │   Streamlit UI    │
                                                     │   (WhatsApp UI)   │
                                                     │                   │
                                                     └───────────────────┘

Overview

This framework implements an innovative approach to meta-analysis in biomedical research by treating academic papers as intelligent agents in a simulated discussion. Each paper becomes a "personified agent" that can express its findings, methodologies, and limitations, leading to a more nuanced and potentially less biased synthesis of research.

Key Features

  • PDF Processing: Batch extraction of text from academic papers using Mistral OCR
  • Personified Papers: Transform research papers into interactive agents with distinct perspectives
  • Group Discussion: Multi-agent framework where papers engage in structured discussions
  • Bias Reduction: Decentralized approach helps mitigate researcher bias in meta-analysis
  • WhatsApp-like UI: Intuitive interface to observe and follow agent discussions
  • Structured Output: Comprehensive meta-analysis reports synthesized from discussions

Installation

  1. Clone the repository:

    git clone https://github.com/username/decentralized-meta-analysis.git
    cd decentralized-meta-analysis
  2. Install the required dependencies:

    pip install -r requirements.txt
  3. Set up your environment variables:

    cp .env.template .env
  4. Edit the .env file with your API keys:

    MISTRAL_API_KEY=your_mistral_api_key_here
    OPENAI_API_KEY=your_openai_api_key_here
    # Or if using LM Studio locally:
    LM_STUDIO_URL=http://localhost:1234/v1
    LM_STUDIO_MODEL=your_model_name_here
    

Processing Options

This framework offers two methods for processing PDFs:

1. Batch Processing

  • Description: Process multiple PDFs simultaneously in a single batch API call
  • Advantages: Faster, more efficient for large numbers of papers
  • Disadvantages: Higher API costs, as Mistral batch processing is priced per batch
  • Best for: Large meta-analyses, time-sensitive projects, production environments

2. Sequential Processing (Budget-Friendly)

  • Description: Process PDFs one at a time with individual API calls
  • Advantages: Lower cost, better for smaller projects, easier to monitor progress
  • Disadvantages: Slower, especially for many papers
  • Best for: Small meta-analyses, academic projects, testing environments

Usage

Using the Streamlit UI (Recommended)

Launch the application with the Streamlit interface:

streamlit run app.py -- --ui

Note: The UI defaults to sequential (budget-friendly) processing. You can toggle this option in the UI before starting the meta-analysis.

The UI allows you to:

  1. Upload PDFs: Select multiple academic papers for analysis
  2. Define Research Question: Specify what you want to investigate
  3. Choose Processing Method: Select batch (faster) or sequential (budget-friendly) processing
  4. Run Meta-Analysis: Start the agent-based discussion process
  5. View Discussion: Watch the conversation in a chat-like interface
  6. Review Results: Examine the synthesized meta-analysis report
  7. Save/Load Discussions: Store and retrieve previous analyses

Command Line Usage

For more advanced or automated workflows:

# Process PDFs and run a meta-analysis (using batch processing)
python app.py --pdf_dir path/to/pdfs --output_dir path/to/output --question "What is the effectiveness of treatment X on outcome Y?" --discussion_output results/discussion.json

# Use budget-friendly sequential processing instead
python app.py --pdf_dir path/to/pdfs --output_dir path/to/output --question "What is the effectiveness of treatment X on outcome Y?" --discussion_output results/discussion.json --sequential

# View specific saved discussion
streamlit run app.py -- --ui --load_discussion results/discussion.json

System Components

1. PDF Processing (src/ocr/)

  • Mistral OCR Integration: Converts PDF documents to text
  • Dual Processing Options:
    • Batch Processing: Fast processing for multiple papers
    • Sequential Processing: Budget-friendly option for processing one file at a time
  • Structured Text Extraction: Preserves document structure

2. Structured Data Extraction (src/extraction/)

  • LLM-Powered Extraction: Uses LM Studio/OpenAI to extract structured data
  • Paper Model: Standardized representation of academic papers
  • Domain-Specific Understanding: Recognizes research components

3. Agent Framework (src/agents/)

  • Paper Agent: Represents each paper with its own perspective
  • Discussion Orchestrator: Manages multi-agent conversations
  • Phase-Based Discussion: Structured approach to meta-analysis

4. User Interface (src/ui/)

  • WhatsApp-like Chat: Familiar messaging interface
  • Real-time Updates: Follow discussions as they happen
  • Interactive Elements: Upload, process, and analyze papers

Technical Details

Discussion Flow

The agent discussion follows these structured phases:

  1. Introduction Phase: Agents introduce key methodologies and findings
  2. Methodology Comparison: Analysis of research methods across papers
  3. Results Analysis: Discussion of outcomes and effect sizes
  4. Limitations Discussion: Critical examination of study limitations
  5. Synthesis: Collaborative development of conclusions

Agent Characteristics

Each paper agent is defined by:

  • Methodological Rigor: Assessment of study design quality
  • Certainty Level: Confidence in results based on statistical significance
  • Key Perspective: Unique contribution to the research question
  • Memory: Awareness of the ongoing discussion context

Customization

The framework is highly customizable:

  • Discussion Phases: Modify or extend the standard discussion phases
  • Agent Behavior: Adjust how agents interpret and express their papers
  • Meta-Analysis Format: Customize the structure of the final report
  • UI Appearance: Modify the Streamlit interface to match your needs

Troubleshooting

Common Issues

  • API Rate Limits: If hitting Mistral API limits, reduce batch size or add delays
  • Memory Issues: For large papers, consider text chunking
  • Model Responses: If agent responses are low quality, try different LLM models
  • OCR Quality: For poor quality PDFs, consider pre-processing with image enhancement

Cost Optimization

  • Use Sequential Processing: For small projects (1-10 papers), use the sequential processing option to minimize costs
  • Batch Pricing Structure: Mistral's batch processing is priced per batch, so it's more cost-effective for large numbers of papers
  • API Usage Monitoring: Set up monitoring to track API usage and costs
  • Caching Results: Enable saving processed files to avoid re-processing the same PDFs

Debugging

Set the DEBUG environment variable to True to enable detailed logging:

DEBUG=True streamlit run app.py -- --ui

Requirements

  • Python 3.8+
  • Mistral API key (for OCR)
  • OpenAI API key or local LM Studio installation
  • 8GB+ RAM recommended for processing multiple papers

License

  • see the LICENSE file for details.

Citation

If you use this framework in your research, please cite:

@software{decentralized-meta-analysis,
  author = {Your Name},
  title = {Decentralized Meta-Analysis: A Multi-Agent Approach to Biomedical Research Synthesis},
  year = {2025},
  url = {https://github.com/username/decentralized-meta-analysis}
}

Acknowledgments

  • Inspired by advances in multi-agent AI systems for scientific research
  • Built with Mistral AI's OCR capabilities and OpenAI's language models
  • Streamlit for the interactive user interface

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages