| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
By Samuel Yeh and Sharon Li.
This codebase is the official implementation for the paper, "How Retrieved Context Shapes Internal Representations in RAG." It covers the main experiment pipeline:
Supported datasets are trivia, nq, pop, and strategy.
Supported models are gemma3-27B, llama4-17B, qwen3-80B, plus their -base variants.
Run commands from the repository root.
python generate_question_only.py --dataset trivia --model gemma3-27B --root .
python prepare_retrieval_data.py --dataset trivia --root .We use the MassiveDS retrieval-scaling pipeline to retrieve documents. After exporting queries with prepare_retrieval_data, run retrieval with RulinShao/retrieval-scaling; see that repository for setup and execution details. The downstream scripts expect the retrieval output as a JSONL file with ctxs.
After retrieval writes the JSONL file, categorize documents:
export AZURE_OPENAI_ENDPOINT="..."
export AZURE_OPENAI_API_KEY="..."
python categorize_retrieved_documents.py \
--dataset trivia \
--root . \
--retrieved-jsonl retrieved_results/post_processed/dedup_merged_trivia_top1000.jsonlGenerate retrieval answers, judge them, and extract representations:
python generate_with_retrieval.py \
--dataset trivia \
--model gemma3-27B \
--root . \
--retrieved-jsonl retrieved_results/post_processed/dedup_merged_trivia_top1000.jsonl
python extract_prompt_representations.py \
--dataset trivia \
--model gemma3-27B \
--difficulty correct \
--root .Plot scripts are under plot_scripts, or use the shared CLI:
python plotting.py single-last --root .
python plotting.py multiple-last --root .
python plotting.py single-diff-layer --root .
python plotting.py sim-vs-response --root .| Back | FazBrowse Home | New Git URL |