• 2 min read

ArXiv Copilot

Question answering over AI papers where every sentence cites its source, with a QLoRA-tuned Gemma-2-2B and an evaluation I can audit.

RAGQLoRAGemmaFAISSFastAPIEvals

ArXiv Copilot answering a question, with the sources it used

What it is

You ask a question about the indexed papers. The answer marks each claim with [Context N], pointing at the passage that supports it. If the passages don’t contain the answer, it should say so instead of guessing.

The papers come from QASPER, a benchmark of questions about NLP papers. The index holds 25,212 chunks.

The fine-tune is QLoRA in 4-bit NF4 with rank 16 on the attention and MLP layers. The adapter is 41 MB and trains in 10 to 20 minutes on one GPU. It is published on Hugging Face. The model is served through FastAPI with server-sent events and a Streamlit UI.

Results

All four setups ran on the same 150 questions. The eval file is fingerprinted, and every prediction is saved, so each number can be checked example by example.

SetupRecall@3Sentences citedValid citationsRefuses when unanswerablep50 latency
Base, FAISS16.0%91.6%98.0%11.5%1384 ms
Base, reranked14.0%89.3%96.7%11.5%1417 ms
Fine-tuned, FAISS16.0%61.6%85.3%11.5%1165 ms
Fine-tuned, reranked14.0%62.4%84.7%19.2%1011 ms

What I learned:

  • Retrieval loses the evidence at the cut to three. The right passage is somewhere in the top 20 for 51.3% of questions, but in the final top 3 only about 20% of the time. The reranker barely helped, so a better reranker or query rewriting would help more than better embeddings.
  • At 2B, a good prompt beat fine-tuning on citations. The prompted base model cited 91.6% of sentences. Fine-tuning made answers shorter and generation 28% faster, but citation rate dropped to about 62%.
  • Refusals are hard to train. Even with refusals at 35% of the training data over two epochs, refusing unanswerable questions only rose from 11.5% to 19.2%.

Three training runs

RunChangeOutcome
v1raw QASPER answers as targetscitation rate fell from about 92% to 0%
v2targets relabeled with citation markersrecovered to 64%, but training used one context while inference used three
v3three contexts per example with distractors from the same paper, correct citation indexes, 35% refusals, two epochsthe final model in the table

v1 is the clearest lesson. Fine-tuning learns what the targets show, and the raw answers had no citations in them, so the model unlearned a behavior the base model already had.

Limits

150 questions from one benchmark is enough to see direction, not to claim significance. Evidence matching is lexical, so paraphrased evidence gets undercounted.

Back to top