Models that classify markets into states like "calm" or "crisis" can produce different labels depending on which features you feed them, and your current validation doesn't catch this.
mrv-lib fixes this.
Built for SR 11-7 / Basel IV (FRTB) Model Risk Governance
mrv-lib (also known as the MRV Library) is an open-source Python library for model risk validation (MRV) in quantitative finance. It tests whether regime-classification models — such as GMM and HMM — produce stable labels when you change the input features, data frequency, or number of states. If you are looking for an MRV lib that automates SR 11-7 / Basel IV (FRTB) model stability checks, mrv-lib is designed for exactly that.
Most classification models (GMM, HMM) are validated on in-sample fit metrics (BIC, log-likelihood).
Nobody asks:
Do the labels survive a change in input representation?
GMM, HMM, or any clustering method on volatility, drawdown, VaR, CVaR, and other risk factors to identify market states.
"Low risk", "Medium risk", "Crisis" — neat categories that drive risk limits, capital allocation, and hedging decisions.
Replace max drawdown with realized skewness, and the labels change. Same data, same model, different answers.
If downstream decisions depend on model labels, but the labels depend on an arbitrary feature choice, then your decisions are not well-founded. SR 11-7 requires you to document this.
Fit the same model on multiple factor sets, then measure pairwise label agreement.
Adjusted Rand Index (ARI) ≥ 0.65
Are the labels the same?
Spearman rank correlation ≥ 0.85
Do they at least rank risk consistently?
A model that fails partition but passes ordering means: exact label boundaries shift, but relative risk ranking is preserved. Less severe, but still a material finding for SR 11-7 documentation.
Drag the timeline to explore model stability across 20 years and 9 asset classes.
Everything you need to validate model stability.
Volatility, drawdown, max drawdown, VaR, CVaR, realized skewness, stability (vol-of-vol). Extensible registry.
Gaussian Mixture and Hidden Markov built-in. Plug in your own via register_model().
ARI, AMI, NMI, Variation of Information, and Spearman ordering consistency.
JSON → LaTeX → PDF. Professional reports with dashboards, heatmaps, and remediation plan.
Single YAML config. 6-step modular pipeline: download → load → factors → fit → validate → report.
Download 5m/15m/1h/1d bars from Interactive Brokers. Incremental updates, multi-asset.
Three commands to your first representation invariance report. Or use the Python API for full control. No IB account? Use the example notebook with synthetic data.
# Install
pip install mrv-lib[all]
# Download data (requires IB Gateway)
python run.py download config.yaml
# Run representation invariance test + PDF report
python run.py run config.yaml rep
# Regenerate PDF from existing results
python run.py report
from mrv.pipeline import run, download
download("config.yaml") # fetch data from IB
run("config.yaml", "rep") # validate + PDF report
# Or step by step (full control)
from mrv.pipeline import load_data, compute_factors
from mrv.pipeline import fit_labels, validate, report
from mrv.utils.config import load
cfg = load("config.yaml")
prices = load_data(cfg, "rep")
factors = compute_factors(prices, cfg, factor_sets)
labels = fit_labels(factors, model="gmm")
result = validate(cfg, "rep", labels=labels)
report(result["json_path"], cfg=cfg)
Each release corresponds to a research paper. The library grows with the research.
Do model labels change when you use different risk factors?
Zheng, Low & Wang (2026). Regime Labels Are Not Representation-Invariant: Implications for Model Risk Governance. FRL under review. DOI
Do labels agree across 5m / 1h / 1d frequencies?
Zheng, Low & Wang (2026). Regime Labels Are Not Resolution-Invariant: Evidence from the 2026 US–Iran Escalation. FRL under review. DOI
A single score quantifying how stable model labels are across perturbations. Live dashboard above.
Zheng, Low & Wang (2026). The Model Risk Index: Quantifying Inference Collapse and Ordinal Invariance across Representations and Resolutions. In preparation.
mrv-lib is built on PhD research from Massey University and Bond University.
Zheng, K., Low, R. & Wang, R. (2026)
FRL Under Review DOI: 10.2139/ssrn.6460809Zheng, K., Low, R. & Wang, R. (2026)
FRL Under Review DOI: 10.2139/ssrn.6531002Zheng, K., Low, R. & Wang, R. (2026)
In progressKai Zheng — Tech Lead, Datacom · PhD candidate, Massey University
A/Prof. Rand Low — Bond Business School, Bond University
Prof. Ruili Wang — School of Mathematical and Computational Sciences, Massey University
mrv-lib is an open-source Python library for model risk validation (MRV). It tests whether regime-classification labels produced by models like GMM and HMM are stable across different feature representations, data resolutions, and perturbations. It is built for SR 11-7 and Basel IV (FRTB) governance workflows.
Install from PyPI with pip install mrv-lib. For the full feature set including PDF report generation and IB Gateway integration, use pip install mrv-lib[all].
MRV stands for Model Risk Validation. The mrv-lib library (or MRV library) provides automated tools to validate model stability, specifically whether regime labels survive changes in feature choice, data frequency, and model configuration.
The Model Risk Index is a single composite score (0–100) produced by mrv-lib that quantifies how stable a model's regime labels are. It combines representation stability, resolution stability, and ordinal robustness into one number. An MRI above 80 means labels are stable; below 60 signals a breach.
Yes. mrv-lib is released under the MIT License and is completely free and open-source. The source code is hosted on GitHub under the ModelGuard Lab organisation.