Publication Date
Fall 2025
Degree Type
Master's Project
Degree Name
Master of Science in Computer Science (MSCS)
Department
Computer Science
First Advisor
Melody Moh
Second Advisor
Teng Moh
Third Advisor
David Taylor
Keywords
Large Language Models (LLM), Google Gemini, Mermaid, Prompt Engineering, Retrieval Augmented Generation (RAG)
Abstract
Google Gemini is one of the most widely used large language models (LLMs) among users involved in computer science (CS) worldwide–be it students, educators, or developers. A critical capability of an LLM is the generation of effective visual diagrams, which can help users visualize complicated CS concepts like process scheduling or the Transmission Control Protocol (TCP) handshake. However, Gemini frequently produces uncompilable Mermaid code (the standard language for creating visual diagrams), which diminishes the overall quality and utility of its responses. This paper presents a lightweight framework designed to improve the syntactical correctness of Mermaid code generated by Gemini. The proposed solution integrates industry-used LLM-improvement techniques, such as Retrieval Augmented Generation (RAG), prompt engineering, and iterative prompting, within a wrapper architecture that automatically detects, repairs, and re-validates invalid Mermaid code. Experimental results demonstrate that the prototype built with targeted improvements improves both the accuracy and effectiveness of Gemini’s responses, thereby increasing its value as a support tool for CS users.
Recommended Citation
Sarma, Pawan, "Improving Gemini’s Ability to Generate Mermaid Code" (2025). Master's Projects. 1593.
DOI: https://doi.org/10.31979/etd.ftze-qttr
https://scholarworks.sjsu.edu/etd_projects/1593