Add barren-plateau control, loss-term gradient conflict, and parameter-space Fisher - #6
Open
Adithyaphani wants to merge 4 commits into
Open
Conversation
Author
|
@JitheshMithra let me know any changes to be made and dropped a message in Discord have a glance into it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three scripts in
SPECops/src/, no new dependencies, no existing file changed except threeadded rows and three glossary bullets in
REPRODUCIBILITY.md.These fill gaps rather than duplicate:
gradient_variance.py,effective_rank.py,activation_diversity.py,shapley_layer_attribution.py,loss_landscape_slice.pyand thefourier_spectrum→shock_spectrum→frequency_unit_conversionchain already cover thediagnostics they cover. PennyLane autodiff throughout — no torch.
1.
barren_plateau_control.py— validatesgradient_variance.pygradient_variance_results.csvmeasures whether our ansatz sits on a barren plateau. Nothingcurrently establishes that the estimator would notice one. This runs the identical protocol
(N random inits → variance of one fixed gradient component) on the random parameterised circuit
family of McClean et al. 2018, where the plateau is proven, and fits the decay.
200 inits, depth
2n:Exits non-zero on failure, so it can gate a sweep. This is what lets a flat
gradient_variance_results.csvbe reported as "no plateau at this scale" rather than "ourestimator saw nothing".
--also-sweep-gridadditionally runs the control at our own 3/4/5 qubit counts, where variancefalls 5.978e-03 → 3.863e-04, a ~15× decay across the same range the QAPINN sweep covers. That's
the number
gradient_variance_results.csvshould be read against.Two traps are encoded as defaults: McClean plot in natural log, not log10 (a factor of 2.303
waiting to be misread), and depth has to scale with qubit count or the second moment hasn't
converged and the control fails for reasons unrelated to us.
2.
gradient_conflict.py— do the two loss terms agree?loop.pyminimisesmse_u + mse_fon shared parameters and nothing measures whether they pullthe same way. It matters for reading the plateau numbers honestly: a stalled config could be a
vanishing gradient or two terms cancelling, and those have opposite fixes (change the ansatz vs.
reweight the loss).
loss_landscape_slice.pysees the surface shape but not which term pullswhere.
Full 12-config grid at random init:
W_qonly)cos_wq_onlyis lower thancos_all_paramsin all 12 configs without exception — thequantum layer's parameters are consistently the more contested ones, with the classical pre/post
layers absorbing the disagreement. Individual signs are noisy at the default
--n-f-batch 5andshouldn't be read config-by-config; the ordering is what's stable.
norm_ratio_data_over_residualruns 2.27–53.6 across every config, so the data term alsodominates the update magnitude everywhere.
3.
fisher_effective_dimension.py— is the parameter reduction real?effective_rank.pymeasures the entropy rank of the post-quantum-layer output matrix. Thismeasures the same quantity in parameter space: the spectrum of
F = JᵀJ/NwithJ[i,k] = ∂u(tᵢ,xᵢ)/∂paramₖ.param_countinsweep_results.csvis nominal — it counts arrayentries. Rank utilisation says how many of those directions move the model at all.
Utilisation falls monotonically as parameters are added — the extra parameters are not buying
proportional reachable capacity.
Caveat, in the script and worth stating here: these are random inits, where the model is close
to linear and low rank is partly expected. The number that belongs in the report is the
trained one.
Verification
All three were developed and run against
main.build_model/main.make_training_data, full12-config grid for the latter two. Same subprocess-per-config isolation as
gradient_variance.pywhere the loss goes through
pde_residual(three levels of autodiff); skipped where it doesn't,with a comment explaining which case applies rather than copying the pattern blindly.
Since this repo tracks
results/*.csvand*.jsonas evidence, the generated outputs arecommitted alongside the scripts.
Notes for review
sweep_checkpoints/on the machine these ran on, so every row israndom_init.Rerunning
gradient_conflict.pyandfisher_effective_dimension.pywith--checkpoint-dir sweep_checkpointson a machine that has them produces the trained-minimumrows as well — that's the version worth quoting, particularly for the Fisher table. Both
scripts already handle it; it's one flag.
barren_plateau_control.pyis the one I'd merge first even if the other two need work — itupgrades a number already in the report from a measurement to a validated measurement.
--model main_classicalfor the classical control, resolved byimportlibthe wayeval.pydoes. Untested against that module; if its interface differsfrom
main.py'sbuild_model, the fallback path uses the module directly.barren_plateau_control.csvis appended to, so a--also-sweep-gridrun leaves a duplicaten_qubits=4row from the two overlapping sweeps. Noted in the glossary. The fit JSON coversonly the 2/4/6/8 control sweep.