A research project on improving Llama-3-8B's cultural reasoning. LLMs tend to carry cultural alignment biases from Western-dominated training corpora. I built a pipeline that combines dynamic retrieval-augmented generation (RAG) with targeted LoRA fine-tuning, improving short-answer accuracy by 16% over the zero-shot baseline.
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 combination of LoRA fine-tuning and dynamic RAG beat the baseline models on the strict verification metrics, with a 16% absolute accuracy improvement on the short-answer evaluation suite.
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.