Serial RAG Engine for Memory-Efficient Offline Math Learning

Mathematics learning still poses challenges to most
students owing to a lack of personalised guidance, fewer learning materials, and inadequate access to intelligent tutoring systems,especially in poor-resource environments. In this paper, we propose MathAssist, an offline AI-assisted mathematics learning framework that offers context-aware and stepwise mathematical support based on multimodal input, RAG, and lightweight Large Language Models (LLMs). The framework accepts text, image,and voice input and translates them to a common representation of a query. A local knowledge base is employed for semantic retrieval, whereas a serial RAG architecture facilitates interaction between retrieval and reasoning processes done via LLMs while avoiding unnecessary concurrent resource consumption. In order to choose a suitable model for the framework, we evaluated nine lightweight open-source LLMs using the MathQuest benchmark, which contains 42 mathematical questions divided among Easy,Medium, and Hard classes. The assessment took into consideration accuracy, efficiency, compatibility, response time, RAM usage, GPU usage, and token usage. WizardMath ranked first with an accuracy of 91.06%, and therefore was chosen as the main model, whereas Phi-3 had the second-highest ranking.Moreover, case-study experiments have been conducted on 3 quadratic equations via a Python and Streamlit-powered testing platform. Live resource monitoring revealed maximum RAM utilisation of 13.02 GB with 61% GPU utilisation for WizardMath and 12.27 GB with 63% GPU utilisation for Phi-3 at the inference stage. The evaluation was conducted in a Python and Streamlit-based environment, and the observed resource consumption indicates that further optimization is required before deployment on low-memory mobile devices.The main contributions of this research include:
• Benchmarking of nine lightweight open-source LLMs
using the MathQuest dataset and selection of WizardMath
as the best-performing model
• Development of a Serial RAG method that combines
semantic retrieval, local knowledge indexing, and LLM
inference.
• Resource consumption monitoring using a Python-based
evaluation environment in the case study of WizardMath
and Phi-3. and evaluation of LLMs using a Python and
Streamlit-based testing environment which lead to depict the performance evaluation of the LLMs.