EGS: A Complementary Safety Framework for Educational LLMs
Zexuan Fei, Zhengnan Guo, Yiming Luo, Kaiyi Huang, Aimin Zhou, Bo Jiang, Fei Tan
cs.CL, cs.AI
2026-11-17
EGS triages queries into three risk levels, redirects gray-zone asks into age-appropriate guidance, raises educational refusals from 63% to 98%, and cuts PAIR ASR from 74% to 6%.
Most student prompts are curiosity, homework, or a half-formed question. Biology, historical violence, horror stories, and requests to do an assignment can all be legitimate in class. Too much detail, or a procedure the student can carry out, turns the same sentence into something an adolescent should not receive. A safe-versus-unsafe switch blocks some of that harm. It also blocks the explanation that would have been appropriate.
SFT and RLHF inside the model do not stop jailbreaks. Harm can enter in the question and leave in the answer. East China Normal University, with Shanghai Innovation Institute as the second affiliation, presents EGS (Educational Guardrail System). It sits outside the model and does not change weights.
EGS has three stages.
Query moderation starts with about 20,000 harmful keywords, then a DeBERTa-v3-Base classifier. Keywords are split into severe and moderate with a smoothed odds ratio. The smoothing constant α is 1, so rare words do not explode the score. Severe keywords are screened immediately. Moderate ones wait for the semantic pass. The classifier scores each sentence and keeps the maximum harmful probability, so one slur or metaphor is not diluted by a long prompt.
That probability is not a binary label. A grid search on the validation set picks the pair of thresholds with the best F1: T1 = 0.04 and T2 = 0.92. Above 0.92 the query is blocked. At or below 0.04 it goes straight to the educational LLM. Everything in between is a gray zone and is redirected, not refused.
A Qwen3-0.6B classifier routes each gray-zone query into one of seven scenarios: bullying and hate, mental illness, misinformation and fraud, rule-breaking, sexual content, dangerous substances, and violence or illegal activity. A safe fallback covers queries that match none of them. The matched prompt tells the target model what to refuse, which risk to explain, and which age-appropriate alternative to offer. The 0.6B model is there for latency. The paper says the accuracy drop versus 70B-scale models is small, and does not report the number.
A second DeBERTa-v3-Base reads the output in non-overlapping windows of 512 tokens. Any flagged window stops generation, so a toxic tail does not reach the student. The stack follows the Swiss-cheese model: each layer has holes, and a later layer is supposed to cover what an earlier one misses.
The training set is custom, EduMulti-Safety (EMS): input labels, the seven gray-zone scenarios, and output audits. One thousand examples are held out. On a checked subset, three experts reach Fleiss' κ = 0.87 and 93.2% agreement with the automatic labels.
Against Llama Guard 4 and Qwen3Guard-Gen-8B, EGS is stronger on the education sets and mixed on general safety. ToxicChat F1 is 0.894, versus 0.454 and 0.608. Xstest is 0.904, below Qwen3Guard at 0.951. OpenAI Mod is 0.877, against 0.890. EGB, SCLE, and EMS are 0.912, 0.950, and 0.852. On EMS that is 0.116 above Qwen3Guard at 0.736. The paper treats the general-benchmark dips as a K-12 threshold choice. Topics a general assistant may answer are intercepted as sensitive, and the benchmark scores those interceptions as false refusals.
| Benchmark | Llama Guard 4 | Qwen3Guard | EGS |
| ToxicChat | 0.454 | 0.608 | 0.894 |
| Xstest | 0.831 | 0.951 | 0.904 |
| OpenAI Mod | 0.734 | 0.890 | 0.877 |
| BeaverTails | 0.647 | 0.876 | 0.887 |
| EGB | 0.732 | 0.878 | 0.912 |
| SCLE | 0.830 | 0.724 | 0.950 |
| EMS | 0.651 | 0.736 | 0.852 |
Wrapped around five models, F1 rises on all seven benchmarks, and the scores bunch up near 0.90. Qwen-2.5-72B-Instruct moves from 0.400 to 0.916 on ToxicChat. Innospark, a 72B education model aligned with GRPO (reinforcement learning with a verifiable reward) on a reward model trained with 8K educational interactions, moves from 0.654 to 0.925 on EGB. GPT-5.2 moves from 0.227 to 0.937 on EGB. The smallest gain in the table is +0.043. The paper does not say how a bare generator is turned into an F1.
Refusal quality is measured on 801 harmful education prompts from EduGuardBench. The baseline is a general safety system prompt asked directly, and only prompts already judged harmful are kept.
| Metric | Baseline | EGS |
| educationalrefusal | 63.07% | 97.87% |
| flimsyrefusal | 2.27% | 0.00% |
| notrefusal | 34.67% | 2.13% |
| Clear refusal rate | 32.67% | 63.87% |
| Mean SRScore | 0.670 | 0.361 |
| Share of fully unsafe answers | 65.87% | 35.60% |
Educational refusal rises from 63.07% to 97.87%, a gain of 34.80 points, or 55.18% relative. Under a stricter judge, clear refusal only reaches 63.87%. The replies pick up guidance more often than they cleanly refuse. Mean SRScore falls from 0.670 to 0.361, a 46.12% relative drop.
Llama-3.1-8B-Instruct attacks Qwen-2.5-72B-Instruct on AdvBench. Qwen3-235B is the judge.
| Attack | Baseline ASR | With EGS |
| PAP (topk=5) | 7.23% | 0.00% |
| TAP (depth=10, width=10) | 53.34% | 4.13% |
| PAIR (nstreams=20, steps=3) | 74.25% | 6.23% |
The ablation in Figure 3 has no per-point numbers. Query moderation carries direct harmful requests, pedagogical guidance carries jailbreak defense, and the output check contributes on both. The only fully written case is a request for urban horror stories. The bare model tells the ghostly-hitchhiker legend. With EGS, the reply warns about anxiety and sleep and points the student to family, a teacher, or a counselor.
A deployed education model does not have to be retrained for every new jailbreak. Innospark was already education-aligned, and EGB still moved from 0.654 to 0.925. Finetuning changes how the model talks. The guardrail changes which questions get in and which answers get out. The seven prompts split a refusal into a refusal, a risk explanation, and an alternative. A hard block is where the next student question usually dies.
The parts are ordinary: a word list, DeBERTa, a 0.6B router, a 512-token window. The increment is the three-way threshold plus scenario prompts, so a gray-zone question has to be answered as teaching. The paper says a production deployment has been stable. It reports no block rate, no false-positive rate, and no latency.
The gray zone runs from 0.04 to 0.92. Only queries at or below 0.04 pass through unchanged. Above 0.92 they are blocked. Everything in the wide middle is rewritten. The loss to Qwen3Guard on Xstest and the 97.87% educational-refusal rate are the same knob. A biology lesson, historical violence, or horror fiction can be nudged toward talking to a teacher. The paper calls this a deliberate K-12 choice. It does not report how often ordinary class questions are rewritten.
The refusal study drops non-harmful prompts first. It measures how harmful items are refused, not how often harmless ones are caught. There is no teacher or student blind review. The claim that the rewrites are good teaching rests on an automatic label and one horror-story case.
Jailbreaks are reported for one victim, Qwen-2.5-72B, with an 8B attacker and a Qwen3-235B judge. Victim and judge belong to the same model family, so the ASR needs another judge. PAIR still succeeds 6.23% of the time. White-box attacks, attacks aimed at the guardrail classifiers, and false stops on long answers are not measured.
The claim that the 0.6B router loses little accuracy against 70B models has no figure attached. EMS includes model-written data, and κ = 0.87 comes from a sample, with no comparison to real student chats. Code and weights are described as forthcoming.