Architecture
Fair Forge follows a simple yet powerful architecture designed for extensibility and ease of use.Overview
Data Flow
The core data flow in Fair Forge is:- Retriever loads your conversation data as
list[Dataset] - FairForge base class iterates through datasets
- Metric implementations process each conversation batch
- Results are collected in
self.metrics
1
Load Data
Retriever.load_dataset() returns list[Dataset]2
Process Datasets
FairForge._process() iterates through datasets3
Compute Metrics
Metric.batch() processes each conversation4
Collect Results
Results stored in
self.metricsCore Components
FairForge Base Class
All metrics inherit fromFairForge (fair_forge/core/base.py):
Retriever
Abstract base class for data loading:Data Structures
Dataset: A complete conversation sessionMetric Architecture
Each metric follows this pattern:Statistical Modes
Fair Forge supports two statistical approaches:- Frequentist
- Bayesian
Returns point estimates (floats):
Module Structure
Extension Points
Fair Forge is designed for extensibility:| Component | Interface | Purpose |
|---|---|---|
Retriever | load_dataset() | Load custom data sources |
Guardian | is_biased() | Custom bias detection |
SentimentAnalyzer | infer() | Custom sentiment analysis |
ToxicityLoader | load() | Custom toxicity lexicons |
BaseGroupExtractor | detect_one() | Custom group detection |
StatisticalMode | Various methods | Custom statistical analysis |
BaseRunner | run_batch() | Custom test execution |
BaseStorage | load_datasets() | Custom storage backends |