blackjax.adaptation.meta.builders#
Core builders for the meta-adaptation controller.
This file is the primary entry point for understanding the controller decision
logic. Read _calibration for the calibration
surface (all thresholds and swappable gate functions).
Functions#
build_meta_adaptation_core() — single-chain MetricCore builder.
build_multi_chain_meta_core() — multi-chain MetricCore builder.
Functions#
Build the meta-adaptation |
|
Build the multi-chain meta-adaptation |
Module Contents#
- build_meta_adaptation_core(max_grad_budget: int, *, max_rank: int | None = None, gamma: float = 1e-05, cutoff: float = 2.0, telemetry: bool = False, full_matrices: bool = False) blackjax.adaptation.metric_recipes.MetricCore[source]#
Build the meta-adaptation
MetricCore.- Parameters:
max_grad_budget – Maximum total gradient budget (leapfrog evaluations). Converted to warmup steps via
_ASSUMED_AVG_LEAPFROGS_PER_STEPat Python time.max_rank – Maximum low-rank rank;
Noneuses_MAX_RANK_CAP.gamma – Fisher-estimator parameters; defaults match
fisher_low_rankrecipe.cutoff – Fisher-estimator parameters; defaults match
fisher_low_rankrecipe.telemetry –
When
Truethe core carries aMetricPublicationRecorddescribing each window-boundary publication, and its state type isMetaAdaptationTelemetryCoreStateinstead ofMetaAdaptationCoreState.This is pure observation: no threshold, gate, ordering or published metric changes.
telemetry=False(the default) is a Python-time constant, so no record is built and nothing extra is traced – the default path keeps the original state type, treedef and arithmetic.The record’s four epsilon fields are left NaN by the core, which cannot see the step-size state; the
staged_adaptationhost fills them in. Callingfinal()directly therefore yields NaN epsilons by design.full_matrices – When
True(andtelemetry=True) the record also carries the full candidate and deployedLowRankInverseMassMatrixfactors. These areO(d*k)per record and per step; off by default.
- Returns:
Embeddable init/update/final bundle.
- Return type:
- build_multi_chain_meta_core(max_grad_budget: int, n_chains: int = _MULTI_CHAIN_DEFAULT_N_CHAINS, *, max_rank: int | None = None, gamma: float = 1e-05, cutoff: float = 2.0, telemetry: bool = False, full_matrices: bool = False) blackjax.adaptation.metric_recipes.MetricCore[source]#
Build the multi-chain meta-adaptation
MetricCore.Runs M independent chains sharing one adapted metric; the escalation decision uses pooled M-chain information instead of a single-chain stability check. The pooled between-chain signal makes the escalation decision robust to seed variation for near-edge posterior structures.
The multi-chain gate (replaces the single-chain S_gap-stability check). Five conditions must all hold to escalate:
Magnitude. Top eigenvalue of the between-chain T matrix exceeds the detection edge
(1 + √(d/(M−1)))²(M−1 dof, grand-mean constraint).Collinearity. Fraction of total between-chain scatter in the top singular direction f₁ ≥
_MC_COLLINEARITY_TOL. Genuine slow directions produce near-rank-1 concentration (f₁→1); isotropic spurious scatter gives f₁ ≈ 1/(M−1).Leave-one-out. Detection must survive dropping any single chain, preventing a single outlier chain from driving the verdict. Leave-two-out (dropping any pair) is subsumed by the collinearity + unimodality conjunction for the aligned-pair threat model and is deferred to v2.1.
Support floor. At least one spike is admitted (k ≥ 1).
Unimodality guard. Gap-statistic on the projected chain-means must not flag mode-split; mode-separated chains are deferred to the ensemble (Paper-3 scope) and reported via
deferred_to_ensemble=Truein the verdict.
Plus R² curvature gate and budget deadline (same as single-chain).
Budget re-allocation:
max_grad_budgetis the TOTAL gradient budget, shared across all M chains. Providingn_chains=Moverdispersed starting positions torun()causes each chain to run fortotal // Mleapfrog evaluations — the total cost equals the single-chain budget, not M× it.For
n_chains=1usebuild_meta_adaptation_core()directly to obtain exact single-chain (v1) behaviour; thestaged_adaptationengine routes to it automatically whenn_chains=1.- Parameters:
max_grad_budget – Maximum total gradient budget (leapfrog evaluations) across all M chains.
n_chains – Number of independent chains. Must be ≥ 2. Defaults to
_MULTI_CHAIN_DEFAULT_N_CHAINS(8).max_rank – Same as
build_meta_adaptation_core().gamma – Same as
build_meta_adaptation_core().cutoff – Same as
build_meta_adaptation_core().
- Returns:
Embeddable init/update/final bundle.
updateexpectspositionof shape(n_chains, d)andgradof shape(n_chains, d).- Return type: