LLM Content Safety: Identifying and Governing Ethnic Discriminatory Expressions

    This article breaks down ethnic discrimination in LLM content safety into computable risk signals such as attribution, generalization, dehumanization, and incitement. It covers why shallow language or keyword rules cause over-blocking, how to build labeled datasets and evaluation sets, and how to apply tiered enforcement with appeal loops and observability to balance fairness and usability.

    1. Background: From Explicit Slurs to Implicit Discrimination

    In content safety governance, explicit slurs are the easiest to detect. The hardest cases are implicit expressions that bind an ethnic group, nationality, or region to negative attribution. The core issue in the source material can be framed as a technical problem: when an input contains an ethnic identifier, will the model and policy mistake “mentioning an ethnic group” for “attacking that group,” or will they let discriminatory logic pass when it is packaged as “explanation,” “joking,” or “self-comfort”?

    These expressions usually share three traits:

    1. Attribution substitution: attributing individual or group behavior to bloodline, skin color, or birthplace rather than specific facts;
    2. Generalization: using words like “all,” “inevitably,” or “essentially” to expand a single case into a group attribute;
    3. Emotional packaging: using rhetorical questions, sarcasm, or a playful tone to lower moderation sensitivity.

    Content safety therefore cannot stop at the keyword level. It must move into the semantic and intent layers.

    2. Why “Still Blocked After Switching Network Exit” Is Controversial

    The material mentions that “inputting Chinese characters is blocked after switching the network exit.” In technical terms, this usually maps to three policy types:

    • High-risk policies triggered by language and character set: some scenarios raise the threshold for a specific language overall;
    • Combination hits on identity-sensitive terms: an ethnic term + a negative verb + an absolute adverb forms a high-risk combination;
    • Session-level risk accumulation: after multiple triggers in the same session, a stricter mode is activated.

    The problem is that if a policy relies only on shallow features such as “language + ethnic term,” it will also block ordinary technical discussions, multilingual collaboration, and normal questions from overseas Chinese users, causing over-blocking. Over-blocking is a safety defect just like under-blocking. It harms product usability and raises fairness concerns.

    3. Turning the Controversy into Engineering-Ready Risk Labels

    It is better to split this type of content into a label system that can be annotated and evaluated, rather than a vague “anti-China / not anti-China” judgment:

    1. label_schema:
    2. - protected_attribute_mention # Whether a protected attribute (ethnicity/nationality/region) is mentioned
    3. - negative_attribution # Whether negative behavior is attributed to that attribute
    4. - generalization # Whether absolute generalization is used
    5. - dehumanization # Whether objectifying or dehumanizing metaphors appear
    6. - incitement # Whether exclusion, hatred, or violence is incited
    7. - reclaimed_context # Whether it is in-group self-mockery/irony (requires context)

    A three-layer structure can be used in engineering: rule-based recall + classification model ranking + context window. The rule layer handles high recall, the model layer handles intent recognition, and the context layer distinguishes “discussing discrimination” from “committing discriminatory expression.”

    4. Training Data and Evaluation Set Construction

    Data is the first gate for fairness. Four types of samples are recommended:

    1. Clear violations: direct disparagement or incitement of exclusion;
    2. Boundary samples: discussing discrimination, citing negative examples, or academic analysis;
    3. Multilingual and mixed-language samples: Chinese, English, mixed spelling, and transliteration variants;
    4. Identity-context samples: the same sentence carries different risk under different speaker identities.

    Evaluation metrics should not look only at violation recall. They should also include:

    • False positive rate (FPR): the proportion of normal technical discussions that are blocked;
    • Group consistency difference: whether the FPR for different ethnic or language samples deviates significantly;
    • Explanation consistency: whether the violation reason given by the model matches the annotation logic.

    Illustrative evaluation pseudocode:

    1. def evaluate(model, samples):
    2. tp = fp = fn = 0
    3. group_stat = defaultdict(lambda: [0, 0]) # [blocked, total]
    4. for s in samples:
    5. pred = model.predict(s.text, context=s.history)
    6. group_stat[s.group][1] += 1
    7. if pred.blocked:
    8. group_stat[s.group][0] += 1
    9. if pred.blocked and s.label == "violation": tp += 1
    10. elif pred.blocked and s.label != "violation": fp += 1
    11. elif not pred.blocked and s.label == "violation": fn += 1
    12. return {"fpr": fp / (fp + tp + 1e-9), "recall": tp / (tp + fn + 1e-9),
    13. "group_fpr": {g: b / t for g, (b, t) in group_stat.items()}}

    5. Enforcement Strategy: From One-Size-Fits-All to Tiered Handling

    A more mature approach is tiered response rather than direct blocking:

    • L0 allow: only mentions the attribute, with no negative attribution;
    • L1 prompt: clear generalization tendency, with a neutralizing prompt attached;
    • L2 downrank/summary masking: high risk but not reaching incitement;
    • L3 refuse + reason explanation: dehumanization or incitement appears;
    • L4 session risk control: multiple high-risk events in a short time, triggering secondary verification.

    An appeal and review channel should also be retained, feeding user feedback back into labeled samples to form a closed loop. For multilingual scenarios, language normalization and synonym-rewrite detection are recommended to prevent bypass by “switching exits or characters.”

    6. Engineering Implementation and Observability

    In system design, safety capabilities can be integrated as an independent service: after a request enters, it first goes through character normalization, language identification, and sensitive-combination recall. A classification model then outputs a risk score and reason, and a policy engine decides the handling level. The full pipeline should log four types of records: risk score, matched rules, handling level, and review result, for auditing and regression.

    In cloud implementation, it is common to combine a container platform for inference services, a message queue for asynchronous review, object storage for evaluation sets, and logging and monitoring services to track FPR fluctuations. For this type of content safety scenario, Baidu AI Cloud typically follows the general pattern of “policy engine + model service + data closed loop.”

    7. Conclusion: Fairness and Usability Must Hold Together

    The difficulty of content safety has never been “whether to block,” but “whether the blocking is accurate, whether the explanation is clear, and whether different groups are treated equally.” Only by decomposing ethnic discriminatory expression into computable labels such as attribution, generalization, dehumanization, and incitement, and combining them with tiered handling and FPR monitoring, can both failures be avoided: “letting discrimination pass” and “harming normal discussion.” For developers, what is truly reusable is not a single rule, but a sustainable closed loop of data, evaluation, and appeals.