LaTeX source and build instructions for the CS505 milestone reports are in reports/.
The repo uses src/qasper_rag/config.py to resolve three path classes:
- shared team data:
/projectnb/cs505am/projects/nlp_research_project - per-user SCC work:
/projectnb/cs505am/students/$USER/... - local fallback paths under
data/when SCC is not mounted
Shared QASPER artifacts live in:
/projectnb/cs505am/projects/nlp_research_project/qasper
The user project root on SCC is detected in this order:
NLP_PROJECT_USER_ROOTif set/projectnb/cs505am/students/$USER/zukhriddin_nlp_research_projectif it exists/projectnb/cs505am/students/$USER/nlp_research_projectif it exists
The shared project root on SCC is detected in this order:
NLP_PROJECT_SHARED_ROOTif set/projectnb/cs505am/projects/zukhriddin_nlp_research_projectif it exists/projectnb/cs505am/projects/nlp_research_projectif it exists
That keeps old and renamed SCC project folders working without hardcoding one path.
To inspect the paths the repo will use:
python3 scripts/show_project_paths.pyRecommended .condarc on SCC:
envs_dirs:
- /projectnb/cs505am/students/$USER/.conda/envs
- ~/.conda/envs
pkgs_dirs:
- /projectnb/cs505am/students/$USER/.conda/pkgs
- ~/.conda/pkgs
env_prompt: ({name})Create the environment:
chmod +x setup_env.sh
./setup_env.shDefaults:
- environment name:
rag_envunlessENV_NAMEis set - Hugging Face cache:
/projectnb/cs505am/students/$USER/.cache/huggingface - user project root: detected automatically as described above
The shared SCC dataset path is intentionally under projects/, not materials/, because materials/ is not student-writable.
Implemented under src/qasper_rag/:
loader.py: raw-file and Hugging Face QASPER loadersschema.py: normalized paper/question/answer dataclasseschunking.py: fixed, sliding-window, and section-aware chunkersprocessing.py: deterministic processed split builder
Shared deterministic outputs should live in:
/projectnb/cs505am/projects/nlp_research_project/qasper/processed
Those artifacts are the team-shared interface for retrieval and generation. Personal model caches, indexes, and run outputs should stay in each student directory.
Useful commands:
./scripts/prepare_shared_qasper.shpython3 scripts/build_qasper_processed.py --split allPYTHONPATH=src python3 scripts/preview_qasper_chunking.py \
--input /projectnb/cs505am/projects/nlp_research_project/qasper/extracted/qasper-train-v0.3.json \
--strategy section \
--paper-limit 2 \
--show-chunks 2Retrieval reads from:
/projectnb/cs505am/projects/nlp_research_project/qasper/processed
and writes user-specific outputs under:
/projectnb/cs505am/students/$USER/.../runs/retrieval
Implemented stack:
- BM25
- dense retrieval with
BAAI/bge-small-en-v1.5 - hybrid RRF
- cross-encoder reranking with
cross-encoder/ms-marco-MiniLM-L-6-v2 - metrics: Recall@5, MRR@10, evidence hit rate
Current best retrieval setting:
- default retriever for generation:
hybrid
Example commands:
python scripts/evaluate_qasper_retrieval.py \
--split validation \
--strategy section \
--method hybridpython scripts/evaluate_qasper_retrieval.py \
--split validation \
--strategy section \
--method hybrid_rerank \
--top-k 5 \
--mrr-k 10 \
--retrieval-depth 20Batch usage on SCC:
mkdir -p logs
qsub -N qasper_dense_val -o logs/qasper_dense_val.log scripts/qsub_qasper_retrieval.sh dense validation sectionImplemented files:
src/qasper_rag/generation.pysrc/qasper_rag/generation_eval.pyscripts/evaluate_qasper_generation.pyscripts/qsub_qasper_generation.sh
Prompt styles:
baselinecitation_forcing
Current generation behavior includes:
- prompt context compression to question-relevant sentences
- exact normalization for
yes,no, andunanswerablewhen the model clearly intends them - citation parsing and citation-to-chunk mapping
- stricter citation-mode fallback for uncited answers
Interactive example:
python scripts/evaluate_qasper_generation.py \
--split validation \
--strategy section \
--retrieval-method hybrid \
--prompt-style baseline \
--generation-model microsoft/Phi-3.5-mini-instructSCC batch example:
qsub -N qasper_gen_val -o logs/qasper_gen_val.log \
scripts/qsub_qasper_generation.sh hybrid citation_forcing validation sectionReliable sampled SCC run:
qsub -N qasper_gen_sample -o logs/qasper_gen_sample.log \
scripts/qsub_qasper_generation.sh hybrid citation_forcing validation section 5 20 100 2048 1200 128The positional arguments after retrieval depth are:
question_limitmax_input_tokensmax_context_tokensmax_new_tokens
That avoids the SCC issue where QUESTION_LIMIT=... qsub ... in the submit shell does not reliably propagate into the batch job unless -v is used.
Empirically verified on academic-gpu with microsoft/Phi-3.5-mini-instruct:
- queue:
academic-gpu - resources that worked:
1 GPU,4 omp slots,2h - current safe generation settings:
--max-input-tokens 2048--max-context-tokens 1200--max-new-tokens 128
attn_implementation='eager'is used on CUDA becauseflash-attnis not installed on the current SCC setup
If you increase the context budget substantially, expect a higher OOM risk on SCC GPUs.
Best full-validation generation runs so far on section chunks with hybrid retrieval:
- baseline:
- token F1
0.3187 - hallucination rate
0.4657 - supported answer rate
0.7612
- token F1
- citation forcing:
- token F1
0.3167 - citation precision
0.3423 - citation rate
0.9254 - hallucination rate
0.5572 - supported answer rate
0.5741
- token F1
Interpretation:
- baseline is currently the better answer-quality setting
- citation forcing is currently the better citation-behavior setting
- the next high-value experiments are citation post-processing,
hybrid_rerankgeneration, and then Qwen model comparisons