DeepReviewer 2.0 Documentation

repository·main·Indexed 19 days ago

https://github.com/researai/deepreviewer-v2

An end-to-end system for human-like, deep-thinking paper reviews using LLMs. The pipeline converts PDFs to markdown via MinerU, employs an agentic tool-loop for reasoning (searching, reading, and annotating), and exports publication-quality PDF reports. It supports multiple paper-search providers, including the recommended DeepXiv and a local PASA retrieval stack consisting of vLLM inference services and a Flask orchestrator.

Tokens
8.9K
Snippets
25
Records
38
Agent score
66%

What's inside DeepReviewer 2.0

  1. Understand DeepReviewer job output artifacts

    main

    Each review job is persisted in data/jobs/<job_id>/. The following files are generated:

    • final_report.md: The final review in Markdown format.
    • final_report.pdf: A publication-style PDF including:
      • Final markdown content
      • Token usage summary (input/output/total/requests)
      • Original paper appendix pages
      • Auto-rendered review overlays (if MinerU line bboxes are available)
    • events.jsonl: A log of events and tool usage for debugging.
  2. Understand the PASA Tool Decoupling Architecture

    main

    The PASA tool has migrated from a heavy, single-process model to a client-server architecture using vLLM resident inference.

    Old Architecture (pasa_tool_heavy.py): The model was loaded into GPU memory every time the tool was called, resulting in high latency (60-180s) for the first call.

    New Architecture (vLLM Decoupled):

    1. DirectorAgent (MCP) calls a lightweight HTTP client (pasa_tool.py).
    2. pasa_tool.py sends an HTTP request to the pasa_server.py (a Flask orchestration service).
    3. pasa_server.py communicates with vLLM (OpenAI Server) where the crawler and selector models are permanently resident in GPU memory.

    Benefits:

    • Reduced Latency: Subsequent calls only incur search time (30-120s) because models are pre-loaded.
    • High Concurrency: Supports multiple concurrent requests via Flask multi-threading.
    • Resource Isolation: GPU management is independent of the main process, allowing for remote deployment on dedicated GPU servers.
  3. Understand Retrieval-Disabled Mode

    main

    If PAPER_SEARCH_ENABLED is set to false, or if the selected provider (like DeepXiv or PASA) is not ready/healthy, DeepReviewer enters Retrieval-Disabled Mode.

    Instead of retrying external retrieval, the paper_search tool returns a specific status indicating the run will proceed using only the provided manuscript.

    Implications:

    • The review run continues, but it is strictly manuscript-grounded.
    • Claims regarding novelty and related-work should be treated as requiring deferred manual verification, as the agent cannot fetch external papers to validate them.
    {
      "status": "not_started",
      "reason": "paper_search_not_started",
      "next_action": "enter_retrieval_disabled_mode"
    }
  4. Install DeepReviewer 2.0

    main

    To install DeepReviewer 2.0 locally, create a virtual environment, activate it, and install the package in editable mode from the repository root.

    cd <repo_root>
    python -m venv .venv
    source .venv/bin/activate
    pip install --upgrade pip
    pip install -e .
  5. Install and deploy PASA locally

    main

    PASA (adapted for DeepReviewer-2.0) provides a service layout consisting of two vLLM OpenAI-compatible inference services (crawler and selector) and a Flask orchestrator.

    Requirements

    • Linux + NVIDIA GPU
    • Python 3.10+ (3.11 recommended)
    • Working CUDA environment
    • Network access to Hugging Face, arXiv, and Serper

    Installation Steps

    1. Install Dependencies: Run the following in your Python environment:
    cd <repo_root>/pasa
    pip install --upgrade pip
    pip install \
      torch transformers \
      vllm "openai>=1.52,<1.76" \
      flask flask-cors \
      requests httpx arxiv \
      beautifulsoup4 lxml
    1. Download Models: Use huggingface-cli to download the crawler and selector models to local directories:
    # crawler
    huggingface-cli download bytedance-research/pasa-7b-crawler --local-dir /data/models/pasa-7b-crawler
    
    # selector
    huggingface-cli download bytedance-research/pasa-7b-selector --local-dir /data/models/pasa-7b-selector
    1. Prepare Data: Download the official PASA dataset (e.g., cs_paper_2nd.zip and id2paper.json) and store them locally.

    2. Configure Environment: Copy the example environment file and edit it with your local paths and keys:

    cd <repo_root>/pasa
    cp .pasa_env.example .pasa_env.local
    # Edit .pasa_env.local with your specific settings
    1. Start the Server: Use the unified start script:
    # Foreground (for debugging)
    bash start_pasa_server.sh
    
    # Background (for long-running use)
    bash start_pasa_server.sh --background
    bash
    cd <repo_root>/pasa
    bash start_pasa_server.sh
  6. Configure logging levels for PASA server and MCP tool

    main

    PASA Server Logging

    To enable detailed logging for the PASA server, modify the logging.basicConfig call in pasa_server.py and set the level to DEBUG.

    MCP Tool Logging

    Logging for the MCP tool is managed via the FastMCP framework. To view debug logs during runtime, set the LOG_LEVEL environment variable.

    export LOG_LEVEL=DEBUG
    # In pasa_server.py
    logging.basicConfig(
        level=logging.DEBUG,  # Change to DEBUG for detailed logs
        format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
    )
  7. Configure DeepReviewer 2.0 environment variables

    main

    Copy the example environment file to .env and configure the required settings for LLM, MinerU, and Paper Search providers.

    LLM Configuration (OpenAI-compatible)

    • BASE_URL: The base URL for your OpenAI-compatible service.
    • AGENT_MODEL: The model used for reviewing (e.g., gpt-5.2).
    • OPENAI_API_KEY: Your API key (required if the gateway requires authentication).
    • OPENAI_AGENTS_DISABLE_TRACING: Set to 1 to reduce local gateway tracing noise.

    MinerU Configuration

    Paper Search Configuration

    DeepReviewer supports two providers:

    Set PAPER_SEARCH_PROVIDER=deepxiv and provide:

    • DEEPXIV_API_TOKEN: Your DeepXiv API token.
    • DEEPXIV_API_BASE_URL: Defaults to https://data.rag.ac.cn.
    • DEEPXIV_RETRIEVE_TOP_K: Number of papers to retrieve.

    2. PASA (Advanced/Local)

    Set PAPER_SEARCH_PROVIDER=pasa and provide:

    • PAPER_SEARCH_BASE_URL: The URL of your local PASA service.
    • PAPER_SEARCH_ENDPOINT: The search endpoint (e.g., /pasa/search).
    • PAPER_SEARCH_HEALTH_ENDPOINT: The health check endpoint.
    cp .env.example .env
  8. Start the PASA vLLM and Flask Server

    main

    You can start the PASA server using the provided shell script. There are two modes:

    1. Foreground Mode (Recommended for debugging): Outputs logs directly to the terminal and stops with Ctrl+C.

    cd <repo_root>/pasa
    bash start_pasa_server.sh

    2. Background Mode (Recommended for production): Runs in the background, saves logs to /tmp/pasa_server.log, and saves the PID to /tmp/pasa_server.pid.

    cd <repo_root>/pasa
    bash start_pasa_server.sh --background

    Managing the Background Process:

    • View logs: tail -f /tmp/pasa_server.log
    • Stop server: kill $(cat /tmp/pasa_server.pid) && rm /tmp/pasa_server.pid
    # Foreground
    cd <repo_root>/pasa
    bash start_pasa_server.sh
    
    # Background
    cd <repo_root>/pasa
    bash start_pasa_server.sh --background
  9. Configure DeepXiv as the Paper Search Provider

    main

    DeepXiv is the recommended path for the simplest setup as it does not require a local PASA model service. To use it, you must provide a DeepXiv API token and configure the following environment variables in your .env file.

    Startup Behavior:

    • DeepReviewer performs a health check via GET {DEEPXIV_API_BASE_URL}/stats/usage.
    • If the token is missing, the tool returns status=not_started with availability=missing_api_token.
    • If the health check fails, it returns status=not_started with availability=health_check_failed.

    Search Behavior:

    • The tool supports question_list (up to 3 distinct questions), which are merged into a single deduplicated result list.
    • Results are normalized to include: title, abstract, arxiv_id, url, abs_url, pdf_url, authors, categories, citation_count, and provider=deepxiv.
    PAPER_SEARCH_ENABLED=true
    PAPER_SEARCH_PROVIDER=deepxiv
    
    DEEPXIV_API_BASE_URL=https://data.rag.ac.cn
    DEEPXIV_API_TOKEN=your_deepxiv_token
    DEEPXIV_REQUEST_TIMEOUT_SECONDS=60
    DEEPXIV_RETRIEVE_TOP_K=8
    DEEPXIV_DEFAULT_SOURCE=arxiv
  10. Configure PASA as the Paper Search Provider

    main

    Use the PASA path if you intend to run the PASA model service locally. This requires installing PASA extras and running the PASA server separately.

    Setup Steps:

    1. Install PASA extras: pip install -e ".[pasa]".
    2. Configure the PASA environment by copying pasa/.pasa_env.example to pasa/.pasa_env and editing model paths, ports, GPU selection, Serper token, and proxy settings.
    3. Start the server: cd pasa && bash start_pasa_server.sh --background.
    4. Configure DeepReviewer environment variables to point to your local service.

    Startup Behavior:

    • DeepReviewer checks health via GET {PAPER_SEARCH_BASE_URL}{PAPER_SEARCH_HEALTH_ENDPOINT}.
    • If the health check fails, the tool returns status=not_started and the review proceeds in Retrieval-Disabled Mode.

    Search Behavior:

    • The tool sends a POST request to {PAPER_SEARCH_BASE_URL}{PAPER_SEARCH_ENDPOINT} with a JSON payload containing query and question_list.
    # 1. Install extras
    pip install -e ".[pasa]"
    
    # 2. Configure PASA environment
    cp pasa/.pasa_env.example pasa/.pasa_env
    
    # 3. Start PASA server
    cd pasa
    bash start_pasa_server.sh --background
    
    # 4. Configure DeepReviewer
    PAPER_SEARCH_ENABLED=true
    PAPER_SEARCH_PROVIDER=pasa
    PAPER_SEARCH_BASE_URL=http://127.0.0.1:8001
    PAPER_SEARCH_API_KEY=
    PAPER_SEARCH_ENDPOINT=/pasa/search
    PAPER_SEARCH_TIMEOUT_SECONDS=120
    PAPER_SEARCH_HEALTH_ENDPOINT=/health
    PAPER_SEARCH_HEALTH_TIMEOUT_SECONDS=5
  11. Install and set up PASA for DeepReviewer-2.0

    main

    To run the PASA service locally, follow these steps:

    1. Install Dependencies: Ensure you are in a Python 3.10+ environment with an NVIDIA GPU and CUDA installed. Run:
      cd <repo_root>/pasa
      pip install --upgrade pip
      pip install torch transformers vllm "openai>=1.52,<1.76" flask flask-cors requests httpx arxiv beautifulsoup4 lxml
    2. Download Models: Use huggingface-cli to download the required models:
      # crawler
      huggingface-cli download bytedance-research/pasa-7b-crawler --local-dir /data/models/pasa-7b-crawler
      
      # selector
      huggingface-cli download bytedance-research/pasa-7b-selector --local-dir /data/models/pasa-7b-selector
    3. Prepare Paper Database: Download the required paper DB files (e.g., cs_paper_2nd.zip and id2paper.json) and place them in a local directory.
    4. Configure Environment: Copy the example environment file and edit it with your local paths and API keys:
      cd <repo_root>/pasa
      cp .pasa_env.example .pasa_env.local
      vim .pasa_env.local
    cd <repo_root>/pasa
    pip install --upgrade pip
    pip install \
      torch transformers \
      vllm "openai>=1.52,<1.76" \
      flask flask-cors \
      requests httpx arxiv \
      beautifulsoup4 lxml
  12. Integrate PASA with DeepReviewer

    main

    To allow DeepReviewer to use your local PASA service, configure the following environment variables in your DeepReviewer root directory's .env file:

    # The base URL of your PASA Flask server
    PAPER_SEARCH_BASE_URL=http://127.0.0.1:8001
    
    # The search endpoint path
    PAPER_SEARCH_ENDPOINT=/pasa/search
    
    # Optional API key if required
    PAPER_SEARCH_API_KEY=
    PAPER_SEARCH_BASE_URL=http://127.0.0.1:8001
    PAPER_SEARCH_ENDPOINT=/pasa/search
    PAPER_SEARCH_API_KEY=