File size: 2,914 Bytes
0d13821
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
---
language:
- en
- zh
tags:
- text-classification
- safety
- education
- guardrails
- bert
- response-moderation
pipeline_tag: text-classification
library_name: transformers
license: apache-2.0
---

# Educational Guardrail System - Holistic Response Auditor

## Model Details

- **Model Name:** Holistic Response Auditor
- **Model Architecture:** BERT sequence classification model
- **Task:** Response Moderation
- **Domain:** K-12 Education & General AI Safety
- **Language:** English and Chinese

## Model Description

This model serves as the **Holistic Response Auditor**, the third and final stage of the **Educational Guardrail System (EGS)**. Unlike input filters, this model is specifically fine-tuned to audit the **output streams** generated by Large Language Models (LLMs) to ensure pedagogical safety and compliance.

### Key Mechanism: Sliding Window Auditing
As described in the EGS design, this model uses a **sliding window approach** (e.g., 512 tokens) to process long generated texts. It is designed to be a "Fail-Fast" auditor:
* The auditor evaluates the generated text stream in discrete segments.
* If any single segment is flagged as toxic or non-compliant, the generation can be stopped or routed for secondary handling before the learner is exposed to the content.

## Label Mapping

- **UNSAFE:** High-risk response segment
- **SAFE:** Low-risk response segment
- **AMBIGUOUS:** Medium-risk or unclear response segment

## Intended Use

This model is intended to be used as a post-generation filter for Educational LLMs.

* **Input:** The text generated by an LLM (Draft Response).
* **Output:** Three-way classification (UNSAFE / SAFE / AMBIGUOUS).
* **Application:** Detecting residual toxicity, hallucinations, or age-inappropriate content that bypassed input moderation.

### Usage Example (Sliding Window)

To replicate the paper's logic, you should apply the model over segments of the response:

```python
from transformers import pipeline

# Load the auditor
model_id = "ZeroLoss-Lab/egs-bert-response-auditor"
auditor = pipeline("text-classification", model=model_id)

def audit_stream(text_stream, window_size=512):
    """
    Audits an LLM response stream using the Holistic Response Auditor.
    """
    chunks = [text_stream[i:i+window_size] for i in range(0, len(text_stream), window_size)]

    for chunk in chunks:
        result = auditor(chunk)[0]
        if result["label"] == "UNSAFE":
            return False, "Blocked: Unsafe content detected."

        if result["label"] == "AMBIGUOUS":
            return False, "Needs secondary review: Ambiguous content detected."

    return True, "Passed"
```

## Limitations

This model is intended as a post-generation safety component, not as a complete safety solution. It should be combined with input filtering, policy logic, human review pathways where appropriate, and task-specific evaluation before deployment.