GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com β€” GitHub - subasah/probabilistic-llm-eval-suite: Automated LLM Evaluation Suites, Benchmarking Pipelines & Continuous Statistical Regression Testing for Probabilistic Outputs

BranchesTags
Open more actions menu

Latest commit

 

History

8 Commits
8 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
benchmarks
benchmarks
 
 
docs
docs
 
 
examples
examples
 
 
src/probeval
src/probeval
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
pyproject.toml
pyproject.toml
 
 

Repository files navigation

ProbEval: Automated LLM Evaluation Suites & Continuous Regression Testing

Documentation & Live Demo Python 3.10+ License: MIT CI: LLM Regression Gate Code Style: Ruff Evaluators: Multi--Tiered

A production-grade framework for automated benchmarking, probabilistic evaluation, and continuous statistical regression testing for non-deterministic Large Language Model systems.

🌐 Documentation: https://subasah.github.io/probabilistic-llm-eval-suite/ | πŸ“Š Live Sample Report β†—


🌟 Why ProbEval?

Evaluating generative AI models is fundamentally different from evaluating classical software:

  1. Non-Determinism & Sampling Jitter: Even at temperature=0, floating-point arithmetic across GPU tensor cores, dynamic batching, and mixture-of-experts (MoE) token routing cause output variance. A single-shot assertion (assert response == expected) is statistically meaningless.
  2. The "Silent Regression" Crisis: An engineer tweaks a system prompt or model checkpoint to fix an edge case, inadvertently degrading structured JSON compliance or safety guardrails by 8% across existing workloads.
  3. Flaky Evaluations vs. Real Degradation: Without statistical hypothesis testing, teams cannot differentiate between expected random sampling noise and statistically significant regressions, leading to noisy CI pipelines or degraded production deployments.
  4. Judge Cognitive Biases: LLM-as-a-judge evaluators suffer from severe Position Bias (favoring Option A by 10–20%), Length Bias (favoring verbosity), and Self-Enhancement Bias.

ProbEval provides the mathematical foundation, execution pipeline, and CI/CD quality gates required to reliably deploy generative AI systems into production.


πŸ—οΈ System Architecture

flowchart TD
    subgraph Ingestion ["1. Benchmark Ingestion"]
        TC[Standardized Benchmark Datasets]
        D1[(Structured Extraction)]
        D2[(RAG Faithfulness)]
        D3[(Tool Calling Specs)]
        D4[(Code & Reasoning)]
        D1 & D2 & D3 & D4 --> TC
    end

    subgraph Runner ["2. Stochastic Execution Engine"]
        TC --> Engine[Async Parallel Runner]
        Engine -->|Repeated Sampling n=5| Samples[Probabilistic Output Distributions]
        Model[LLM Provider / Realistic Simulator] <--> Samples
    end

    subgraph Matrix ["3. Multi-Tiered Evaluator Matrix"]
        Samples --> MatrixRouter{Evaluation Tier}
        MatrixRouter --> Tier1[Deterministic Tier<br/>β€’ JSON Schema<br/>β€’ Regex Match<br/>β€’ Tool Call Verification<br/>β€’ Latency SLAs]
        MatrixRouter --> Tier2[Semantic Tier<br/>β€’ Token F1 SQuAD<br/>β€’ N-gram Cosine Similarity<br/>β€’ Normalized Exact Match]
        MatrixRouter --> Tier3[RAG Triad Tier<br/>β€’ Context Faithfulness<br/>β€’ Answer Relevance]
        MatrixRouter --> Tier4[Calibrated Judge Tier<br/>β€’ Anchored Rubrics<br/>β€’ Bidirectional Swapped Pairwise]
    end

    subgraph Stats ["4. Statistical Inference Engine"]
        Tier1 & Tier2 & Tier3 & Tier4 --> StatEngine[Statistical Inference Core]
        StatEngine --> Boot[Bootstrap 95% Confidence Intervals]
        StatEngine --> PassK[Chen et al. Unbiased Pass@k]
        StatEngine --> McNemar[McNemar Paired Test on Discordant Cases]
        StatEngine --> Welch[Welch t-test on Continuous Metrics]
    end

    subgraph Gate ["5. Continuous Regression Gating & Delivery"]
        StatEngine --> RegGate[Continuous Regression Gatekeeper]
        Base[(Golden Baseline Run)] -.-> RegGate
        RegGate -->|Ξ” < -3% and p < 0.05| Fail[🚨 Quality Gate FAILED: Block Merge]
        RegGate -->|Variation within Noise Floor| Pass[βœ… Quality Gate PASSED]
        RegGate --> Artifacts[Terminal Tables, Markdown PR Comment & HTML Dashboard]
    end
Loading

πŸ”¬ Mathematical & Statistical Foundations

ProbEval replaces naive assertions with formal statistical hypothesis testing:

1. Non-Parametric Bootstrap Resampling (95% Confidence Intervals)

Standard Gaussian assumptions ($\mu \pm 1.96 \frac{\sigma}{\sqrt{N}}$) fail for bounded $[0, 1]$ evaluation metrics. ProbEval draws $B = 1,500$ replicates with replacement from the empirical data distribution: $$\text{CI}{\text{lower}} = \hat{\theta}^{*\left(\left\lfloor \frac{\alpha}{2} B \right\rfloor\right)}, \quad \text{CI}{\text{upper}} = \hat{\theta}^{*\left(\left\lceil \left(1 - \frac{\alpha}{2}\right) B \right\rceil\right)}$$

2. Unbiased Pass@k Estimation (Chen et al. 2021)

Evaluates generative multi-sample yield across $n$ samples with budget $k$: $$\text{pass@}k = 1 - \prod_{i=1}^k \frac{n - c - i + 1}{n - i + 1}$$ where $n$ is total samples and $c$ is passing samples.

3. McNemar's Paired Test for Categorical Regressions

When comparing candidate prompts against a golden baseline on identical test cases, independent tests lose statistical power. ProbEval isolates discordant pairs (regressions $b$ vs improvements $c$): $$\chi^2 = \frac{(|b - c| - 1)^2}{b + c}$$ (Uses exact two-sided binomial testing when $b + c < 25$).

4. LLM Judge Position Bias Mitigation

Pairs are evaluated across bidirectional swaps:

  • Trial 1: Option A = Candidate, Option B = Baseline
  • Trial 2: Option A = Baseline, Option B = Candidate
  • Candidate is declared winner only if it defeats baseline in both orientations. If Option A is picked in both trials, position bias is flagged and discounted.

⚑ Quickstart

1. Installation

Clone the repository and install dependencies in editable mode:

git clone https://github.com/subasah/probabilistic-llm-eval-suite.git
cd probabilistic-llm-eval-suite
pip install -e ".[dev]"

2. Run the Interactive Scenarios

ProbEval includes zero-cost, reproducible scenarios powered by its built-in realistic LLM simulator (or live OpenAI/Anthropic/Gemini APIs):

# Scenario 1: Detect subtle prompt regressions using McNemar's test
make demo
# or: python examples/01_prompt_regression_test.py

# Scenario 2: Benchmark legacy enterprise model vs high-speed candidate model
make migration
# or: python examples/02_model_migration_benchmark.py

# Scenario 3: Measure Pass@k across sampling temperatures (0.0 vs 0.4 vs 0.8)
make passk
# or: python examples/03_probabilistic_pass_at_k.py

# Scenario 4: Mitigate LLM judge position bias with bidirectional swapping
make bias
# or: python examples/04_llm_judge_bias_mitigation.py

3. Run Unit & Statistical Tests

make test
# or: pytest -v tests/

πŸ–₯️ Command-Line Interface (CLI)

ProbEval includes a rich CLI for automated testing and CI/CD pipelines:

Run an Evaluation Benchmark

probeval run --benchmark structured_extraction --samples 5 --temperature 0.2

Outputs Rich terminal tables and compiles an interactive HTML dashboard at reports/eval_report.html.

Compare Candidate vs. Golden Baseline

probeval compare \
  --benchmark structured_extraction \
  --regression-factor 0.12 \
  --samples 6 \
  --html reports/regression_report.html

πŸ“Š Interactive HTML Dashboard

πŸ”— Explore Live Sample Report β†—

Every evaluation run compiles into a standalone, interactive HTML dashboard featuring:

  • Glassmorphism dark-mode UI with Tailwind CSS
  • KPI Metric Cards with Bootstrap 95% Confidence Interval error bands
  • Pass@1, Pass@3, and Pass@k yield metrics
  • Continuous Regression Gate table with p-values and significance verdicts
  • Interactive Test Case Explorer: Click any prompt to inspect raw completions, latencies, and evaluator scores across all probabilistic trials.

(Saved automatically to reports/eval_report.html or viewable offline).


πŸ”„ CI/CD Regression Gate Integration

ProbEval is configured for continuous integration via GitHub Actions (.github/workflows/llm_eval_regression.yml):

- name: Run Continuous Regression Quality Gate
  run: |
    python -m probeval.cli compare \
      --benchmark structured_extraction \
      --regression-factor 0.05 \
      --samples 6 \
      --html reports/ci_regression_report.html

Automated PR Markdown Reporting

When a pull request triggers the regression gate, ProbEval generates a structured markdown summary:

Metric Baseline Candidate Delta (Ξ”) p-value Significant? Status
overall_pass_rate 0.960 0.800 -0.160 (-16.7%) 0.0082 YES πŸ”΄ FAIL
json_schema_valid 0.980 0.820 -0.160 (-16.3%) 0.0041 YES πŸ”΄ FAIL
latency_sla 0.973 0.973 +0.000 (+0.0%) 0.8500 No (noise) 🟒 PASS

πŸ“š Academic & Research Foundations

ProbEval's architectural design, statistical algorithms, and bias mitigation protocols adhere to and directly infer from foundational research papers in natural language processing, LLM benchmarking, and statistical inference:

1. Evaluating Large Language Models Trained on Code

  • Paper: Evaluating Large Language Models Trained on Code (Chen et al., OpenAI 2021) β€” arXiv:2107.03374
  • Description: Introduced the HumanEval benchmark and derived the mathematically unbiased closed-form estimator for the $\text{pass@}k$ metric across $n$ samples ($n \ge k$) with $c$ passing trials: $$\text{pass@}k = \mathbb{E}\left[1 - \frac{\binom{n-c}{k}}{\binom{n}{k}}\right]$$ This formulation eliminates the severe sampling variance and systematic underestimation caused by naive sampling evaluations.
  • How It Inspired & Relevant to ProbEval: Implemented directly in src/probeval/statistics/pass_at_k.py. Rather than running fragile single-shot assertions that miss intermittent probabilistic failures, ProbEval executes $n$ stochastic generations per test case and calculates closed-form unbiased Pass@1, Pass@k, and exact combinatorial sample variances.

2. Judging LLM-as-a-Judge with MT-Bench and Chatbot Arena

  • Paper: Judging LLM-as-a-Judge with MT-Bench and Chatbot Arena (Zheng et al., LMSYS Org / UC Berkeley, NeurIPS 2023) β€” arXiv:2306.05685
  • Description: Quantified and formalized systemic cognitive biases when using large language models as autonomous evaluatorsβ€”most prominently Position Bias (models favor candidate A over candidate B by up to 70% regardless of quality), Verbosity Bias (favoring long answers), and Self-Enhancement Bias.
  • How It Inspired & Relevant to ProbEval: Implemented in src/probeval/evaluators/llm_judge.py (PairwiseJudge). ProbEval mandates a symmetric bidirectional position swap: presenting (Candidate, Baseline) and then (Baseline, Candidate). A candidate is awarded a win only if it succeeds across both permutations. Inconsistent judgements are identified as position bias and normalized to a calibrated tie.

3. A Hitchhiker’s Guide to Statistical Significance in Natural Language Processing

  • Paper: A Hitchhiker’s Guide to Statistical Significance in Natural Language Processing (Dror et al., ACL 2018) β€” ACL Anthology P18-1139
  • Description: Demonstrated that naive aggregate metric comparisons (such as raw accuracy point deltas) result in rampant Type I (false positives) and Type II (false negatives) errors in NLP benchmarks. Formalized paired non-parametric significance testing as the gold standard for evaluating paired NLP model outputs.
  • How It Inspired & Relevant to ProbEval: Implemented in src/probeval/statistics/hypothesis_tests.py and enforced in src/probeval/statistics/regression_gate.py. When comparing a candidate against a golden baseline on identical test cases, ProbEval constructs a $2 \times 2$ contingency matrix of discordant pairs (Passed β†’ Failed vs. Failed β†’ Passed) and calculates McNemar's paired test with continuity correction (or exact binomial tests for small samples) before failing CI/CD builds.

4. An Empirical Investigation of Statistical Significance in NLP

  • Paper: An Empirical Investigation of Statistical Significance in NLP (Berg-Kirkpatrick, Burkett, and Klein, EMNLP 2012) β€” ACL Anthology D12-1091
  • Description: Investigated significance testing and non-parametric bootstrap resampling across NLP evaluation tasks, demonstrating that empirical bootstrap resampling ($B \ge 1,000$) provides faithful confidence intervals without making unrealistic Gaussian normality assumptions on bounded metrics.
  • How It Inspired & Relevant to ProbEval: Implemented in src/probeval/statistics/bootstrap.py. Every aggregated metric reported by ProbEval (Pass Rate, SQuAD F1, Faithfulness, Latency) includes empirical 95% bootstrap confidence intervals computed over $B=1,500$ Monte Carlo replicates, enabling developers to differentiate between true performance improvements and sampling noise.

5. RAGAS: Automated Evaluation of Retrieval Augmented Generation

  • Paper: RAGAS: Automated Evaluation of Retrieval Augmented Generation (Es et al., EACL 2024) β€” arXiv:2305.14283
  • Description: Introduced a reference-free framework for assessing Retrieval-Augmented Generation (RAG) pipelines by breaking generated text into atomic factual claims and evaluating Context Faithfulness (hallucination detection) and Answer Relevance without requiring ground truth references.
  • How It Inspired & Relevant to ProbEval: Inferred in src/probeval/evaluators/rag_triad.py. ProbEval performs sentence-level atomic claim decomposition and context overlap verification as an ultra-fast Tier 3 screening step (<10ms, $0 cost) to catch ungrounded statements and hallucinations before escalating to expensive LLM-as-a-judge evaluators.

6. How Is ChatGPT's Behavior Changing Over Time?

  • Paper: How Is ChatGPT's Behavior Changing over Time? (Chen, Zaharia, and Zou, Stanford & UC Berkeley, 2023) β€” arXiv:2307.09009
  • Description: Documented significant longitudinal drift, unexpected capability regressions, and formatting shifts in production foundation model APIs over monthly vendor updates across reasoning, code synthesis, and safety guardrails.
  • How It Inspired & Relevant to ProbEval: Formed the foundational motivation for ProbEval's continuous regression testing architecture in src/probeval/statistics/regression_gate.py and GitHub Actions workflow. Demonstrates that LLM APIs must be continuously guarded by frozen golden baselines and automated statistical gates in CI/CD, treating model checkpoints as dynamic, shifting dependencies.

πŸ“– Deep-Dive Documentation

Explore comprehensive guides in the docs/ directory:

  • πŸ›οΈ System Architecture & Technical Design - Component lifecycle and multi-tiered evaluation flow.
  • πŸ“ Statistical Foundations & Mathematics - Bootstrap resampling, Pass@k derivation, Wilson intervals, and McNemar testing.
  • βš–οΈ LLM-as-a-Judge Calibration & Bias Mitigation - Eliminating position, length, and self-enhancement biases.
  • πŸ›‘οΈ Continuous Regression Testing in CI/CD - Quality gates, golden baselines, and production triage.

🀝 Project Structure

probabilistic-llm-eval-suite/
β”œβ”€β”€ .github/workflows/
β”‚   β”œβ”€β”€ llm_eval_regression.yml    # CI workflow for regression gating
β”‚   └── test_suite.yml             # Matrix test suite across Python versions
β”œβ”€β”€ benchmarks/                    # Benchmark datasets (JSONL)
β”‚   β”œβ”€β”€ structured_extraction.jsonl
β”‚   β”œβ”€β”€ rag_faithfulness.jsonl
β”‚   β”œβ”€β”€ code_and_reasoning.jsonl
β”‚   └── tool_calling.jsonl
β”œβ”€β”€ docs/                          # Architecture and technical guides
β”‚   β”œβ”€β”€ index.html                 # Documentation site
β”‚   β”œβ”€β”€ ARCHITECTURE.md
β”‚   β”œβ”€β”€ STATISTICAL_FOUNDATIONS.md
β”‚   β”œβ”€β”€ LLM_AS_A_JUDGE_CALIBRATION.md
β”‚   └── CONTINUOUS_REGRESSION_TESTING.md
β”œβ”€β”€ examples/                      # Runnable production scenarios
β”‚   β”œβ”€β”€ 01_prompt_regression_test.py
β”‚   β”œβ”€β”€ 02_model_migration_benchmark.py
β”‚   β”œβ”€β”€ 03_probabilistic_pass_at_k.py
β”‚   └── 04_llm_judge_bias_mitigation.py
β”œβ”€β”€ src/probeval/                  # Core package
β”‚   β”œβ”€β”€ cli.py                     # Typer CLI application
β”‚   β”œβ”€β”€ config.py                  # Pydantic schemas & data models
β”‚   β”œβ”€β”€ models/                    # Model providers & simulator
β”‚   β”œβ”€β”€ evaluators/                # Deterministic, semantic, and judge evaluators
β”‚   β”œβ”€β”€ statistics/                # Bootstrap, Pass@k, McNemar, regression gate
β”‚   β”œβ”€β”€ runner/                    # Async parallel execution engine
β”‚   └── reporting/                 # Console, HTML, and GitHub PR reporters
β”œβ”€β”€ tests/                         # Pytest test suite (15 unit tests)
β”œβ”€β”€ Makefile                       # Developer command shortcuts
β”œβ”€β”€ pyproject.toml                 # Modern package configuration
└── LICENSE                        # MIT License

πŸ‘€ Author & Contact

Subasa
GitHub: @subasah
Repository: probabilistic-llm-eval-suite


πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Automated LLM Evaluation Suites, Benchmarking Pipelines & Continuous Statistical Regression Testing for Probabilistic Outputs

subasah.github.io/probabilistic-llm-eval-suite/

Topics

ai-engineeringbenchmarkingbootstrap-resamplingllm-as-a-judgellm-evaluationllmopsmcnemar-testpass-at-krag-evaluationregression-testing

Resources

Readme
MIT license
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 β€” GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800Γ—600. No cookies required.