Skip to content

docs(research): introduce research & validation layer for TrustLens - #113

Merged
Khanz9664 merged 2 commits into
mainfrom
docs/research-validation-layer
May 30, 2026
Merged

Khanz9664 merged 2 commits into
mainfrom
docs/research-validation-layer

Conversation

@Khanz9664

@Khanz9664 Khanz9664 commented May 30, 2026 •

Copy link
Copy Markdown
Owner

Summary

This PR introduces a comprehensive Research & Validation documentation layer for TrustLens, transforming the benchmark and demo assets into a scientifically grounded, research-grade documentation experience.

The goal is to make TrustLens more transparent, reproducible, and evidence-driven by documenting:

  • how TrustLens behaves under distribution shift and corruption
  • how trust metrics interact and degrade
  • when TrustLens works well
  • where its assumptions and limitations exist
  • why TrustLens evaluates more than traditional metrics like accuracy or ROC-AUC

This work treats the benchmark notebook as the scientific source of truth, with all claims grounded in reproducible benchmark evidence.

What’s Included

Research Documentation

Added a new docs/research/ section with seven research-focused pages:

  • benchmark_results.md — structured analysis of benchmark findings
  • methodology.md — experimental setup, reproducibility, and threats to validity
  • trust_score_validation.md — scientific interpretation of the Trust Score
  • distribution_shift.md — degradation behavior under corruption and drift
  • metric_limitations.md — transparent disclosure of assumptions and weaknesses
  • failure_modes.md — scenarios where TrustLens may be misled
  • why_trustlens.md — explains why trust assessment requires more than accuracy

Publication-Quality Visuals

Generated high-resolution (300 DPI) research figures in:

docs/assets/research/

Visuals were generated using the centralized TrustLens styling system (trustlens.visualization.style) to maintain consistency with the rest of the framework.

Each visualization follows a scientific interpretation structure:

  • Question Answered
  • Why It Matters
  • Interpretation
  • Limitation

to improve rigor and readability.

Scientific Rigor Improvements

This PR intentionally prioritizes academic precision and transparency:

  • Removed overclaiming language ("ensures", "guarantees", "prevents")

  • Replaced with evidence-based scientific phrasing

  • Added a brutally honest Threats to Validity section covering:

    • synthetic dataset assumptions
    • binary-classification focus
    • ECE instability
    • calibration dependency
    • trust score weighting assumptions
    • benchmark ≠ deployment guarantee

Documentation Navigation

Updated docs/index.md and the documentation navigation to surface the new:

Research & Validation

section in the docs site.

Source of Truth

Evidence priority for scientific claims:

  1. trustlens_model_zoo_benchmark.ipynb (primary source)
  2. trustlens_demo.ipynb (supplementary examples)
  3. demo.py (illustrative visual examples only)

Why This Matters

TrustLens now moves beyond simply exposing trustworthiness metrics and begins to scientifically justify and contextualize them.

Instead of asking users to trust the framework, this documentation is designed to help users evaluate:

  • when TrustLens provides meaningful signals
  • how metrics interact under degradation
  • what assumptions exist
  • where caution is required

This strengthens:

  • scientific credibility
  • contributor confidence
  • documentation quality
  • research reproducibility
  • long-term maintainability

Verification

  • Built and reviewed documentation pages locally
  • Verified navigation updates
  • Validated image rendering and markdown formatting
  • Confirmed evidence traceability across research pages
  • Ensured research claims align with benchmark outputs

Summary by CodeRabbit

Release Notes

  • Documentation

    • Added comprehensive Research & Validation documentation layer covering methodology, benchmark results, and failure modes analysis.
    • New pages explain trust score validation framework, metric limitations, distribution shift robustness, and product rationale.
    • Updated documentation index with research section navigation links.
    • Added runnable example snippet to API docstrings.
  • Chores

    • Updated configuration files and contributor list.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 30, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@Khanz9664, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 56 minutes and 25 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7c5cfa56-bf79-4b61-82bf-eaad4da96c85

📥 Commits

Reviewing files that changed from the base of the PR and between 18b3832 and 956979f.

📒 Files selected for processing (5)
  • docs/research/distribution_shift.md
  • docs/research/failure_modes.md
  • docs/research/methodology.md
  • docs/research/metric_limitations.md
  • docs/research/trust_score_validation.md
📝 Walkthrough

Walkthrough

This PR adds a comprehensive Research & Validation documentation layer to TrustLens. New research pages document the methodology, benchmark results, failure modes, and metric limitations. The documentation section is integrated into the project navigation and changelog.

Changes

Research & Validation Documentation

Layer / File(s) Summary
Documentation navigation and metadata setup
.gitignore, CHANGELOG.md, README.md, docs/index.md
.gitignore adds PNG ignore rule for docs/assets/research/. CHANGELOG.md documents the new Research & Validation layer and analyze() example. README.md updates Documentation heading and adds contributor. docs/index.md introduces Research & Validation section and updates Sphinx toctree for navigation.
Foundational framework and validation documents
docs/research/why_trustlens.md, docs/research/methodology.md, docs/research/trust_score_validation.md
why_trustlens.md positions TrustLens as a deployment safety metric against traditional accuracy-based gates. methodology.md establishes the experimental setup (four model families, three seeds) and enumerates eight threats to validity. trust_score_validation.md explains the penalty-based aggregation of weighted sub-scores (Calibration, Failure, Bias, Representation).
Empirical validation, results, and known constraints
docs/research/benchmark_results.md, docs/research/distribution_shift.md, docs/research/metric_limitations.md, docs/research/failure_modes.md
benchmark_results.md reports Trust Score behavior under label noise and subgroup imbalance with scientific limitations noted. distribution_shift.md describes evaluation of robustness under subgroup and class imbalance shift vectors. metric_limitations.md documents ECE binning sensitivity, confidence gap assumptions, bias score dependencies, and silhouette representation constraints. failure_modes.md catalogs three failure modes: blind spot (unspecified sensitive attributes), artificially confident (hard labels), and representation paradox (LLM embeddings).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A warren of research, now bound with great care,
Pages that validate, with limits laid bare,
Benchmarks and failure modes, methodology's might,
Trust scores aggregate the picture just right,
Where safety and science meet edge case insight!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: introducing a research & validation documentation layer for TrustLens, which aligns perfectly with the changeset's focus on adding research documentation pages and validation frameworks.
Description check ✅ Passed The PR description follows the template structure with all required sections completed: Summary, Type of Change, Changes Made, Verification, and Notes for Reviewers are all present with comprehensive details.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/research-validation-layer

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (3)
docs/research/why_trustlens.md (2)

8-8: ⚡ Quick win

Standardize benchmark artifact path for traceability consistency.

This page references trustlens_model_zoo_benchmark.ipynb, while other research pages use examples/trustlens_model_zoo_benchmark.ipynb. Use one canonical path everywhere to avoid ambiguity during evidence audits.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/research/why_trustlens.md` at line 8, The document references the
benchmark notebook using a non-canonical path; update the reference in
why_trustlens.md to use the canonical path
"examples/trustlens_model_zoo_benchmark.ipynb" so it matches other research
pages, and scan for other occurrences of "trustlens_model_zoo_benchmark.ipynb"
to replace any stray non-canonical paths; specifically edit the line containing
the phrase "trustlens_model_zoo_benchmark.ipynb" in why_trustlens.md (and any
other docs that differ) to the unified
"examples/trustlens_model_zoo_benchmark.ipynb".

46-48: ⚡ Quick win

Soften deterministic deployment language to stay evidence-aligned.

Phrases like “you will deploy” and “resulting in” read as absolute outcomes. Recommend probabilistic wording (“may”, “can”, “is likely to”) to keep the claims scientifically scoped.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/research/why_trustlens.md` around lines 46 - 48, Replace deterministic
phrasing in the two sentences to probabilistic language: change "you will deploy
Model A, resulting in silent failures and demographic bias in production." to
something like "you may deploy Model A, which can contribute to silent failures
and demographic bias in production." and change "Model A receives a failing
verdict, providing the engineering team with diagnostic signals to address the
underlying data imbalance before release." to "Model A may receive a failing
verdict, providing the engineering team with diagnostic signals to address the
underlying data imbalance before release." Use modal verbs ("may", "can", "is
likely to") and phrasing ("which can contribute to", "may receive") to soften
certainty while preserving the original contrast between Accuracy/ROC-AUC and
TrustLens.
docs/research/trust_score_validation.md (1)

6-6: ⚡ Quick win

Use the same benchmark path format as the rest of research docs.

For consistency and auditability, align this reference with the canonical artifact path used elsewhere (e.g., examples/trustlens_model_zoo_benchmark.ipynb).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/research/trust_score_validation.md` at line 6, Update the artifact
reference in docs/research/trust_score_validation.md so the inline notebook path
uses the canonical examples path: replace the mention of
"trustlens_model_zoo_benchmark.ipynb" with
"examples/trustlens_model_zoo_benchmark.ipynb" (keep surrounding sentence text
unchanged) to match other research docs and ensure consistent auditability.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@README.md`:
- Line 273: The contributor avatar <img> tag is missing an alt attribute which
triggers MD045; update the <img> element shown (<img
src="https://github.com/q404365631.png" width="36" style="border-radius:50%" />)
to include a meaningful alt value (e.g. alt="Contributor q404365631 avatar" or
similar descriptive text) so the image is accessible to screen readers.

---

Nitpick comments:
In `@docs/research/trust_score_validation.md`:
- Line 6: Update the artifact reference in
docs/research/trust_score_validation.md so the inline notebook path uses the
canonical examples path: replace the mention of
"trustlens_model_zoo_benchmark.ipynb" with
"examples/trustlens_model_zoo_benchmark.ipynb" (keep surrounding sentence text
unchanged) to match other research docs and ensure consistent auditability.

In `@docs/research/why_trustlens.md`:
- Line 8: The document references the benchmark notebook using a non-canonical
path; update the reference in why_trustlens.md to use the canonical path
"examples/trustlens_model_zoo_benchmark.ipynb" so it matches other research
pages, and scan for other occurrences of "trustlens_model_zoo_benchmark.ipynb"
to replace any stray non-canonical paths; specifically edit the line containing
the phrase "trustlens_model_zoo_benchmark.ipynb" in why_trustlens.md (and any
other docs that differ) to the unified
"examples/trustlens_model_zoo_benchmark.ipynb".
- Around line 46-48: Replace deterministic phrasing in the two sentences to
probabilistic language: change "you will deploy Model A, resulting in silent
failures and demographic bias in production." to something like "you may deploy
Model A, which can contribute to silent failures and demographic bias in
production." and change "Model A receives a failing verdict, providing the
engineering team with diagnostic signals to address the underlying data
imbalance before release." to "Model A may receive a failing verdict, providing
the engineering team with diagnostic signals to address the underlying data
imbalance before release." Use modal verbs ("may", "can", "is likely to") and
phrasing ("which can contribute to", "may receive") to soften certainty while
preserving the original contrast between Accuracy/ROC-AUC and TrustLens.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b796c9e1-a6ef-4e4d-869c-19e342db08d3

📥 Commits

Reviewing files that changed from the base of the PR and between af141d4 and 18b3832.

⛔ Files ignored due to path filters (6)
  • docs/assets/research/accuracy_vs_trust_scatter.png is excluded by !**/*.png
  • docs/assets/research/calibration_noise_curve.png is excluded by !**/*.png
  • docs/assets/research/confidence_gap_behavior.png is excluded by !**/*.png
  • docs/assets/research/fairness_gap_shift.png is excluded by !**/*.png
  • docs/assets/research/representation_quality_comparison.png is excluded by !**/*.png
  • docs/assets/research/trust_score_degradation.png is excluded by !**/*.png
📒 Files selected for processing (11)
  • .gitignore
  • CHANGELOG.md
  • README.md
  • docs/index.md
  • docs/research/benchmark_results.md
  • docs/research/distribution_shift.md
  • docs/research/failure_modes.md
  • docs/research/methodology.md
  • docs/research/metric_limitations.md
  • docs/research/trust_score_validation.md
  • docs/research/why_trustlens.md

Comment thread README.md

@llamapreview llamapreview Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Code Review by LlamaPReview

🎯 TL;DR & Recommendation

Recommendation: Approve with suggestions.

This PR adds a comprehensive research documentation layer for TrustLens, enhancing scientific rigor with empirical evidence and transparent limitations. However, two minor issues should be addressed: a missing navigation update in mkdocs.yml and a lack of automated validation linking documentation claims to the benchmark notebook.

📄 Documentation Diagram

This diagram illustrates how the benchmark notebook feeds into the new research documentation pages and how users access them.

sequenceDiagram
    participant B as Benchmark Notebook
    participant R as Research Docs
    participant U as User
    B->>R: Generate empirical evidence (figures, claims)
    note over R: PR #35;113: 7 new research pages
    U->>R: Read docs via index.md or sidebar (if mkdocs.yml updated)
    note over U: User gains scientific context and limitations
Loading

🌟 Strengths

  • Thorough scientific methodology and transparent disclosure of limitations.
  • High-quality publication-ready visuals with consistent styling.

💡 Suggestions

  • docs/index.md: The new research section is missing from mkdocs.yml navigation, which will prevent the pages from appearing in the sidebar. Add the corresponding nav entry.
  • docs/research/benchmark_results.md: Claims of evidence traceability rely on an external notebook not validated by CI; consider adding a version pin or a notebook execution check to prevent drift.

💡 Have feedback? We'd love to hear it in our GitHub Discussions.
✨ This review was generated by LlamaPReview Advanced, which is free for all open-source projects. Learn more.

Comment thread docs/index.md
Comment thread docs/research/benchmark_results.md
@Khanz9664
Khanz9664 merged commit 78e37d8 into main May 30, 2026
11 checks passed
@Khanz9664
Khanz9664 deleted the docs/research-validation-layer branch May 30, 2026 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant