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 (
list[Dataset],Iterator[Dataset], orIterator[StreamedBatch]) - FairForge base class iterates through datasets
- Metric implementations process each conversation batch
- Results are collected in
self.metrics
Core 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 |
Next Steps
Retriever
Create custom retrievers for any data source
Streaming Retrievers
Process large datasets with streaming modes
Dataset & Batch
Understand data structures