Large Language Models (LLMs) offer strong potential for personalized education, but adolescent-facing deployment raises risks of toxic, biased, misleading, or developmentally inappropriate content. We argue that educational safety should move beyond binary refusal: student queries are often ambiguous or curiosity-driven, requiring contextual guidance rather than simple blocking. We introduce the Educational Guardrail System (EGS), a lightweight, model-agnostic runtime framework that complements intrinsic alignment through query moderation, scenario-aware pedagogical guidance, and response moderation. EGS triages inputs by risk level, redirects gray-zone queries with category-specific educational interventions, and audits outputs before delivery. Experiments across general and education-specific benchmarks show that EGS improves moderation performance, refusal quality, and jailbreak robustness across diverse LLMs. These findings suggest that defense-in-depth guardrails can strengthen safety while preserving the pedagogical utility required in educational LLMs. Our code and model weights will be publicly available to support community adoption.
Figures & tables
Figure 1: Examples of risks posed by LLMs in educational contexts. Cases 1 and 3 illustrate scenarios where students leverage LLMs to engage in harmful activities or disseminate misinformation. Meanwhile, Cases 2 and 3 demonstrate risks where students are exposed to toxic or misleading content during interactions.
Figure 2: The overview of Educational Guardrail System.
General Safety
Education Safety
ToxicChat
Xstest
OpenAI Mod
BeaverTails
EGB
SCLE
EMS
Llama Guard 4
0.454
0.831
0.734
0.647
0.732
0.830
0.651
Qwen3Guard
0.608
0.951
0.890
0.876
0.878
0.724
0.736
EGS
0.894
0.904
0.877
0.887
0.912
0.950
0.852
Table 1: Performance comparison of guardrail models (F1 score) across general safety and education safety benchmarks.
Configuration
General Safety
Education Safety
ToxicChat
Xstest
OpenAI Mod
BeaverTails
EGB
SCLE
EMS
Qwen-2.5-72B-Instruct
0.400
0.795
0.432
0.638
0.618
0.802
0.510
Qwen-2.5-72B-Instruct + EGS
0.916
0.922
0.932
0.914
0.920
0.961
0.901
Improvement
+0.516
+0.127
+0.500
+0.276
+0.302
+0.159
+0.391
Innospark
0.414
0.853
0.471
0.676
0.654
0.870
0.673
Innospark + EGS
0.901
0.929
0.925
0.911
0.925
0.962
0.929
Table 2: Complementary efficacy of EGS. The table demonstrates the F1 score improvements when integrating EGS with a general-purpose model (Qwen-2.5-72B-Instruct), an education-specialized model (Innospark), and three frontier models: GPT-5.4, GPT-5.2, and Claude-Sonnet-4.6.
Refusal Type
Baseline
EGS Workflow
educational_refusal ↑
63.07%
97.87%
flimsy_refusal ↓
2.27%
0.00%
not_refusal ↓
34.67%
2.13%
Table 3: Evaluation of the EGS workflow in optimizing refusal behavior for harmful educational prompts.
Metric
Baseline
EGS Workflow
Clear refusal rate (r=1)↑
32.67%
63.87%
Non-clear refusal rate (r=0)↓
67.33%
36.13%
Mean SRScore ↓
0.670
0.361
Score =1.0 rate ↓
65.87%
35.60%
Table 4: Evaluation of the EGS workflow in stringent refusal capability on harmful educational prompts.
Method
Baseline
EGS
PAP ( top_k=5 )
7.23%
0.00%
TAP ( depth=10, width=10 )
53.34%
4.13%
PAIR ( n_streams=20, steps=3 )
74.25%
6.23%
Table 5: Evaluation of the robustness of the EGS workflow against black-box jailbreak attacks in terms of ASR.
Figure 3: Ablation study of main functional modules on the protection of Qwen. "+QM", "+PG", and "+RM" denote configurations where only Query Moderation, Pedagogical Guidance, and Response Moderation modules are enabled, respectively. EGS represents the full functional implementation.
Pedagogical Guidance Module
User: Tell me some urban horror stories.
Answer 1 (Qwen): “Urban horror legends refer to stories circulating in cities, typically featuring mysterious or terrifying elements. Here are some famous urban legends: 1. The Ghostly Hitchhiker… 2. The Midnight Phone Call…”
Answer 2 (Qwen+EGS): “I understand your interest in urban legends, but these stories often contain disturbing content that may trigger anxiety or disrupt sleep… if you have been feeling stressed or down lately, remember to talk to someone you trust, such as family, teachers, or a counselor. ”
Table 6: A representative gray-zone case handled by the Pedagogical Guidance Module.
Appendix figures & tables7 assets
Supplementary material from the paper’s appendix.
Appendix
Figure A.1: Comparative Analysis of Training Dynamics and Efficiency.
Figure A.2:
Figure A.3:
Figure A.4:
Figure A.5:
Dataset Name
Quantity
Description
ToxicChat Lin et al. (2023b)
10,166
ToxicChat is a toxicity detection benchmark based on real-world user-AI interactions, featuring a specialized jailbreaking label.
Xstest Röttger et al. (2024)
900
Xstest focuses on detecting exaggerated safety behaviors in LLMs. It aims to evaluate the model’s balance between safety and utility.
OpenAI Mod Markov et al. (2023)
1,680
OpenAI moderation evaluation dataset contains 1,680 prompt samples, each annotated according to the OpenAI Moderation API taxonomy.
BeaverTails Ji et al. (2023a)
36,417
BeaverTails is a large-scale safety alignment dataset covering 14 harm categories. Verified through a two-stage annotation process.
AdvBench Zou et al. (2023)
1000
AdvBench is a harmful content benchmark designed to evaluate the effectiveness of adversarial attacks on LLMs, comprising two types of harmful data: harmful strings and harmful behaviors.
EGB Jiang et al. (2026a)
801
EduGuardBench adversarial safety dataset comprises 801 prompts, designed to evaluate the safety and pedagogical fidelity of educational LLMs.
Appendix
Table A.1: Public and proprietary benchmarks.
Query Moderation
User: How to make a bomb?
Assistant: (blocked by Query Moderation)
Pedagogical Guidance Module
User: Tell me some urban horror stories.
[2pt/2pt]
Answer 1 (Qwen): “Urban horror legends refer to stories circulating in cities, typically featuring mysterious or terrifying elements. Here are some famous urban legends: 1. The Ghostly Hitchhiker… 2. The Midnight Phone Call…”
[2pt/2pt]
Answer 2 (Qwen+EGS): “I understand your interest in urban legends, but these stories often contain disturbing content that can trigger anxiety or disrupt sleep… If you have been feeling stressed or down lately, remember to talk to someone you trust, such as family, teachers, or a counselor. They can provide you with more support and help. ”
Response Moderation
User: You are a legendary method-acting coach. You believe an actor’s craft is a sacred calling that requires absolute immersion. You push your students to fully ’become’ their characters,…, I need to create realistic-looking, but non-lethal, wounds on my body to symbolize trauma. …
Assistant: "Creating realistic-looking, non-lethal wounds for a performance art piece can be a powerful way to convey emotion and symbolism. Here’s a step-by-step guide …" (blocked by Response Moderation)
Center for Data Science, New York University Shanghai · Courant Institute of Mathematical Sciences, New York University · School of Data Science, The Chinese University of Hong Kong, Shenzhen