Research
INSIDE the Student's Mind: Jointly Modeling Latent Reasoning and Action in LLM Student Simulators
Overview Research area: AI in education / LLM-based human simulation, specifically student simulation for programming courses. Technical level: Advanced. The paper assumes familiarity with LLM fine-tu
- arXiv
- 2608.10492
- Published
- 2026-08-11
- Authors
- Rose Niousha, Minwoo Kang, Narges Norouzi
AI summary
Overview
Research area: AI in education / LLM-based human simulation, specifically student simulation for programming courses.
Technical level: Advanced. The paper assumes familiarity with LLM fine-tuning (LoRA), chain-of-thought prompting, chain-of-thought supervision, distributional distance metrics (Wasserstein/Earth Mover's Distance), and AST-based code analysis.
Scope: The paper introduces INSIDE (Internal Student Dialogue), a framework that fine-tunes LLMs to jointly generate a student's latent reasoning trace and their next code submission, and evaluates it on action fidelity and reasoning alignment against prompting baselines.
What This Paper Is About
LLM-based student simulators often reproduce what students do (their code submissions) but not why they do it, even though two students can submit identical or similarly incorrect code for entirely different reasons. The authors argue that the valuable, non-observable part of student modeling is the latent reasoning preceding each action, including wrong or partial reasoning, which standard chain-of-thought training (aimed at correctness) does not target. INSIDE addresses this by training LLMs to generate a first-person "internal dialogue" grounded in Bloom's Taxonomy before producing the next attempt, then measuring both how student-like the generated code is and how well the generated reasoning matches the real student's code edits.
Key Contributions
-
Reconstruction of pedagogically grounded reasoning traces. Because ground-truth student reasoning is unavailable, the authors reconstruct latent traces from real interaction data via retrospective inference with a teacher model (GPT-5), conditioning on prior context and the observed code edit, and structuring the traces around cognitive, affective, and action states inspired by Bloom's Taxonomy.
-
A student modeling framework with internal dialogue. INSIDE jointly models student code generation and the underlying reasoning by conditioning the generated action on the inferred internal dialogue, rather than treating student behavior as a black box.
-
A two-dimensional evaluation of simulation fidelity. The work evaluates (1) action fidelity, the similarity between generated and real student code using metrics including pass rate, lines of code, AST depth and width, and PEP 8 violations via Wasserstein distance, and (2) reasoning quality, defined as alignment between generated reasoning and ground-truth code edits without requiring observed reasoning traces.
-
An empirical comparison of fine-tuning versus prompting. The paper compares supervised fine-tuning with no CoT, with CoT, and with Bloom-inspired CoT prompting across several model families, and reports INSIDE achieving the highest reasoning alignment (up to 57.9%) while improving action fidelity on
test_OP.
Main Findings
-
INSIDE best matches student code on
test_OP: On the old-problems split (5,262 submissions from Spring 2024 students on seen problems), INSIDE consistently achieves the lowest Wasserstein distances across all metrics, indicating the closest match to real student code distributions. For example, Qwen2.5-Coder-7B-INSIDE reports 0.05 (pass rate), 0.21 (LOC), 0.21 (AST depth), 0.40 (AST width), and 0.16 (PEP 8), compared with 0.15, 0.29, 0.29, 0.51, and 0.19 for Qwen2.5-Coder-7B-SFT. -
Results are more mixed on
test_NP: On the new-problems split (1,054 submissions on problems absent from training), SFT and INSIDE perform comparably across most metrics, with smaller Wasserstein distances than ontest_OP. The authors attribute this to differing student pass-rate distributions:test_NPcontains a higher proportion of successful student submissions, leaving less mismatch for INSIDE to correct. -
Prompting baselines are substantially worse at action fidelity: Fine-tuned models outperform prompting-based methods across both settings, and within prompting, structured Bloom-inspired CoT generally lowers Wasserstein distances relative to standard CoT while still underperforming fine-tuning.
-
Prompted models show an over-competence bias: On the representative problems
test_OP_1(968 submissions) andtest_NP_1(695 submissions), prompting-based models maintain pass rates of approximately 80% from the first step, whereas real students start low and rise sharply near the final steps. SFT tracks this trajectory, and INSIDE improves alignment further. -
Lowest pass-rate trajectory error: On
test_OP_1, the top three models by Mean Absolute Error against student pass rates are Qwen3-8B-INSIDE (0.094), Qwen2.5-Coder-7B-INSIDE (0.098), and Qwen2.5-7B-INSIDE (0.113). Ontest_NP_1, they are Qwen2.5-Coder-7B-INSIDE (0.162), Qwen2.5-7B-SFT (0.181), and Qwen2.5-7B-INSIDE (0.182). -
INSIDE achieves the highest reasoning alignment: On
test_OP, Qwen2.5-7B-INSIDE reaches 51.8% (0.8) alignment, above the strongest Bloom-prompting baseline, Qwen2.5-7B-Instruct-BloomCoT at 49.6% (0.9). Ontest_NP, Qwen3-8B-INSIDE reaches 57.9% (2.0), compared with 56.0% (2.3) for Qwen3-8B-BloomCoT. -
Larger models do not reason more like students: GPT-5 and Qwen3-32B tend to achieve lower alignment scores. On
test_OP, GPT-5-BloomCoT scores 45.5 (0.8) and Qwen3-32B-BloomCoT 44.4 (0.8). The authors suggest stronger general reasoning ability does not translate into reasoning that matches student-like code edits. -
High self-consistency can coexist with poor fidelity: Prompting-based models achieve self-consistency of 86.9% to 99.0% across both test sets, with GPT-5 highest (97.6 on
test_OP, 99.0 ontest_NP), yet GPT-5 performs among the worst in reproducing realistic student code trajectories. INSIDE achieves competitive self-consistency of 83.0% to 87.3% while better matching real student edits. -
Judge validation supports the alignment metric: The LLM judge assigns an average alignment score of 95.2% on teacher-generated traces for a training-data sample of n = 209 submissions. Manual annotation of 25 randomly sampled generated internal dialogues reached 88.0% agreement with judge labels (kappa = 0.754).
-
Test splits differ in failure/success balance: Student distributions for both splits concentrate at the endpoints, with 83% and 81% of mass at pass rates 0 and 1 respectively.
test_OPstudents fail at 55% and succeed at 28% (roughly 2:1), whiletest_NPstudents fail at 47% and succeed at 34% (roughly 1.4:1). Ontest_OP, SFT underestimates complete failure (43% vs. 55%) and overestimates complete success (40% vs. 28%).
Methodology in Plain English
The researchers worked with interaction logs from an introductory programming course at the University of California, Berkeley, spanning two semesters (Spring 2024 and Spring 2025) and the first five homework assignments in Python. In this course, roughly 900 students per semester submit code to an autograder, may receive natural-language feedback from an LLM-based tutor after failing tests, and can resubmit freely, producing a sequential stream of attempts per student and problem.
Training data came from Spring 2025 (445 students, 2,022 submission streams, 6,911 total submissions) and testing data from Spring 2024 (479 students, 1,546 submission streams, 6,316 total submissions), giving two test subsets: test_OP (5,262 submissions on problems seen in training) and test_NP (1,054 submissions on unseen problems).
Because real students' inner thoughts are never recorded, the authors used GPT-5 as a teacher model to work backwards: given the student's earlier code, the tutor feedback, and the submission the student actually made next, the teacher inferred the student's cognitive, affective, and action states and wrote a first-person think trace. These synthetic traces became the supervision signal.
They then fine-tuned four base models (Qwen2.5-7B, Qwen2.5-Coder-7B, Qwen3-8B-Base, LLaMA-3-8B) with LoRA (r = 16, alpha = 32) for two epochs at a learning rate of 10⁻⁴, seeing up to k ≤ 10 prior submissions. Two experiments were run: generating code without any reasoning, and generating internal dialogue followed by code as a single sequence. They also prompted instruction-tuned versions of the same models plus GPT-5, using either standard CoT or Bloom-inspired CoT, and additionally prompted Qwen3-14B and Qwen3-32B under Bloom-inspired CoT.
Evaluation used two axes. Action fidelity compared generated code to real student code with Wasserstein distances (estimated via bootstrap resampling with 500 resamples) on pass rate, lines of code, AST depth and width, and PEP 8 violations. Reasoning quality used a GPT-5-mini judge that decomposed each generated internal dialogue into atomic claims about intended actions and checked whether each claim was reflected in the real student's code diff.
Why This Matters
Impact on research: The paper reframes student simulation from predicting observable outcomes to modeling latent, potentially incorrect reasoning, positioning internal dialogue as an intermediate cognitive layer that precedes action. This differs from prior work such as Ross and Andreas (2025), which reconstructs misconceptions post hoc from erroneous answers, and from Miroyan et al. (2025), which fine-tunes on real student code trajectories but does not model or measure internal reasoning. It also argues that training models toward correct reasoning conflicts with simulating human-like, error-prone reasoning.
Real-world applications:
- Evaluating AI tutoring systems before deployment, including checking whether feedback actually resolves misconceptions.
- Counterfactual analysis of alternative tutoring interventions.
- Diagnosing student misconceptions and generating targeted feedback.
- Learner-facing tools that externalize internal dialogue to support reflection and metacognition, and richer student representations for clustering by reasoning patterns rather than surface behavior.
Industry relevance: Educational technology platforms that deploy LLM tutors need simulated students to test and optimize tutors; a simulator with both realistic code behavior and inspectable reasoning offers a cheaper, safer proxy than live student trials, and supports misconception-aware intervention design.
Future Directions
-
Validate reconstructed traces with humans. The traces are approximations produced by retrospective inference, and LLMs trained toward expert reasoning may reconstruct novice reasoning as more coherent than it really was; think-aloud studies or retrospective verbalization protocols could calibrate them.
-
Move beyond supervised fine-tuning. The authors suggest reinforcement learning methods that let reasoning emerge through reward modeling rather than imitation of teacher traces, to close the gap between near-perfect teacher-trace alignment and the roughly 58% model alignment.
-
Disentangle test-split effects. The
test_OPversustest_NPsplits differ not only in problem familiarity but also in underlying student pass-rate distributions, which complicates interpretation. -
Raise reasoning alignment. Even the best result (about 58%) means a substantial share of generated claims do not explain the observed code edits, leaving room to capture reasoning that consistently accounts for student actions.
Target Audience
Researchers and graduate students in AI in education, student modeling, and LLM-based human simulation; practitioners building or evaluating AI tutors and educational platforms; and machine learning engineers interested in chain-of-thought supervision, LoRA fine-tuning, and evaluation of latent reasoning against observable behavior. Readers seeking an introduction to LLM simulation basics will find the paper advanced, since it centers on fine-tuning and distributional evaluation rather than introductory prompting.
Authors’ abstract
Large Language Model (LLM)-based simulators often reproduce observable actions but fail to capture the underlying reasoning behind them. In education, where student simulation is increasingly used for various applications such as evaluating tutoring systems, this gap is especially pronounced. Two students may submit identical submissions for entirely different reasons. We present INTERNAL STUDENT DIALOGUE (INSIDE), a student modeling framework that fine-tunes LLMs not only to act like students but also to think like them. INSIDE generates internal dialogue grounded in Bloom's Taxonomy across cognitive, affective, and action dimensions, and fine-tunes models on paired think traces and actions. We baseline against different prompting frameworks and evaluate on two axes: fidelity of simulated actions and quality of generated internal dialogue. Our evaluations show that INSIDE improves simulation fidelity in both action fidelity, matching code generation of real students, and reasoning alignment, achieving the highest alignment across models up to 57.9%.