{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/retrieval-augmented-generation-to-improve","title":"Retrieval-augmented Generation to Improve Math Question-Answering: Trade-offs Between Groundedness and Human Preference","arxiv_id":"2310.03184","date":"2023-10-04","proceeding":null,"authors":["Zachary Levonian","Chenglu Li","Wangda Zhu","Anoushka Gade","Owen Henkel","Millie-Ellen Postle","Wanli Xing"],"abstract":"For middle-school math students, interactive question-answering (QA) with tutors is an effective way to learn. The flexibility and emergent capabilities of generative large language models (LLMs) has led to a surge of interest in automating portions of the tutoring process - including interactive QA to support conceptual discussion of mathematical concepts. However, LLM responses to math questions can be incorrect or mismatched to the educational context - such as being misaligned with a school's curriculum. One potential solution is retrieval-augmented generation (RAG), which involves incorporating a vetted external knowledge source in the LLM prompt to increase response quality. In this paper, we designed prompts that retrieve and use content from a high-quality open-source math textbook to generate responses to real student questions. We evaluate the efficacy of this RAG system for middle-school algebra and geometry QA by administering a multi-condition survey, finding that humans prefer responses generated using RAG, but not when responses are too grounded in the textbook content. We argue that while RAG is able to improve response quality, designers of math QA systems must consider trade-offs between generating responses preferred by students and responses closely matched to specific educational resources.","url_abs":"https://arxiv.org/abs/2310.03184v2","url_pdf":"https://arxiv.org/pdf/2310.03184v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"retrieval-augmented-generation-to-improve","repo_url":"https://github.com/digitalharborfoundation/rag-for-math-qa","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"retrieval-augmented-generation-to-improve","repo_url":"https://github.com/levon003/wiki-ores-feedback","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"math","task_name":"Math"},{"task_slug":"question-answering","task_name":"Question Answering"},{"task_slug":"rag","task_name":"RAG"},{"task_slug":"retrieval","task_name":"Retrieval"},{"task_slug":"retrieval-augmented-generation","task_name":"Retrieval-augmented Generation"}],"methods":[{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"attention-dropout","method_name":"Attention Dropout"},{"method_slug":"bart","method_name":"BART"},{"method_slug":"bert","method_name":"BERT"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"linear-warmup-with-linear-decay","method_name":"Linear Warmup With Linear Decay"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"rag","method_name":"RAG"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"weight-decay","method_name":"Weight Decay"},{"method_slug":"wordpiece","method_name":"WordPiece"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2310.03184","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2310.03184"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/levon003/wiki-ores-feedback","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/digitalharborfoundation/rag-for-math-qa","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":7,"unverified":13},"by_repo_kind":{"official":{"samples":15,"ran":7,"repositories":1},"listed":{"samples":5,"ran":0,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"adbb8e277c65f872","entry":"cast_unicode","repo":"digitalharborfoundation/rag-for-math-qa","repo_kind":"official","path":"src/experiment/auth.py","file_url":"https://github.com/digitalharborfoundation/rag-for-math-qa/blob/HEAD/src/experiment/auth.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"adbb8e277c65f872"}},{"code_sha256_prefix":"bd9fa112de9cd9ef","entry":"get_completion_with_wait","repo":"digitalharborfoundation/rag-for-math-qa","repo_kind":"official","path":"src/experiment/completion_utils.py","file_url":"https://github.com/digitalharborfoundation/rag-for-math-qa/blob/HEAD/src/experiment/completion_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"bd9fa112de9cd9ef"}},{"code_sha256_prefix":"46cb5857633642b6","entry":"get_distance_sort_indices","repo":"digitalharborfoundation/rag-for-math-qa","repo_kind":"official","path":"src/rag/retrieval.py","file_url":"https://github.com/digitalharborfoundation/rag-for-math-qa/blob/HEAD/src/rag/retrieval.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"46cb5857633642b6"}},{"code_sha256_prefix":"82c54c9e968c5109","entry":"get_gpd_codes","repo":"digitalharborfoundation/rag-for-math-qa","repo_kind":"official","path":"src/rag/gpf_utils.py","file_url":"https://github.com/digitalharborfoundation/rag-for-math-qa/blob/HEAD/src/rag/gpf_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"82c54c9e968c5109"}},{"code_sha256_prefix":"98a37e5d6771556e","entry":"get_openai_embeddings_cached","repo":"digitalharborfoundation/rag-for-math-qa","repo_kind":"official","path":"src/rag/embedding_utils.py","file_url":"https://github.com/digitalharborfoundation/rag-for-math-qa/blob/HEAD/src/rag/embedding_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"98a37e5d6771556e"}},{"code_sha256_prefix":"da2b82577b524fe9","entry":"is_valid_generation","repo":"digitalharborfoundation/rag-for-math-qa","repo_kind":"official","path":"src/experiment/generate.py","file_url":"https://github.com/digitalharborfoundation/rag-for-math-qa/blob/HEAD/src/experiment/generate.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"da2b82577b524fe9"}},{"code_sha256_prefix":"94af878e3d7b1853","entry":"normalize_text","repo":"digitalharborfoundation/rag-for-math-qa","repo_kind":"official","path":"src/rag/retrieval.py","file_url":"https://github.com/digitalharborfoundation/rag-for-math-qa/blob/HEAD/src/rag/retrieval.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"94af878e3d7b1853"}},{"code_sha256_prefix":"0d2530ff40d0ad16","entry":"KLdivergence","repo":"levon003/wiki-ores-feedback","repo_kind":"listed","path":"src/data_shift/computeMonthSampleAdjacentInverseKld.py","file_url":"https://github.com/levon003/wiki-ores-feedback/blob/HEAD/src/data_shift/computeMonthSampleAdjacentInverseKld.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"0d2530ff40d0ad16"}},{"code_sha256_prefix":"96886c0813d3e0d0","entry":"compute_kld","repo":"levon003/wiki-ores-feedback","repo_kind":"listed","path":"src/data_shift/computeMonthSampleAdjacentInverseKld.py","file_url":"https://github.com/levon003/wiki-ores-feedback/blob/HEAD/src/data_shift/computeMonthSampleAdjacentInverseKld.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"96886c0813d3e0d0"}},{"code_sha256_prefix":"1c67a076bad0e201","entry":"create_stopword_token_set_from_word_list","repo":"digitalharborfoundation/rag-for-math-qa","repo_kind":"official","path":"src/rag/logit_bias.py","file_url":"https://github.com/digitalharborfoundation/rag-for-math-qa/blob/HEAD/src/rag/logit_bias.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"1c67a076bad0e201"}},{"code_sha256_prefix":"4131bc1dcba26fa6","entry":"generate_user_text_dict","repo":"levon003/wiki-ores-feedback","repo_kind":"listed","path":"src/data_extraction/joinOresScores.py","file_url":"https://github.com/levon003/wiki-ores-feedback/blob/HEAD/src/data_extraction/joinOresScores.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"4131bc1dcba26fa6"}},{"code_sha256_prefix":"8fda8a976b120b21","entry":"get_completion_noraise","repo":"digitalharborfoundation/rag-for-math-qa","repo_kind":"official","path":"src/experiment/completion_utils.py","file_url":"https://github.com/digitalharborfoundation/rag-for-math-qa/blob/HEAD/src/experiment/completion_utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"8fda8a976b120b21"}},{"code_sha256_prefix":"37b5fee433b8ce88","entry":"get_completion_with_retries","repo":"digitalharborfoundation/rag-for-math-qa","repo_kind":"official","path":"src/experiment/completion_utils.py","file_url":"https://github.com/digitalharborfoundation/rag-for-math-qa/blob/HEAD/src/experiment/completion_utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"37b5fee433b8ce88"}},{"code_sha256_prefix":"41b9d76b39f4c2d7","entry":"get_engine","repo":"levon003/wiki-ores-feedback","repo_kind":"listed","path":"src/data_extraction/extractStubRevData.py","file_url":"https://github.com/levon003/wiki-ores-feedback/blob/HEAD/src/data_extraction/extractStubRevData.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"41b9d76b39f4c2d7"}},{"code_sha256_prefix":"550fc2b428948b52","entry":"get_openai_embeddings","repo":"digitalharborfoundation/rag-for-math-qa","repo_kind":"official","path":"src/rag/embedding_utils.py","file_url":"https://github.com/digitalharborfoundation/rag-for-math-qa/blob/HEAD/src/rag/embedding_utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"550fc2b428948b52"}},{"code_sha256_prefix":"22d379b9c5b9e756","entry":"get_stub_history_paths","repo":"levon003/wiki-ores-feedback","repo_kind":"listed","path":"src/data_extraction/extractRevertsFromStubHistory.py","file_url":"https://github.com/levon003/wiki-ores-feedback/blob/HEAD/src/data_extraction/extractRevertsFromStubHistory.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"22d379b9c5b9e756"}},{"code_sha256_prefix":"c00df0e3ac6429e8","entry":"get_token_counts","repo":"digitalharborfoundation/rag-for-math-qa","repo_kind":"official","path":"src/rag/embedding_utils.py","file_url":"https://github.com/digitalharborfoundation/rag-for-math-qa/blob/HEAD/src/rag/embedding_utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"c00df0e3ac6429e8"}},{"code_sha256_prefix":"aded11c82372d198","entry":"get_tokenizer","repo":"digitalharborfoundation/rag-for-math-qa","repo_kind":"official","path":"src/rag/logit_bias.py","file_url":"https://github.com/digitalharborfoundation/rag-for-math-qa/blob/HEAD/src/rag/logit_bias.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"aded11c82372d198"}},{"code_sha256_prefix":"28d7d8b230a26677","entry":"passwd_check","repo":"digitalharborfoundation/rag-for-math-qa","repo_kind":"official","path":"src/experiment/auth.py","file_url":"https://github.com/digitalharborfoundation/rag-for-math-qa/blob/HEAD/src/experiment/auth.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"28d7d8b230a26677"}},{"code_sha256_prefix":"e0bc8c8de21785b1","entry":"passwd_hash","repo":"digitalharborfoundation/rag-for-math-qa","repo_kind":"official","path":"src/experiment/auth.py","file_url":"https://github.com/digitalharborfoundation/rag-for-math-qa/blob/HEAD/src/experiment/auth.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e0bc8c8de21785b1"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}