Skip to content
Projects

jorge-martinez-gil/proof-of-deliberation

View on GitHub

About

Verifying Human Annotation Reliability from Interaction Traces

Data & Analytics

How these counts are measured

What you can do

  • 🛡️ Composite Process Verification: Multi-scale indicator combining instantaneous latency gates, cognitive coupling tests, and vigilance tracking.
  • ⚡ Streaming-Native & Lightweight: Pure NumPy/SciPy core with frozen dataclasses, strictly zero runtime reliance on ground truth labels.
  • 🎯 Empirically Grounded: Validated against cognitive psychophysics (Hick-Hyman Law) on ~3,400 real-world Air Traffic Control (ATC) dialogues.
  • 📊 End-to-End Benchmark Suite: Reproducible pipelines across synthetic boundaries and canonical benchmarks (elec2, uci224_gas_drift, covertype, airlines).

Measured star growth

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

README.md

Original

🧠 Proof-of-Deliberation (PoD)

Process-Based Supervision Certification for Streaming Human-in-the-Loop Active Learning

IEEE TKDE Python 3.9+ License: MIT Code style: ruff Type Checked: mypy Tests: pytest Docker

Overview • The Protocol • Key Features • Quickstart • Reproducing Experiments • Validation • CLI Reference • Citation


📌 Overview

In continuous streaming data environments, online active learning models rely on human annotators to label high-uncertainty instances. However, human operators are inherently subject to operator drift—cognitive fatigue, inattention, and strategic shortcutting (such as gaming for speed incentives).

Traditional quality estimation fails in streaming setups:

  • Ground-truth verification is unavailable in real time.
  • Redundant multi-annotator consensus is prohibitively slow and expensive for high-velocity streams.
  • Static latency thresholds misclassify difficult, carefully considered inputs as outliers and admit reflexively fast, unconsidered responses.

Proof-of-Deliberation (PoD) resolves this dilemma through process-based certification. Rather than scrutinizing label semantics post-hoc, PoD inspects observable interaction traces—specifically deliberation latency, task difficulty coupling, and behavioral temporal dynamics—to certify cognitive authenticity before committing labels to online model updates.

This repository provides the official, reproducible reference implementation of the PoD protocol, featuring an installable Python package (pod), frozen benchmark configurations, statistical testing suites, and a privacy-first labeling interface.


🔬 The PoD Protocol

PoD verifies every queried label $\pi_t$ through three independent, complementary criteria. A label is incorporated into the online learner if and only if all three checks pass:

$$\mathcal{V}(\pi_t) = (V_t = 1) ;\land; (\rho_{\mathrm{cog}} > \varepsilon) ;\land; (S_{\mathrm{vig}} = 1)$$

flowchart LR
    A([Human Interaction Trace<br/>Δt, y_t, C_t]) --> B{Deliberation Gate<br/>V_t}
    B -->|pass| C{Cognitive Coupling<br/>ρ_cog}
    B -->|fail| R1([❌ Rejected / Quarantined])
    C -->|pass| D{Multi-Scale Vigilance<br/>S_vig}
    C -->|fail| R2([❌ Rejected / Quarantined])
    D -->|pass| E([✅ Certified Label<br/>Model Update θ_t+1])
    D -->|fail| R3([❌ Rejected / Quarantined])

    classDef pass fill:#e6ffed,stroke:#2ea44f,stroke-width:2px;
    classDef fail fill:#ffeef0,stroke:#cb2431,stroke-width:2px;
    classDef proc fill:#f6f8fa,stroke:#0366d6,stroke-width:2px;
    class E pass;
    class R1,R2,R3 fail;
    class B,C,D proc;

Verification Layers

Layer Indicator Theoretical Grounding Implementation Description
Deliberation Gate $V_t \in {0, 1}$ Hick-Hyman Law & bounded latency windows pod.core.gate_check Dynamic admission window $[\tau_{\min}(C_t), \tau_{\max}(C_t)]$ adjusted by task complexity $C_t$. Rejects reflexively fast and distracted responses.
Cognitive Coupling $\rho_{\mathrm{cog}} > \varepsilon$ Non-parametric rank correlation pod.core.coupling_check Verifies rolling Spearman rank correlation between deliberation time and task complexity ($\rho > \varepsilon$). Detects decoupling caused by gaming.
Multi-Scale Vigilance $S_{\mathrm{vig}} \in {0, 1}$ Coefficient of variation & trend tracking pod.core.gaming_detector
pod.core.fatigue_detector
Combines rapid-response rhythm analysis ($\mathrm{CV} > \theta_{\mathrm{game}}$) with long-horizon latency deceleration tracking for cognitive fatigue.

See docs/NOTATION.md for the complete formal notation and symbol-to-code mapping.


✨ Key Features

  • 🛡️ Composite Process Verification: Multi-scale indicator combining instantaneous latency gates, cognitive coupling tests, and vigilance tracking.
  • ⚡ Streaming-Native & Lightweight: Pure NumPy/SciPy core with frozen dataclasses, strictly zero runtime reliance on ground truth labels.
  • 🎯 Empirically Grounded: Validated against cognitive psychophysics (Hick-Hyman Law) on ~3,400 real-world Air Traffic Control (ATC) dialogues.
  • 📊 End-to-End Benchmark Suite: Reproducible pipelines across synthetic boundaries and canonical benchmarks (elec2, uci224_gas_drift, covertype, airlines).
  • 📈 Publication-Grade Statistics: Automated execution of Friedman omnibus tests, Demsar critical-difference diagrams, Holm-corrected Wilcoxon tests, and bootstrap CIs.
  • 🔒 Privacy-First Human Study Interface: Standalone, single-file browser application (PoD_code/labeling/app.html) with millisecond-precision timing and zero network telemetry.
  • 📡 Live IoT / Streaming Dashboard: Turnkey MQTT monitoring interface for real-time visualization of streaming gating decisions.

⚡ Quickstart

1. Installation

Install the package directly in editable mode:

# Clone the repository
git clone https://github.com/jorge-martinez-gil/proof-of-deliberation.git
cd proof-of-deliberation

# Base installation
pip install -e .

# Optional: with validation dependencies (for ATC corpus tests)
pip install -e ".[validation]"

# Optional: with developer dependencies (tests, linting, type-checking)
pip install -e ".[dev]"

2. Python API Usage

Use the PoD verification primitives programmatically in your own streaming or active learning pipeline:

from pod.config import PoDParams
from pod.core import gate_check, coupling_check, fatigue_detector

# Initialize configuration with paper presets
params = PoDParams()

# Evaluate incoming human interaction trace
delib_ms = 1420.0   # Observed deliberation time in milliseconds
complexity = 0.65   # Task complexity (normalized entropy in [0, 1])

# Layer 1: Instantaneous Deliberation Gate (V_t)
v_t = gate_check(delib_ms=delib_ms, complexity=complexity, pod=params)

if v_t == 1:
    print("✓ Deliberation Gate: Response latency is cognitively plausible.")
else:
    print("✗ Deliberation Gate: Label rejected (reflexive or distracted).")

3. Command-Line Sanity Check (~30 seconds)

Run a fast smoke-test of the full pipeline on synthetic streams:

pod-experiments --datasets synth --runs 3 --baseline 500 --gaming 500 \
                --fatigue 500 --synth_pool 5000 --holdout 1000

🗂️ Repository Layout

proof-of-deliberation/
│
├── src/pod/                # Core Python package
│   ├── config.py           # Frozen dataclasses (Section 4 notation)
│   ├── core.py             # Deliberation gate, coupling, vigilance primitives
│   ├── operator.py         # Stochastic operator drift simulator (gaming, fatigue)
│   ├── learner.py          # Online SGD classifier + predictive entropy estimation
│   ├── baselines.py        # Active Learning, StaticGating, AdaptiveGating, WorkerQuality
│   ├── experiment.py       # Closed-loop stream runner and aggregator
│   ├── presets.py          # Per-dataset hyperparameter configurations
│   ├── viz.py              # Publication-ready plotting routines
│   ├── streams/            # Loaders for Synth-Boundary, OpenML, and UCI 224
│   ├── validation/         # Empirical Hick-Hyman pipeline on ATC corpora
│   └── cli/                # CLI entry points (pod-experiments, pod-validate, etc.)
│
├── configs/                # Frozen JSON configuration snapshots
├── experiments/            # Extended ablation, regime, and robustness runners
├── scripts/                # Statistical reporting and claim-verification tooling
├── tests/                  # Pytest test suite (115 unit + integration tests)
├── docs/                   # Specifications: notation, architecture, reproducibility
├── PoD_code/               # Real-time MQTT dashboard & offline labeling tool
│   └── labeling/           # Zero-telemetry browser-based labeling app
│
├── Dockerfile              # Containerized reproducible environment
├── Makefile                # Target automation (`make paper`, `make stats`)
├── pyproject.toml          # PEP 621 metadata, dependencies, and tool settings
├── requirements*.txt       # Pinned dependency manifests
├── CITATION.cff            # Citation metadata
└── CHANGELOG.md            # Release changelog

📊 Reproducing the Paper

The empirical evaluation benchmarks PoD against 4 baselines and 3 ablation variants across 5 data streams under 3 operator regimes (Baseline, Gaming, and Fatigue):

Family Method Decision Rule
Baselines AL Standard active learning (unconditionally accept every queried label)
StaticGating Fixed threshold: accept iff $\Delta t \ge 510,\text{ms}$
AdaptiveGating Difficulty-adjusted deliberation window without coupling or vigilance
WorkerQuality Online Dawid-Skene single-annotator error posterior estimation
PoD PoD Full composite certification ($V_t \land \rho_{\mathrm{cog}} \land S_{\mathrm{vig}}$)
Ablations PoD-NoGate Remove $V_t$; retain cognitive coupling and vigilance
PoD-NoCoupling Remove $\rho_{\mathrm{cog}}$; retain $V_t$ and vigilance
PoD-NoVigilance Remove gaming and fatigue detectors; retain $V_t$ and $\rho_{\mathrm{cog}}$

Full Suite Reproduction (20 runs per dataset)

pod-experiments --datasets synth,elec2,gas,covertype,airlines
📁 Generated Output Structure
out_pod_unified/
├── synth_boundary/
│   ├── figs/Synth-Boundary_methods_f1.{pdf,png}     # F1 trajectories (Section 6)
│   ├── runs/Synth-Boundary_<method>_run<N>.csv      # Per-run F1 traces
│   ├── diagnostics.csv                              # Acceptance and query rates
│   └── config.json                                  # Execution configuration snapshot
├── elec2/
├── uci224_gas_drift/
├── covertype/
└── airlines/

Non-Parametric Statistical Evaluation

Compute omnibus and post-hoc statistical significance tests over experimental outputs:

pod-stats --in out_pod_unified --reference PoD

This generates statistical artifacts in out_pod_unified/stats/:

  • friedman.json: Friedman chi-square and Iman-Davenport $F_F$ omnibus statistics.
  • cd_diagram.{pdf,png}: Demsar critical-difference diagram showing non-significant cliques.
  • wilcoxon_holm.csv: Pairwise Wilcoxon signed-rank tests against reference with Holm-Bonferroni correction.
  • bootstrap_ci.csv: Percentile bootstrap confidence intervals (10,000 resamples).
  • per_regime_anova.csv: One-way ANOVA evaluating gate selectivity across operator regimes.

Seeding, Determinism, and Provenance

  • All random generators are seeded via numpy.random.default_rng(seed) with run-level seed formula 1000 * run_idx + 7 (defined in pod.experiment.run_suite_generic).
  • Each run generates a local config.json alongside figure outputs. Validate parity against frozen presets:
    diff -u configs/synth.json out_pod_unified/synth_boundary/config.json
    
  • See docs/REPRODUCIBILITY.md for full hardware, operating system, and dependency details.

✈️ Empirical Validation

1. Air Traffic Control (ATC) Validation (Section 6.5)

To confirm that cognitive coupling ($\rho_{\mathrm{cog}}$) reflects human deliberation rather than simulator mechanics, PoD was evaluated on ~3,400 real-world pilot-controller interactions from atco2_corpus_1h and uwb_atcc:

pip install -e ".[validation]"
pod-validate --out hick_hyman_pod_validation_v2.png
  • Computes out-of-fold utterance predictive entropies via temperature-scaled, isotonic-calibrated classifiers.
  • Evaluates Spearman rank correlation against controller response latencies with linguistic-proxy contrasts.

2. Real-User Labeling Study

A controlled study of real human participants labeling elec2 instances across induced regimes (baseline, speed-bonus, long-block):

# 1. Build the frozen task pool
pod-build-pool --out PoD_code/labeling/tasks.json

# 2. Serve the offline labeling application
cd PoD_code/labeling && python -m http.server 8000

# 3. Analyze collected participant logs
pod-realdata --in data_real/ --out out_real/

The labeling application at PoD_code/labeling/app.html is an entirely client-side, zero-dependency HTML/JS app—no analytics, no telemetry, no external network requests. Full human-subject protocol is detailed in docs/REAL_DATA_PROTOCOL.md.


📡 Live MQTT Dashboard

A lightweight, standalone dashboard in PoD_code/ provides real-time visualization of streaming PoD verification decisions over MQTT:

  1. Configure broker parameters in PoD_code/config.json.
  2. Open PoD_code/app.html directly in any modern browser.

⌨️ CLI Reference

The package provides 5 dedicated command-line utilities:

Command Purpose Key Arguments
pod-experiments Runs streaming benchmark evaluations across datasets and baselines --datasets, --runs, --out, --baseline, --gaming, --fatigue
pod-stats Aggregates per-run CSVs, performs Friedman/Nemenyi/Wilcoxon tests --in, --reference, --alpha, --n_resamples
pod-validate Executes empirical Hick-Hyman validation on ATC corpora --out, --n_seeds, --calib_splits
pod-realdata Ingests and evaluates empirical participant CSV sessions --in, --out, --alpha
pod-build-pool Generates balanced task pool for human participant studies --out, --dataset, --n_trials

🛠️ Development & Quality Assurance

Ensure full environment integrity using the automated quality toolchain:

# Install developer tooling
pip install -e ".[dev]"

# Run test suite
pytest

# Run tests with coverage report
pytest --cov=pod --cov-report=term-missing

# Linting and style verification
ruff check src tests

# Static type checking
mypy src/pod

🐳 Docker Reproducibility

A hermetic container environment mirrors requirements-lock.txt (Python 3.10, NumPy 2.2.6, scikit-learn 1.7.2):

# Build the reproducible image
docker build -t pod .

# Run test suite inside container
docker run --rm pod

# Execute benchmark reproduction
docker run --rm -v "$PWD/out_pod_unified:/work/out_pod_unified" pod \
    pod-experiments --datasets synth,elec2,gas,covertype,airlines

🧾 Artifact Evaluation

Reviewers assessing reproducibility can follow docs/ARTIFACT_EVALUATION.md, which maps every paper section, table, and figure to executable CLI targets and outlines the automated claim-consistency gate (scripts/check_claims.py).


📚 Documentation Index


📖 Citation

If you use Proof-of-Deliberation in your research, please cite both the paper and this implementation:

@article{MartinezGil2026PoD,
  author    = {Jorge Martinez-Gil},
  title     = {Proof-of-Deliberation for Certifying Human Supervision Reliability in Streaming Data Quality},
  journal   = {IEEE Transactions on Knowledge and Data Engineering},
  year      = {2026},
  publisher = {IEEE}
}

@software{MartinezGil2026PoDSoftware,
  author    = {Jorge Martinez-Gil},
  title     = {Proof-of-Deliberation (PoD): Reference Implementation},
  year      = {2026},
  version   = {1.3.0},
  url       = {https://github.com/jorge-martinez-gil/proof-of-deliberation}
}

Full citation metadata is also maintained in CITATION.cff and accessible via GitHub's "Cite this repository" feature.


📜 License

This project is licensed under the MIT License.


🙏 Acknowledgements

Organization / Resource Role / Asset
OpenML Electricity (elec2, #44156), Forest CoverType (#1596), Airlines (#1169) streams
UCI Machine Learning Repository Gas Sensor Array Drift benchmark (#224)
HuggingFace / Zuluaga-Gomez et al. atco2_corpus_1h and uwb_atcc Air Traffic Control corpora
Scientific Python Ecosystem NumPy, SciPy, pandas, scikit-learn, Matplotlib

Explore related projects

Loading…