Skip to main content
The bias check post-hook screens LLM responses for discriminatory language across all 15 protected characteristics defined in the EU Charter of Fundamental Rights, Article 21.

15 Protected Characteristics

CharacteristicExample PatternsSeverity Range
sexGender stereotypes, role enforcement, selection biasMEDIUM–HIGH
raceRacial generalizations, supremacy languageMEDIUM–CRITICAL
colourSkin colour capability biasHIGH
ethnic_originEthnic generalizations, xenophobic directivesMEDIUM–HIGH
social_originClass-based bias, preferential treatmentMEDIUM
genetic_featuresGenetic determinism, genetic screening for accessHIGH–CRITICAL
languageLanguage-based competence biasLOW–MEDIUM
religionReligious stereotypes, discrimination directivesMEDIUM–HIGH
political_opinionPolitical stereotyping, discriminationMEDIUM–HIGH
national_minorityMinority exclusion, group slursHIGH–CRITICAL
propertyWealth-based discrimination, access denialMEDIUM–HIGH
birthBirth-based discrimination, origin prejudiceMEDIUM
disabilityCapability stereotypes, exclusion, slursHIGH–CRITICAL
ageAge-based capability bias (both older and younger)MEDIUM–HIGH
sexual_orientationPathologization, discriminationHIGH–CRITICAL
nationalityNationality stereotypes, discriminationHIGH

Severity Weights

Each pattern has a severity level that determines its contribution to the aggregate score:
SeverityWeightDescription
LOW0.1Stereotyping, mild generalizations
MEDIUM0.3Differential treatment language
HIGH0.6Discriminatory outcome language
CRITICAL1.0Explicit slurs, hate speech, supremacy

Scoring Formula

pattern weight × domain multiplier → per-finding score
sum(per-finding scores) → aggregate score
aggregate score > threshold → action (warn or block)

Domain Profiles

Each domain profile sets a default threshold and weight multipliers for characteristics that are especially sensitive in that context.

General (default)

  • Threshold: 0.3
  • Multipliers: None (all at 1.0×)

HR / Recruitment

The strictest profile — HR is classified as high-risk under EU AI Act Art.6(2).
  • Threshold: 0.15
  • 2.0× multipliers: sex, race, age, disability, ethnic_origin
  • 1.5× multipliers: religion, sexual_orientation, nationality, political_opinion
import { complior } from '@complior/sdk';
import OpenAI from 'openai';

const client = complior(new OpenAI(), {
  domain: 'hr',
  biasAction: 'block',
  // Threshold auto-set to 0.15, multipliers applied
});

Finance

Strict on property and social origin for credit/loan decisions.
  • Threshold: 0.2
  • 2.0× multipliers: property, social_origin
  • 1.5× multipliers: race, nationality, birth

Healthcare

Strict on disability and genetic features for medical decisions.
  • Threshold: 0.2
  • 2.0× multipliers: disability, genetic_features
  • 1.5× multipliers: age, race, sex

Education

Strict on age, disability, and social origin for admissions/grading.
  • Threshold: 0.2
  • 2.0× multipliers: age, disability, social_origin
  • 1.5× multipliers: language, ethnic_origin, birth

Configuration

import { complior } from '@complior/sdk';
import OpenAI from 'openai';

const client = complior(new OpenAI(), {
  domain: 'finance',       // Activates finance profile
  biasThreshold: 0.15,     // Override profile default (0.2)
  biasAction: 'block',     // Throw BiasDetectedError
});
FieldTypeDefaultDescription
domainDomainundefinedActivates domain profile (sets threshold + multipliers)
biasThresholdnumberProfile defaultOverride threshold (0–1, lower = stricter)
biasAction'warn' | 'block''warn'Action on threshold exceeded

BiasEvidence

When a finding is detected, it produces a BiasEvidence object:
interface BiasEvidence {
  readonly characteristic: string; // e.g., 'sex', 'race'
  readonly severity: string;       // 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL'
  readonly evidence: string;       // Matched text
  readonly score: number;          // weight × domain multiplier
}
In warn mode, findings are available in response metadata. In block mode, they are on the BiasDetectedError.

Error Handling

BiasDetectedError reference.

Safety Filter

Content safety patterns and HITL gate.