PaperQA2 — Local Scientific RAG
PaperQA2 is the open-source, self-hostable engine that powers FutureHouse's Crow agent. It does retrieval-augmented generation over a local folder of PDFs / Office docs / source code, with metadata enrichment from Crossref + Semantic Scholar + Unpaywall and per-chunk LLM re-ranking. State-of-the-art on scientific QA benchmarks (LitQA2, WikiCrow assessment).
Use this skill when the user wants:
- Q&A over a private / local PDF corpus (no upload to a SaaS)
- Cited answers without paying per-call platform credits
- Full control over models, prompts, indexing, and storage
- Programmatic / batch operation
For one-shot questions over the public literature with zero setup, use the sibling crow-literature-qa skill instead.
Install
pip install "paper-qa>=5"
Python ≥ 3.11 required. PaperQA2 uses LiteLLM for model routing — set the appropriate key:
export OPENAI_API_KEY=sk-... # default
# or
export ANTHROPIC_API_KEY=sk-ant-... # configure model in Settings
For large corpora (100+ papers), also export CROSSREF_API_KEY and SEMANTIC_SCHOLAR_API_KEY to avoid rate limits during metadata fetch.
Quickstart — CLI
mkdir my_papers && cd my_papers
# drop some PDFs in, then:
pqa ask 'What does the literature say about CAR-T persistence in solid tumors?'
PaperQA2 will index the folder, fetch metadata, chunk + embed, and answer with inline citations. Index is cached in ~/.pqa/ and reused on subsequent calls.
Useful CLI commands:
pqa view # show all current settings
pqa -s fast view # show "fast" preset
pqa --temperature 0.3 ask '...' # one-off override
pqa -s mine --llm gpt-4o save # save your own preset called "mine"
pqa -i answers search 'CAR-T' # search prior answers
Quickstart — Library
from paperqa import Settings, ask
answer = ask(
"What does the literature say about CAR-T persistence in solid tumors?",
settings=Settings(temperature=0.3, paper_directory="./my_papers"),
)
print(answer.formatted_answer)
Async / multi-question:
import asyncio
from paperqa import Docs
async def main():
docs = Docs()
for f in ["paper1.pdf", "paper2.pdf"]:
await docs.aadd(f)
ans = await docs.aquery("What dose was used in study 2?")
print(ans.formatted_answer)
asyncio.run(main())
Recipes
Use Anthropic Claude as the answer model
from paperqa import Settings, ask
ans = ask("...", settings=Settings(
llm="claude-opus-4-5",
summary_llm="claude-opus-4-5",
paper_directory="./my_papers",
))
Local embeddings (no OpenAI key)
from paperqa import Settings
s = Settings(
embedding="sentence-transformers/all-MiniLM-L6-v2",
paper_directory="./my_papers",
)
Build & reuse an index for a large corpus
pqa -i my_corpus index ./my_papers # build once
pqa -i my_corpus ask 'question 1' # then query repeatedly
pqa -i my_corpus ask 'question 2'
Generate Wikipedia-style articles (the WikiCrow recipe)
PaperQA2 was used to generate the wikicrow.ai gene articles. The recipe is sectioned querying:
from paperqa import Docs
sections = ["Function", "Structure", "Clinical significance", "Interactions"]
docs = Docs()
# … add a corpus of papers about your gene of interest …
article = []
for s in sections:
a = docs.query(f"Write a Wikipedia-style '{s}' section for gene FOO based on the literature.")
article.append(f"## {s}\n\n{a.formatted_answer}\n")
print("\n".join(article))
Multimodal: figures, tables, equations
PaperQA2 v5 (Dec 2025+) supports tables, figures, and math via Docling / Nemotron readers. Install with:
pip install "paper-qa[docling]"
# or
pip install "paper-qa[nemotron]"
Demo-friendly first call
mkdir demo && cd demo
curl -o paperqa.pdf https://arxiv.org/pdf/2409.13740
pqa ask 'What is PaperQA2 and what makes it different from PaperQA1?'
Expected output: a paragraph-length answer with [Author Year]-style inline citations and a reference list at the bottom.
Costs
- LLM costs only — no FutureHouse credits.
- A typical answer on a 50-paper corpus costs $0.10–$1 with GPT-4o-class models, or $0 with a local LLM.
Caveats
- First indexing of a large corpus can take 5–30 min as PaperQA2 fetches metadata from Crossref / Semantic Scholar. Subsequent queries are fast.
- Quality of answers depends heavily on the LLM used —
gpt-4o/claude-opusproduce the cleanest citations; smaller models may hallucinate references. - For best results, ensure your PDFs are text-PDFs (not scanned). For scanned PDFs, install with the Docling extra.