System disruptions
There are recurring service disruptions on some of the search portals due to high traffic. We are working to resolve the issue, you may temporarily encounter an error message.
Change search
CiteExportLink to record
Permanent link

Direct link
Cite
Citation style
  • apa
  • ieee
  • modern-language-association-8th-edition
  • vancouver
  • Other style
More styles
Language
  • de-DE
  • en-GB
  • en-US
  • fi-FI
  • nn-NO
  • nn-NB
  • sv-SE
  • Other locale
More languages
Output format
  • html
  • text
  • asciidoc
  • rtf
Enhancing LLMs’ Mathematical Reasoning through Retrieval-Augmente Generation in the Casting Domain: Improving LLM’s mathematical reasoning capabilities using RAG technique integration with formula-based KG in Neo4j, vector-based embeddings in FAISS, or both external resources within the casting domain
Jönköping University, School of Engineering, JTH, Department of Computing, Jönköping AI Lab (JAIL).
2025 (English)Independent thesis Advanced level (degree of Master (Two Years)), 20 credits / 30 HE creditsStudent thesis
Abstract [en]

 Large Language Models (LLMs) have demonstrated impressive capabilities in natural language understanding and basic mathematical problem-solving. However, they often struggle with math- ematical problems that demand multi-step, logic-intensive reasoning capabilities. This challenge is further amplified by their lack of domain knowledge in specific fields such as casting, where the correct utilization of formulas to solve mathematical problems depends heavily on the inte- gration of formula-related knowledge. The Retrieval-Augmented Generation (RAG) technique shows promising potential in enriching LLMs with domain-specific knowledge by integrating ex- ternal domain resources to enhance their performance in downstream mathematical reasoning tasks within the casting domain. Therefore, the objective of this study is to investigate how RAG systems leverage structured knowledge in the form of a formula-based knowledge graph (KG) stored in Neo4j, semi-structured knowledge in the form of vector-based embeddings stored in FAISS, or a hybrid of both, to enhance the mathematical reasoning capabilities of LLMs within the casting domain. To achieve this, a pipeline is proposed that integrates a formula-based KG, vector-based embeddings, or both external resources with the RAG technique to enhance LLM performance in mathematical reasoning tasks. The formula-based KG is constructed using a chaining prompt embedded with a mathematical formula ontology for information extraction task, while the vector-based embeddings are generated by a distilled transformer model and in- dexed in FAISS. The pipeline is thoroughly evaluated using metrics such as F1-score, Precision, and Recall to assess the coverage of formula knowledge in the KG and the quality of entity extraction by the LLM. For retrieval efficacy, MRR, Recall@K, and nDCG@K are applied to measure vector-based retrieval; Recall is employed to measure KG-based retrieval, while answer accuracy is used for evaluating the end-to-end mathematical reasoning performance. Results show that the vector-based RAG system achieved the highest overall accuracy (70%), followed by the hybrid system (50%) and the KG-based RAG system (30%). The results indicate that all three systems are promising in improving LLMs’ mathematical reasoning capacities compared to the baseline model. The vector-based retrieval outperforms both hybrid and KG-based retrieval in improving mathematical reasoning capabilities within the casting domain. These findings highlight the effectiveness of vector-based retrieval in enhancing LLMs’ mathematical reasoning, suggesting that vector-based retrieval could be a key factor in addressing domain-specific math- ematical reasoning challenges. This work contributes to the field by proposing a pipeline for improving LLM mathematical reasoning performance using RAG techniques within the casting domain. The pipeline can be adapted to other domains involving formula-based problem solv- ing. This study also constructs a novel ontology schema for mathematical formulas and builds a formula-based KG for the casting domain.

Place, publisher, year, edition, pages
2025. , p. 47
Keywords [en]
Large Language Models, Retrieval-augmented Generation, Knowledge Graph, Cast- ing Domain, Embeddings, Mathematical Reasoning
National Category
Engineering and Technology
Identifiers
URN: urn:nbn:se:hj:diva-67880OAI: oai:DiVA.org:hj-67880DiVA, id: diva2:1961516
Subject / course
JTH, Computer Engineering
Supervisors
Examiners
Available from: 2025-06-13 Created: 2025-05-27 Last updated: 2025-10-13Bibliographically approved

Open Access in DiVA

fulltext(2425 kB)766 downloads
File information
File name FULLTEXT01.pdfFile size 2425 kBChecksum SHA-512
3ddb044ce9e6dcf13672849b6fb4df925757fb0897b45b7b715d020dddab9d9e8457e70ffa5aee1529c86abbcaf544eb73949af4e5b31cbf5621227572d5becf
Type fulltextMimetype application/pdf

By organisation
Jönköping AI Lab (JAIL)
Engineering and Technology

Search outside of DiVA

GoogleGoogle Scholar
Total: 773 downloads
The number of downloads is the sum of all downloads of full texts. It may include eg previous versions that are now no longer available

urn-nbn

Altmetric score

urn-nbn
Total: 757 hits
CiteExportLink to record
Permanent link

Direct link
Cite
Citation style
  • apa
  • ieee
  • modern-language-association-8th-edition
  • vancouver
  • Other style
More styles
Language
  • de-DE
  • en-GB
  • en-US
  • fi-FI
  • nn-NO
  • nn-NB
  • sv-SE
  • Other locale
More languages
Output format
  • html
  • text
  • asciidoc
  • rtf