Cost-Effective Development of Educational Chatbots: Training and Inference Optimization

dc.contributor.authorAbilgazym, Aibek
dc.date.accessioned2025-10-28T03:52:36Z
dc.date.issued2025-05-12
dc.description.abstractLarge Language Models (LLMs) have revolutionized natural language processing tasks and show promise for interactive language learning applications. However, training these models and deploying them on resource-constrained devices (like smartphones or Raspberry Pi) is challenging due to their size and computational demands. This thesis presents an accelerated training pipeline for the GPT-2 124M model – the small- est GPT-2 – enabling it to be trained to competitive performance in under 3 minutes (using 0.8 billion tokens) on high-end hardware, a dramatic reduction compared to the original GPT-2 which required about 40 GB of text and multiple days of training. We achieve this speed-up through a combination of architectural optimizations (e.g. Rotary Positional Embeddings, ReLU² activations, QK-normalization, FlexAttention mechanism, and etc.), a custom Muon optimizer for faster convergence, and strate- gic hyperparameter tuning. The model was trained on the cleaned and deduplicated FineWeb dataset. The resulting model was then quantized to 8-bit, reducing memory by a factor of four with minimal loss in language modeling accuracy. We demonstrate the model’s effectiveness in an educational context, focusing on tasks like interac- tive conversation practice and grammar correction, and deployed on edge devices, including an 8GB Raspberry Pi. Benchmarks show that the optimized 124M model maintains language modelling performance (HellaSwag benchmark) while achieving real-time inference speeds within the limited memory ( 1 GB) e of these devices. This work highlights that with the right optimizations, even moderately sized LLMs can be trained and run off-line on personal devices for language learning, bridging the gap between large cloud-based models and accessible on-device AI tutors.
dc.identifier.citationA. Abilgazym. (2025). Cost-Effective Development of Educational Chatbots: Training and Inference Optimization. Nazarbayev University School of Engineering and Digital Sciences
dc.identifier.urihttps://nur.nu.edu.kz/handle/123456789/10558
dc.language.isoen
dc.publisherNazarbayev University School of Engineering and Digital Sciences
dc.rightsAttribution-NonCommercial-NoDerivs 3.0 United Statesen
dc.rights.urihttp://creativecommons.org/licenses/by-nc-nd/3.0/us/
dc.subjectLarge Language Models (LLMs)
dc.subjectGPT-2 124M
dc.subjectOn-device AI
dc.subjectLanguage learning
dc.subjectAccelerated training
dc.subjectEdge deployment
dc.subjectModel quantization
dc.subjectMuon optimizer
dc.subjectFlexAttention
dc.titleCost-Effective Development of Educational Chatbots: Training and Inference Optimization
dc.typeMaster`s thesis

Files

Original bundle

Now showing 1 - 1 of 1
Loading...
Thumbnail Image
Name:
Aibek Abilgazym MSc Data Science Thesis
Size:
794.18 KB
Format:
Adobe Portable Document Format
Description:
Master's Thesis
Access status: Embargo until 2027-10-22 , Download