Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Differentiable structure diagnostics (B10)

San Diego State University

The standard cluster-structure statistics are combinatorial and non-differentiable — they rest on a minimum spanning tree and hard subset selections, so they cannot enter a gradient-based inference objective. progenax ships differentiable surrogates for two of them, and this demo validates both against their exact oracles and shows the substructure surrogate is a faithful differentiable loss.

differentiable surrogateexact oraclestatistic
q_approx (kNN + softmin)compute_q_parameter (MST + scipy)Cartwright & Whitworth (2004) QQ Cartwright & Whitworth, 2004
lambda_msr_approx (softmin + soft mass-cut)compute_lambda_msr (MST)Allison et al. (2009) ΛMSR\Lambda_{\rm MSR} Allison et al., 2009

Inputs and assumptions

This demo fits nothing — it is a calibration check of differentiable surrogates against exact oracles. Every quantity is a known/fixed generator setting, a swept parameter, or a numerical tolerance.

Table 1:Model inputs

Input

Meaning and role

Status (fiducial)

QQ generators

Substructure sequence (clumpy \to uniform sphere \to r2r^{-2} concentrated) spanning the CW04 range; Plummer is deliberately excluded (Q>1Q>1, outside the calibrated regime).

known / fixed (toy generators)

clump / segregation params

Clumpy generator (k=8k=8 clumps, spread 0.06); bimodal segregation cluster (n=400n=400, nmassive=20n_{\rm massive}=20, 0.5 vs 10M10\,M_\odot).

known / fixed

Λ\Lambda surrogate softness

lambda_msr_approx hyperparameters (mcut=2.0m_{\rm cut}=2.0, τ=0.3\tau=0.3, β=0.1\beta=0.1) that set the magnitude compression.

known / fixed

core-scale sweep

Segregation strength slid 1.00.051.0\to0.05 (massive stars pulled into a shrinking core).

sweep input

NN, seeds, FD step

400 particles/cluster; 6 seeds averaged; finite-difference step h=103h=10^{-3} for the AD-vs-FD check.

numerical choices

gates

QQ full-sequence <0.10<0.10, substructure-regime <0.06<0.06, AD–FD rel-gap <0.12<0.12, Λ\Lambda Spearman >0.8>0.8, null Λ1<0.25|\Lambda-1|<0.25.

numerical choices

(a) Substructure QQ — calibration in the regime it is used

The CW04 parameter Q=mˉ/sˉQ = \bar m / \bar s (mean MST edge length over mean separation) separates substructured (Q<0.8Q<0.8) from centrally concentrated (Q>0.8Q>0.8) clusters, anchored at Q0.79Q\approx0.79 for a uniform sphere. Across a sequence from a clumpy distribution through a uniform sphere to an r2r^{-2} concentrated profile, q_approx tracks the exact QQ:

distribution

exact QQ

qapproxq_{\rm approx}

Δ|\Delta|

clumpy (substructured)

0.409

0.409

0.000

uniform sphere

0.774

0.824

0.051

r2r^{-2} concentrated

0.924

1.010

0.085

In the substructure regime Q0.8Q\lesssim0.8 — the regime where q_approx is used for substructure inference — it tracks the exact statistic to Δ<0.06|\Delta|<0.06, and it preserves the ordering throughout. The calibration degrades mildly toward high central concentration (Q0.92Q\sim0.92), and a steep Plummer (Q>1Q>1) is deliberately excluded as outside the CW04-calibrated range, where neither the exact statistic nor the surrogate is meaningful.

(b) Mass segregation ΛMSR\Lambda_{\rm MSR} — rank-faithful, sharp-limit exact

Sweeping a bimodal-mass cluster’s segregation strength (massive stars drawn into a shrinking core), the soft lambda_msr_approx and exact compute_lambda_msr both rise as the massive population concentrates. The rank correlation is perfect (Spearman =1.00= 1.00), and the unsegregated case returns Λ1\Lambda\approx1. In the soft regime used for smooth gradients the surrogate is magnitude-compressed (it rises to 3\sim 3 where the exact Λ\Lambda reaches 20\sim 20 at extreme segregation); it converges to the exact magnitude as the softness (τ,β)0(\tau,\beta)\to0 (the Oracle-1 limit validated in the segregation-surrogate physics suite). It is a rank/gradient-faithful observable, not a drop-in for the absolute Λ\Lambda.

(c) The substructure surrogate is a faithful differentiable loss

With q(p)=qapprox(upD^)q(p) = q_{\rm approx}(u^p\,\hat D) — raising each point’s radius to the power pp, so larger pp is more centrally concentrated — the autodiff gradient dq/dp=0.183\mathrm dq/\mathrm dp = 0.183 matches the finite-difference slope 0.169 at h=103h=10^{-3} to 4.0%. (The small gap is finite-difference truncation across kNN-cell boundaries, which shrinks as h0h\to0; the autodiff value is the correct local gradient.) So q_approx can drive a gradient-based objective — its purpose.

Figure

Differentiable structure diagnostics (scripts/demo_diff_diagnostics.py, ALL
PASS). (a) q_{\rm approx} vs exact Q across the substructure→concentration
sequence; the \pm0.06 band and the y=x line, with the CW04 uniform-sphere anchor
Q=0.79 (dashed). (b) \Lambda_{\rm MSR} vs segregation strength (log–log):
exact (blue) and the rank-faithful soft surrogate (vermilion), both rising as the
massive stars concentrate. (c) q_{\rm approx}(u^p\hat D) vs the concentration
exponent p; the autodiff vs finite-difference gradients agree to 4% at p=0.5.

Figure 1:Differentiable structure diagnostics (scripts/demo_diff_diagnostics.py, ALL PASS). (a) qapproxq_{\rm approx} vs exact QQ across the substructure→concentration sequence; the ±0.06\pm0.06 band and the y=xy=x line, with the CW04 uniform-sphere anchor Q=0.79Q=0.79 (dashed). (b) ΛMSR\Lambda_{\rm MSR} vs segregation strength (log–log): exact (blue) and the rank-faithful soft surrogate (vermilion), both rising as the massive stars concentrate. (c) qapprox(upD^)q_{\rm approx}(u^p\hat D) vs the concentration exponent pp; the autodiff vs finite-difference gradients agree to 4% at p=0.5p=0.5.

Caveats

How to run

env -u VIRTUAL_ENV uv run --no-sync python scripts/demo_diff_diagnostics.py

References

The substructure parameter QQ is Cartwright & Whitworth (2004); the mass-segregation ratio ΛMSR\Lambda_{\rm MSR} is Allison et al. (2009). The surrogates and their exact-limit convergence are documented on the JAX-native substructure QQ and mass-segregation pages.

References
  1. Cartwright, A., & Whitworth, A. P. (2004). The statistical analysis of star clusters. Monthly Notices of the Royal Astronomical Society, 348, 589–598. 10.1111/j.1365-2966.2004.07360.x
  2. Allison, R. J., Goodwin, S. P., Parker, R. J., Portegies Zwart, S. F., de Grijs, R., & Kouwenhoven, M. B. N. (2009). Using the minimum spanning tree to trace mass segregation. Monthly Notices of the Royal Astronomical Society, 395, 1449–1454. 10.1111/j.1365-2966.2009.14508.x