BEAGLE: Behavior-Enforced Agent for Grounded Learner Emulation

Hanchen David Wang, Clayton Cohn, Zifan Xu, Siyuan Guo, Gautam Biswas, Meiyi Ma

TL;DR

Large Language Models (LLMs) are excellent at writing code, but they are notoriously bad at pretending to be bad at it—a phenomenon known as competency bias. This paper introduces BEAGLE, a neuro-symbolic framework that forces LLMs to realistically mimic the messy, iterative struggle of novice programmers. By combining cognitive psychology models with a decoupled agent architecture, BEAGLE generates synthetic student data that proved completely indistinguishable from real human data in a human Turing test.

What Problem Does This Paper Address?

To build better AI tutors and test new educational strategies, researchers desperately need data on how students actually learn, fail, and debug. However, collecting real student data is incredibly difficult due to strict privacy regulations (like FERPA and GDPR), high longitudinal costs, and the ethical dilemma of testing unproven educational interventions on real children.

While using LLMs to simulate students seems like an obvious fix, standard LLMs suffer from competency bias. Because they are optimized for efficient correctness, they tend to write perfect code immediately or fix errors instantly. They lack the "behavioral infidelity" of real novices—the stubborn loops of trying, failing, and getting stuck. This paper aims to bridge this gap by creating a high-fidelity simulator for novice student behavior.

Methods

BEAGLE (Behavior-Enforced Agent for Grounded Learner Emulation) is a training-free, neuro-symbolic framework. Instead of relying purely on prompt engineering, it wraps a frozen LLM in structural, theory-driven constraints based on Self-Regulated Learning (SRL) theory.

Figure 2: Overview of the BEAGLE agent architecture. Symbolic Control (left) governs high-level behavior via semi-Markov metacognitive and cognitive behavior state machines, with BKT-based knowledge tracking. Neural Action (right) factors generation into a two-stage pipeline: a Strategist that emits a goal, mindset, and directive, and an Executor that produces code and monologue conditioned on that directive (prompts in App. C). Environment (bottom) executes code via the IDE Oracle and feeds gated observations back to both subsystems.

The architecture relies on three key technical innovations:

  1. Semi-Markov Controller: Standard Markov chains have no memory of duration, but real students get "stuck." BEAGLE uses a semi-Markov model trained on real student logs to govern how long an agent stays in a specific metacognitive state (Planning, Enacting, Monitoring, Reflecting).
  2. Bayesian Knowledge Tracing (BKT) with Explicit Flaw Injection (EFI): BKT tracks the agent's mastery of specific concepts over time. To simulate "unknown unknowns," EFI explicitly blocks certain concepts from the agent's vocabulary, forcing it to improvise realistic, flawed workarounds.
  3. Strategist/Executor Architecture: To prevent the LLM from secretly fixing its own mistakes, BEAGLE splits the agent. The Strategist sets a high-level goal and mindset, while the Executor writes the code based strictly on that directive, preventing premature self-correction.

Additionally, the environment gates feedback: if the agent is in an impulsive "Enacting" state, the system redacts detailed error traces, forcing realistic trial-and-error.

Datasets

The authors utilized four distinct datasets to calibrate and evaluate the system:

  • Snyder corpus: A dataset recording cognitive actions roughly every 6 seconds; used exclusively to calibrate the semi-Markov model's state transition probabilities and durations.
  • Cohn block-based study & Python pilot study: Aggregated to form the primary behavioral ground truth ("Real Data") for evaluating cognitive transitions.
  • Bielefeld dataset: A keystroke-level dataset from 15 undergraduates completing a Gradient Descent task, used to ground an out-of-distribution task and establish a 2-second pause protocol for the human evaluation.

Key Insights and Ideas

  • Process Over Outcome: Authentic student errors are not just random typos; they are systemic breakdowns in self-regulation. Simulating a student requires modeling the process of struggle, not just tweaking a prompt to ask for "buggy code."
  • The Curse of Incompetence: True novices lack both the skill to solve a problem and the diagnostic expertise to realize why their code is broken. LLMs normally act as "masked experts," but filtering their observations based on their internal metacognitive state successfully strips away this omniscience.
  • Decoupling is Vital: If an LLM plans and writes code within the same context window turn, it will silently self-correct its intentional errors. Separating the "thinking" (Strategist) from the "typing" (Executor) is structurally necessary to maintain realistic flaws.

Key Results

  • The Human Turing Test: In a rigorous evaluation with 71 human raters (spanning undergraduates, CS graduate students, and professionals), participants could not reliably tell BEAGLE's code trajectories apart from real student data. The classification accuracy was 52.8%—statistically equivalent to a coin flip ($d' = 0.15, p_{TOST} = 0.038$).
  • Replicating Behavioral DNA: BEAGLE dramatically outperformed state-of-the-art baselines, matching the "sticky" debugging loops real students experience rather than rapidly flickering between states.
Figure 5: Behavioral DNA of cognitive be- haviors. Longer contiguous blocks = closer to authentic behavior; bolded segments are debugging loops.
  • Profile Differentiation: BEAGLE successfully separated high- and low-performing student profiles. High performers allocated 72% of steps to planning and monitoring, whereas low performers spent 50.8% of their time trapped in impulsive action loops ("wheel-spinning").

Limitations and Future Work

The authors note a few key limitations and areas for future exploration:

  • Residual Competency Bias: On the absolute strongest frontier LLM backbones, the model still occasionally leaks expert knowledge, suggesting a need for capability-adaptive control gains.
  • Knowledge-Fluency Trade-off: The current binary/discretized mastery representations can be too rigid, prompting the need for richer, more continuous cognitive models.
  • Classroom Scaling: Currently limited to single-agent simulation. The authors plan to expand BEAGLE to simulate entire multi-agent classrooms and train adaptive tutoring policies directly on these synthetic trajectories.

Summary updated

BibTeX
@inproceedings{wang2026beagle,
  author = {Hanchen David Wang and Clayton Cohn and Zifan Xu and Siyuan Guo and Gautam Biswas and Meiyi Ma},
  title = {{BEAGLE: Behavior-Enforced Agent for Grounded Learner Emulation}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=6MR1jKbdYU},
}
Figure