Reducing Hallucinations in Domain-Specific QA through a Hybrid Architecture of Fine-Tuned Encoder-Only and Decoder-Only Large Language Models
Izzeldin Rayyan Bastian, Drs. Edi Winarko, M.Sc.,Ph.D.
2026 | Skripsi | ILMU KOMPUTER
Retrieval-Augmented Generation (RAG) umum digunakan dalam sistem tanya-jawab berbasis LLM untuk menyertakan dokumen domain eksternal tanpa fine-tuning tambahan. Namun, implementasi yang hanya bergantung pada model generatif untuk memahami informasi yang diambil tetap mudah mengalami factual contradictions, fabrications, dan context inconsistency dikarenakan sifat probabilistik dari model deep learning. Penelitian ini mengkaji apakah memisahkan penalaran dari generasi dapat mengurangi halusinasi tersebut dengan mengusulkan arsitektur berbasis RAG yang menggunakan modul tanya-jawab ekstraktif khusus.
Sistem yang diusulkan mengikuti arsitektur RAG modular, di mana pemilihan jawaban ditangani oleh model encoder-only yang melakukan extractive QA terhadap konteks yang diambil. Kemudian, model decoder-only menulis ulang span yang diekstraksi menjadi respons yang natural. Proses retrieval menggunakan pencarian dense vector standar, roberta-large-squad2 untuk ekstraksi, dan TinyLlama-1.1B-Chat-v1.0 untuk generasi. Kedua model di-fine-tune pada tugas masing-masing, dengan full-model fine-tuning untuk encoder dan LoRA diterapkan pada decoder. Domain yang dipilih untuk fine-tuning dan evaluasi adalah Program Studi Ilmu Komputer di Universitas Gadjah Mada.
Evaluasi pada set pengujian sebanyak 207 sampel menunjukkan peningkatan yang signifikan secara statistik dibandingkan baseline Naive RAG, yang mengindikasikan peningkatan factuality dan faithfulness. LERC, sebuah metrik yang mendekati penilaian manusia terhadap kebenaran respons, meningkat dari 2,63 menjadi 2,99, yang merupakan peningkatan sebesar 8,79% pada skala 1-5. BERTScore F1 meningkat dari 0,89 menjadi 0,93, sebuah peningkatan sebesar 4,08% pada skala 0-1. Probabilitas NLI juga bergeser dari 40,95% menjadi 62,01% untuk entailment, 51,57% menjadi 32,26% untuk neutral, dan 7,47% menjadi 5,63% untuk contradiction.
Retrieval-Augmented Generation (RAG) is commonly used in LLM-based question-answering systems to include external domain knowledge without additional fine-tuning. However, implementations that only rely on the generative model to interpret retrieved information remain prone to factual contradictions, fabrication, and context inconsistency due to the probabilistic nature of deep learning models. This research examines whether separating reasoning from generation can reduce these issues by proposing a RAG-based architecture that uses a dedicated extractive question-answering module.
The proposed system follows a modular RAG architecture, where answer selection is handled by an encoder-only model performing extractive QA over the retrieved context. A decoder-only model then rewrites the extracted span into a natural response. Retrieval used standard dense vector search, roberta-large-squad2 for extraction, and TinyLlama-1.1B-Chat-v1.0 for generation. Both models were fine-tuned at their respective tasks, with full-model fine-tuning for the encoder and LoRA applied to the decoder. The selected domain for fine-tuning and evaluation was the Computer Science major at Universitas Gadjah Mada.
Evaluation on a 207-sample test set showed statistically significant improvements over a baseline Naive RAG, suggesting improved factuality and faithfulness. LERC, a metric that approximates human judgment of response correctness, improved from 2.63 to 2.99, which is an 8.79% increase on the 1-5 scale. BERTScore F1 improved from 0.89 to 0.93, a 4.08% increase on the 0-1 scale. NLI probabilities also shifted from 40.95% to 62.01% for entailment, 51.57% to 32.26% for neutral, and 7.47% to 5.63% for contradiction.
Kata Kunci : Large Language Models, Retrieval-Augmented Generation, Closed-Domain QA, Extractive QA, Hallucination Reduction, Domain Adaptation