A course research project on cultural question answering with Llama-3-8B. I simplified brittle output prompts, converted multiple-choice training examples into direct question-answer pairs, fine-tuned the model with LoRA, and retrieved the three closest examples for each query. Short-answer accuracy rose from 0.49 to 0.65, while multiple-choice accuracy remained unchanged.
Problem
Large language models struggle with geographic and cultural nuance because of representation gaps in their pre-training corpora. On top of that, smaller open-weights models around 8B parameters drift away from complex zero-shot formatting instructions, which breaks automated evaluation.
Approach
Replaced the brittle formatting constraints with natural instruction layouts and built a dynamic few-shot retrieval framework. The reference corpus is restructured into clean query-response pairs, and at inference time the pipeline retrieves the three most semantically relevant exemplars and injects them into the prompt.
Outcome
The final pipeline improved short-answer accuracy from 0.49 to 0.65. Dynamic retrieval delivered the largest gain, while external web search reduced accuracy by three to five percentage points and was dropped from the final system.
Architecture
Llama-3-8B with 4-bit quantization for efficiency, MiniLM-L6-v2 for semantic embedding and retrieval. A data augmentation stage strips multiple-choice options from the training data to create direct query-response pairs. Inference uses greedy search for deterministic, concise outputs that satisfy the evaluation script.