Skip to content
Preprint

EduGuard: A Safe RAG-Based LLM Tutor for Programming Education

Jul 2026 · 0 citations · 35 references
Computer Science

TL;DR

E EduGuard, a safe retrieval-augmented generation (RAG) tutoring framework for introductory programming, is presented and compared against strong baselines, suggesting safe GenAI tutoring requires not only retrieval or strong prompting, but explicit pedagogical control, evidence verification, and deployment safeguards.

Abstract

Generative AI (GenAI) is increasingly used by students for programming explanation, debugging, and assignment support. Yet unrestricted large language model (LLM) tutors can hallucinate, contradict course policy, reveal complete solutions, and foster passive dependence. This paper presents EduGuard, a safe retrieval-augmented generation (RAG) tutoring framework for introductory programming. EduGuard integrates query understanding, instructor-approved course retrieval, pedagogical strategy selection, rubric-aware generation, claim-level verification, and overreliance control. To make evaluation provenance explicit, we construct BILearn-CS, a 600-query instructor-authored, TA-validated benchmark spanning concept questions, debugging cases, misconceptions, assignment-support requests, code-mixed Bangla-English queries, and adversarial direct-answer prompts. Moving beyond a synthetic-only benchmark, we further evaluate on a 150-query public CS50-style course-forum set and run a small controlled pilot with 10 undergraduates using a counterbalanced pre-test/post-test design. Using Meta-Llama-3.1-8B-Instruct as the primary generator, hybrid FAISS/BM25 retrieval, and DeBERTa-v3-large-MNLI as an architecturally separate verifier, EduGuard is compared against strong baselines: GPT-4o-mini Tutor, Llama Socratic Tutor, LPITutor-style RAG, RAG with rubric prompting, and RAG with same-model self-checking. On BILearn-CS, EduGuard attains the best correctness (90.1%), grounding (89.4%), and rubric alignment (90.8%), with the lowest hallucination (4.9%) and direct-answer leakage (9.8%). In the pilot, it raises immediate post-test accuracy from 68.4% to 81.2% and cuts overreliance from 38.0% to 17.0% relative to GPT-4o-mini Tutor. These results suggest safe GenAI tutoring requires not only retrieval or strong prompting, but explicit pedagogical control, evidence verification, and deployment safeguards.

View source

Similar papers

Preprint Jul 2026

CSTutorBench: Benchmarking Small Language Models as Tutors for Block-Based Programming

Large language models are increasingly explored as AI tutors, yet deploying them in K-12 settings raises concerns around privacy, cost, and reliance on proprietary models. Small language models (SLMs) offer a promising alternative, but selecting the right model for a specific educational context remains difficult, particularly when the target domain, such as block-based programming, is largely absent from model training data. We introduce CSTutorBench, a benchmark for evaluating language models as CS tutors in VEX VR, a block-based robotics environment. The benchmark comprises 17 scenario-based questions scored against a pedagogical rubric grounded in established tutoring and feedback research, with a human-in-the-loop LLM-as-judge pipeline for evaluation. Preliminary findings across 11 models (4B-120B parameters) reveal that models perform well on surface-level criteria such as vocabulary and tone but struggle with deeper pedagogical behaviors, particularly avoiding answer leakage and engaging with student debugging histories. In our sample, model family and instruction-tuning approach appear to be better predictors of tutoring quality than parameter count alone, though the small number of models limits the strength of this conclusion. A targeted prompt revision grounded in recent educational prompt engineering research improved scores for 10 of 11 models. These results underscore the value of context-specific, pedagogically grounded benchmarks for SLM selection in educational deployment.

H. Chad Lane, Bryson Kageler · 0 citations
Conference Jul 2026

Designing Reliable LLM Systems for AI-Assisted Engineering Education

Large Language Models (LLMs) are increasingly used in AI-assisted engineering education, enterprise learning, technical knowledge support, and software-development workflows. However, static retrieval-augmented generation (RAG) pipelines retrieve external context for every query, which can increase latency, token cost, and irrelevant-context exposure, while direct generation can produce unsupported or stale answers for policy-sensitive, documentation-dependent, or multisource questions. This paper presents a production-oriented adaptive retrieval framework that treats retrieval as a conditional reliability decision rather than a default execution step. The framework combines query embeddings, similarity-based query memory, feedback-confirmed routing labels, comparison/fallback handling, and observability logs to decide whether a query should be answered directly, routed through retrieval, or escalated for evidence comparison. The system was evaluated in a production-similar controlled test bed using a 1,300-scenario validation workload and public benchmark validation using HotpotQA and RAGTruth. In the 1,300-scenario evaluation, the proposed method achieved 91.31% routing accuracy, 85.00% grounded-answer rate, 85.38% unsupported-answer detection, and 79.85% fallback correctness, while reducing mean latency compared with always-on Static RAG. Paired statistical testing showed significant improvements over LLM-only, Static RAG, and Threshold RAG baselines for routing, grounding, unsupported-answer detection, fallback behavior, and latency. The paper also discusses deployment considerations including query-memory growth, stale no-retrieval labels, knowledge-base version tracking, privacy-preserving redaction, and instructor oversight for responsible educational use.

Ramesh Venkatachalapathy · 0 citations
Preprint Aug 2026

EduClaw-Bench: A Long-Horizon Benchmark for Pedagogical LLM Agents with Simulated Learners

Large language models (LLMs) power educational applications from tutoring to essay scoring, but each is a point solution to a single task, and only recently have these point solutions been integrated into agents operating over a learning management system (LMS). Yet tutoring is long-horizon, since a learner improves over days and weeks rather than in a single turn, and no benchmark evaluates an agent tutor across a sustained relationship. We introduce EduClaw-Bench, a benchmark that places an agent tutor in a continuous 30-day relationship with a simulated learner grounded in knowledge tracing (KT), whose knowledge-concept mastery, from a KT model trained on real-student data, drives its answers and is probed for learning gain across 55 scenarios. Each agent is scored on three primary axes (learning gain, responsiveness, and helpfulness) and two curriculum-design axes (Gagn\'e and Rosenshine), with helpfulness and the curriculum axes judged by a cross-family panel of three LLM judges. Evaluating 10 agent adapters over three base-model tiers yields two findings that single-tier, single-session evaluation cannot reach. First, tutoring quality belongs to the base model and the agent harness together rather than either alone. Second, almost no combination sustains good tutoring over the full horizon. A calibration check ($\text{ECE}=0.049$) and a live-classroom field study confirm that the simulated learner and its measurements track reality. Our work is a step toward trustworthy AI tutors for future education.

Unggi Lee, Sookbun Lee, Yeil Jeong et al. · 0 citations
Preprint Aug 2026

Auditable Release Control for Pedagogical Leakage in LLM Tutors

Large language model tutors can be correct and helpful yet disclose an answer or decisive reasoning before that disclosure is authorized. We formalize this state- and action-dependent failure as pedagogical leakage and introduce an authorization-aware complete-mediation boundary. A selector emits one of five disclosure contracts, trusted policy gates privileged modes, and a renderer proposes language. A single release function applies inspectable checks, optional cumulative verification, and action-specific fallback; replayable traces separate selection, generation, verification, and enforcement failures. Matched component attribution exposes a safety-utility frontier. On 599 fixed Gemini 3.5 proposals, strict mediation reduces blinded three-model panel-majority leakage flags from 181 to 0 (paired problem-cluster difference -30.22 points, 95% CI [-35.00,-25.72]), while replacing 581 responses and lowering helpfulness. Checker-triggered fallback alone yields 11 majority flags; adding the semantic verifier yields 14 and no reliable marginal gain. A global A1 scaffold yields 0 majority and 54 any-judge flags, outperforming fitted Q on automatic safety and utility. In an externally timestamped replication over 40 unseen problem clusters and 480 attack sequences, high-assurance release reduces majority flags from 42 to 8 (-7.08 points, 95% CI [-13.13,-2.29]); seven failures persist, one is introduced, and mean helpfulness falls by .192. These results establish an auditable release boundary and failure attribution under declared contracts, not universal semantic safety or learning gains.

Nizam Kadir · 0 citations
Open access Aug 2026

Lightweight Llama Models with Experts’ Curated RAG for Electrical Engineering Education: An Exploratory Comparison

This study investigates the benefits of expanding small and open Large Language Models (Llama 3.x family) with retrieval and explicit referencing (retrieval-augmented generation), configured to refuse to respond when unsure about the answer. Additionally, we compare this augmented system with a cutting-edge commercial model (OpenAI GPT-4.5) in electrical engineering (EE) education questions. We build on an agentic RAG pipeline with retrieval from our team’s human-curated pedagogical reference document and a source-preserving, sectioned prompt that enforces citations. Six very experienced EE professors blindly assessed the answers to three exam-style questions of different types, generated by (i) the baseline model Llama 3.1 8B, (ii) our proposed RAG agent, and (iii) GPT-4.5, according to five dimensions: Correctness, Structure, Completeness, Precision, and Conciseness. The results show that the proposed RAG agent substantially improves the lightweight base model and produces transparent, syllabus-grounded answers that experts rated as correct and concise, while GPT-4.5 retains an edge on longer, multistep, and topology-intensive tasks. The local RAG agentic AI system achieved competitive performance relative to GPT-4.5 on dataset-scoped conceptual, procedural, and direct numerical electrical engineering circuit analysis educational tasks, which support the potential of curriculum-grounded open-weight models for constructing pedagogical applications.

André Rocha, Paulo Oliveira, João Ferreira et al. · 0 citations
Book Open access Jul 2026

A Good Rubber Duck Does Not Quack: Designing Socratic Scaffolding in AI Tutors

Large Language Models in programming education face a fundamental tension: while capable of generating correct solutions instantly, doing so undermines the struggle necessary for conceptual learning. We present Socratic AI, a VS Code-integrated tutor that addresses this through pedagogically-grounded Socratic dialogue constrained to withhold direct solutions. Our core innovation is a stateful misconception detection mechanism that tracks student understanding across dialogue turns. Operating on a taxonomy of foundational programming errors (off-by-one, mutation vs. reassignment, return vs. print, async/parallel confusion), the system evaluates each student utterance to produce per-misconception verdicts (reinforced, weakened, introduced, absent) with certainty scores. These accumulate through small, incremental confidence score updates until a derived resolution threshold is achieved. This enables the tutor to persist on specific conceptual gaps rather than abandoning them when students deflect or express frustration. This stateful tracking enables two key capabilities: (i) the system adapts questioning intensity based on detected learner confidence signals, shifting from diagnostic probes to conceptual contrasts, and (ii) enforces purely Socratic constraints through multi-layered validation that blocks code generation, direct explanations, and multi-question responses. The system is implemented as a VS Code extension with Gemini-based classification back-end and cloud database persistence for longitudinal analysis. In a preliminary deployment with 48 students, we observed increased question specificity, frequent learner articulation consistent with mental model revision, and reduced recurrence of targeted errors on similar tasks. We contribute a deployable architecture, a misconception taxonomy, and evidence that stateful tracking enables adaptive Socratic dialogue that scaffolds productive struggle rather than short-circuiting learning.

Ayush Thonge, Aalok Thakkar · 0 citations