Primeqa
The prime repository for state-of-the-art Multilingual Question Answering research and development.
Install / Use
/learn @primeqa/PrimeqaREADME
PrimeQA is a public open source repository that enables researchers and developers to train state-of-the-art models for question answering (QA). By using PrimeQA, a researcher can replicate the experiments outlined in a paper published in the latest NLP conference while also enjoying the capability to download pre-trained models (from an online repository) and run them on their own custom data. PrimeQA is built on top of the Transformers toolkit and uses datasets and models that are directly downloadable.
The models within PrimeQA supports End-to-end Question Answering. PrimeQA answers questions via
- Information Retrieval: Retrieving documents and passages using both traditional (e.g. BM25) and neural (e.g. ColBERT) models
- Multilingual Machine Reading Comprehension: Extract and/ or generate answers given the source document or passage.
- Multilingual Question Generation: Supports generation of questions for effective domain adaptation over tables and multilingual text.
- Retrieval Augmented Generation: Generate answers using the GPT-3/ChatGPT pretrained models, conditioned on retrieved passages.
Some examples of models (applicable on benchmark datasets) supported are :
- Traditional IR with BM25 Pyserini
- Neural IR with ColBERT, DPR (collaboration with Stanford NLP IR led by Chris Potts & Matei Zaharia). Replicating the experiments that Dr. Decr (Li et. al, 2022) performed to reach the top of the XOR TyDI leaderboard.
- Machine Reading Comprehension with XLM-R: to replicate the experiments to get to the top of the TyDI leaderboard similar to the performance of the IBM GAAMA system. Coming soon: code to replicate GAAMA's performance on Natural Questions.
🏅 Top of the Leaderboard
PrimeQA is at the top of several leaderboards: XOR-TyDi, TyDiQA-main, OTT-QA and HybridQA.
XOR-TyDi
<img src="docs/_static/img/xor-tydi.png" width="50%">TyDiQA-main
<img src="docs/_static/img/tydi-main.png" width="50%">OTT-QA
<img src="docs/_static/img/ott-qa.png" width="50%">HybridQA
<img src="docs/_static/img/hybridqa.png" width="50%">✔️ Getting Started
Installation
# cd to project root
# If you want to run on GPU make sure to install torch appropriately
# E.g. for torch 1.11 + CUDA 11.3:
pip install 'torch~=1.11.0' --extra-index-url https://download.pytorch.org/whl/cu113
# Install as editable (-e) or non-editable using pip, with extras (e.g. tests) as desired
# Example installation commands:
# Minimal install (non-editable)
pip install .
# GPU support
pip install .[gpu]
# Full install (editable)
pip install -e .[all]
Please note that dependencies (specified in setup.py) are pinned to provide a stable experience. When installing from source these can be modified, however this is not officially supported.
Note: in many environments, conda-forge based faiss libraries perform substantially better than the default ones installed with pip. To install faiss libraries from conda-forge, use the following steps:
- Create and activate a conda environment
- Install faiss libraries, using a command
conda install -c conda-forge faiss=1.7.0 faiss-gpu=1.7.0
- In
setup.py, remove the faiss-related lines:
"faiss-cpu~=1.7.2": ["install", "gpu"],
"faiss-gpu~=1.7.2": ["gpu"],
- Continue with the
pip installcommands as desctibed above.
JAVA requirements
Java 11 is required for BM25 retrieval. Install java as follows:
conda install -c conda-forge openjdk=11
:speech_balloon: Blog Posts
There're several blog posts by members of the open source community on how they've been using PrimeQA for their needs. Read some of them:
🧪 Unit Tests
To run the unit tests you first need to install PrimeQA.
Make sure to install with the [tests] or [all] extras from pip.
From there you can run the tests via pytest, for example:
pytest --cov PrimeQA --cov-config .coveragerc tests/
For more information, see:
🔭 Learn more
| Section | Description |
|-|-|
| 📒 Documentation | Full API documentation and tutorials |
| 🏁 Quick tour: Entry Points for PrimeQA | Different entry points for PrimeQA: Information Retrieval, Reading Comprehension, TableQA and Question Generation |
| 📓 Tutorials: Jupyter Notebooks | Notebooks to get started on QA tasks |
| 📓 GPT-3/ChatGPT Reader Notebooks | Notebooks to get started with the GPT-3/ChatGPT reader components|
| 💻 Examples: Applying PrimeQA on various QA tasks | Example scripts for fine-tuning PrimeQA models on a range of QA tasks |
| 🤗 Model sharing and uploading | Upload and share your fine-tuned models with the community |
| ✅ Pull Request | PrimeQA Pull Request |
| 📄 Generate Documentation | How Documentation works |
| 🛠 Orchestrator Service REST Microservice | Proof-of-concept code for PrimeQA Orchestrator microservice |
| 📖 Tooling UI | Demo UI |
❤️ PrimeQA collaborators include
| | | | | |:-------------------------:|:-------------------------:|:-------------------------:|:-------------------------:| |<img width="75" alt="stanford" src="docs/_static/img/collab-stanford-circle.png">| Stanford NLP |<img width="75" alt="i" src="docs/_static/img/collab-i-circle.png">| University of Illinois | |<img width="75" alt="stuttgart" src="docs/_static/img/collab-stuttgart-circle.png">| University of Stuttgart | <img width="75" alt="notredame" src="docs/_static/img/collab-notredame-circle.png">| University of Notre Dame | |<img width="75" alt="ohio" src="docs/_static/img/collab-ohio-circle.png">| Ohio State University |<img width="75" alt="carnegie" src="docs/_static/img/collab-carnegie-circle.png">| Carnegie Mellon University | |<img width="75" alt="massachusetts" src="docs/_static/img/collab-massachusetts-circle.png">| University of Massachusetts |<img width="75" height="75" alt="ibm" src="docs/_static/img/collab-ibm-circle.png">| IBM Research | | | | | |
<br> <br> <br> <br> <div align="center"> <img width="30" alt="primeqa" src="docs/_static/primeqa_logo.png"> </div>Related Skills
node-connect
339.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
claude-opus-4-5-migration
83.8kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
frontend-design
83.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
model-usage
339.1kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
