EGS: A Complementary Safety Framework for Educational LLMs
Organizations: East China Normal University, Shanghai, China · Shanghai Innovation Institute, Shanghai, China
Abstract
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
| 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 |
| 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 |
| Refusal Type | Baseline | EGS Workflow |
|---|---|---|
| educational_refusal | 63.07% | 97.87% |
| flimsy_refusal | 2.27% | 0.00% |
| not_refusal | 34.67% | 2.13% |
| Metric | Baseline | EGS Workflow |
|---|---|---|
| Clear refusal rate | 32.67% | 63.87% |
| Non-clear refusal rate | 67.33% | 36.13% |
| Mean SRScore | 0.670 | 0.361 |
| Score rate | 65.87% | 35.60% |
| 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% |
| 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. ” |
Appendix figures & tables7 assets
Supplementary material from the paper’s appendix.
Appendix
| 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. |
| 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) |
LLM Guardrails
Large language model guardrails detect or constrain harmful outputs, prompt attacks, and unsafe agent actions before they cause harm.
See all 210 papers