Evaluating Prompt Engineering Techniques for RAG in Small Language Models: A Multi-Hop QA Approach

Document Type : Research Article

Authors

1 Department of Software Engineering, University of Isfahan, Isfahan, Iran

2 Department of Software Engineering University of Isfahan, Isfahan, Iran

3 Department of Software Engineering, Faculty of Computer Engineering, University of Isfahan, Isfahan, Iran

10.22108/jcs.2026.147609.1186

Abstract

Retrieval-Augmented Generation (RAG) supports small language models (SLMs) with external evidence, yet selecting effective prompt structures for multi-hop question answering remains challenging. This study presents a comparative evaluation of 24 prompt configurations: one standard RAG baseline, nine literature-derived templates, and fourteen manually constructed hybrid templates organized through a compositional framework of decomposition, evidence grounding, role framing, synthesis, self-verification, and output structuring. We evaluate Qwen2.5-3B-Instruct and Gemma3-4B-It on the complete 390-question HotpotQA test split distributed through RAGBench, using its supplied retrieved contexts. The experiment comprises 18,720 judged generations (390 questions × 24 templates × 2 models). Evaluation combines a GPT-4o-mini-based multidimensional quality score (SLLM), measured generation-call latency, and a quality-to-latency Efficiency Score. The highest mean SLLM values are 0.8305 for Qwen and 0.8455 for Gemma, representing absolute gains of 0.0623 and 0.0602 over their respective baselines. SLLM measures composite answer quality rather than conventional question-answering accuracy. Paired Wilcoxon tests with within-model Holm correction identify a significant best-hybrid improvement for Gemma, while the corresponding Qwen comparison does not reach significance. Both highest-scoring hybrids incur additional latency relative to their baselines, and complementary analyses reveal model specific prompt rankings and response patterns. The results provide practical guidance for selecting prompts according to quality and latency requirements. These findings are established for the two evaluated checkpoints and the RAGBench HotpotQA setting; broader applicability across models, retrieval pipelines, datasets, and domains remains a direction for further validation.

Keywords

Main Subjects



Articles in Press, Accepted Manuscript
Available Online from 08 November 2026
  • Receive Date: 27 November 2025
  • Revise Date: 10 October 2026
  • Accept Date: 26 October 2026