Home

Awesome

Colivara Evaluation Project

Evaluation Results

This repository contains a comprehensive evaluation of the Colivara API for document management, search, and retrieval, using a Retrieval-Augmented Generation (RAG) model. This evaluation aims to assess Colivara's capabilities in managing document collections, performing efficient search operations, and calculating relevance metrics to measure performance.

BenchmarkColivaravidore_colqwen2-v1.0 (Current Leader)vidore_colpali-v1.3vidore_colpali
Average87.6 ↓89.384.881.3
Tat DQA71.7 ↓81.470.465.8
Shift Project91.3 ↑90.777.473.2
Artificial Intelligence99.5 ↑99.497.496.2
Government Reports96.7 ↑96.396.292.7
ArxivQA88.1 ↑88.183.079.1
DocVQA56.1 ↓60.658.554.4
Healthcare Industry98.3 ↑98.196.994.4
InfoVQA91.4 ↓92.685.781.8
Energy96.3 ↑95.995.491.0
TabFQuad86.3 ↓89.587.483.9

Table of Contents


Project Overview

The goal of this project is to evaluate Colivara’s document retrieval and management features, particularly for applications that rely on high-performance data search and retrieval. This includes testing Colivara's collection and document management, assessing its suitability for various search and retrieval scenarios, and benchmarking the platform with a RAG model to evaluate relevance based on real-world queries.

Evaluation Results

Below are the summarized evaluation results for the Colivara API performance based on NDCG metrics:

BenchmarkColivara ScoreAvg Latency (s)Num Docs
Average87.6--------
ArxivQA88.111.1500
DocVQA56.19.3500
InfoVQA91.48.6500
Shift Project91.316.81000
Artificial Intelligence99.512.81000
Energy96.314.11000
Government Reports96.714.01000
Healthcare Industry98.320.01000
TabFQuad86.38.1280
TatQA71.720.01663

Features

Requirements

Installation

  1. Clone the repository:

    git clone https://github.com/tjmlabs/colivara-eval.git
    cd colivara-eval
    
  2. Install the dependencies:

    uv venv
    source venv/bin/activate
    uv sync
    
  3. Configure Environment Variables:

    • Create a .env file in the root directory.
    • Add the following variables:
      COLIVARA_API_KEY=your_api_key_here
      COLIVARA_BASE_URL=https://api.colivara.com
      
  4. Download the Dataset:

    • Download the dataset file(s) for evaluation.
    • Run the following command:
    python src/download_datasets.py
    

Usage

The Colivara Evaluation Project provides a streamlined interface for managing and evaluating document collections within Colivara. The primary entry points for usage are upsert.py for performing document upsert operations and evaluate.py for relevance evaluation.

Document Upsert with upsert.py

The upsert.py script enables you to upsert documents into Colivara collections. It allows selective processing of single datasets or batch processing across all available datasets, making it adaptable for various scenarios.

Key Arguments

Example Commands

1. Upserting a Single Dataset

To upsert documents from a specific dataset, run:

python upsert.py --specific_file arxivqa_test_subsampled.pkl --collection_name arxivqa_collection --upsert

This command will upsert all documents from arxivqa_test_subsampled.pkl into arxivqa_collection if it doesn’t already exist.

2. Upserting All Datasets

To upsert documents for all datasets:

python upsert.py --all_files --upsert

This command will loop through all datasets in DOCUMENT_FILES, upserting documents into their corresponding collections.

Relevance Evaluation with evaluate.py

The evaluate.py script is used to evaluate the relevance of document collections within Colivara.

Key Arguments

Example Commands

1. Evaluating a Single Collection

To evaluate the relevance of a specific collection, run:

python evaluate.py  --collection_name arxivqa_test_subsampled

This command will evaluate the specified collection and output the relevance metrics based on NDCG@5. Here is a list of our collection names that are aleady uploaded.

COLLECTION_NAMES = [
    "arxivqa_test_subsampled",
    "docvqa_test_subsampled",
    "infovqa_test_subsampled",
    "shiftproject_test",
    "syntheticDocQA_artificial_intelligence_test",
    "syntheticDocQA_energy_test",
    "syntheticDocQA_government_reports_test",
    "syntheticDocQA_healthcare_industry_test",
    "tabfquad_test_subsampled",
    "tatdqa_test",
]

2. Evaluating All Collections

To evaluate the relevance of all collections:

python evaluate.py --all_files

This command will perform a relevance evaluation (NDCG@5) on all datasets listed in DOCUMENT_FILES and save the results in the out/ directory:

Collection Management with collection_manager.py

The collection_manager.py script provides utilities for listing and deleting collections within Colivara.

Commands

File Structure

Configuration

The project configuration relies on environment variables defined in a .env file:

Use dotenv to load these configurations automatically, ensuring that sensitive information is securely managed.

Technical Details

Discounted Cumulative Gain (DCG)

DCG is a measure of relevance that considers the position of relevant results in the returned list. It assigns higher scores to results that appear earlier.

Normalized Discounted Cumulative Gain (NDCG)

NDCG normalizes DCG by dividing it by the ideal DCG (IDCG) for a given query, providing a score between 0 and 1. In this project, we calculate NDCG@5 to evaluate the top 5 search results for each query.

Search Query Evaluation

The evaluation process includes:

  1. Query Processing: Matching queries against document metadata.
  2. Relevance Scoring: Using true document IDs to calculate relevance scores.
  3. NDCG Calculation: Aggregating scores to calculate the average relevance.

Future Enhancements

  1. Parallel Processing: Optimize data loading and evaluation functions for concurrent processing.
  2. Extended Metrics: Add other evaluation metrics like Mean Reciprocal Rank (MRR).
  3. Benchmarking with Larger Datasets: Test Colivara's scalability with larger data volumes.
  4. Automated Testing: Integrate unit and integration tests for CI/CD compatibility.

License

This project is licensed under the MIT License - see the LICENSE file for details.