Skip to content

CIP-0003: remove MPI, pure functions, diagnostics, doubly stochastic deep GP - #46

Merged
lawrennd merged 17 commits into
mainfrom
cip0003-remove-mpi
Nov 27, 2026
Merged

lawrennd merged 17 commits into
mainfrom
cip0003-remove-mpi

Conversation

@lawrennd

Copy link
Copy Markdown
Member

Summary

Implements CIP-0003 Phases 1-3 and Phase 4 (uncollapsed inference) on the NumPy/GPy stack.

  • MPI removed; SparseGP_MPI renamed SparseGPLayer. The VarDTC subclasses now extend GPy's and keep only the uncertain-output, chunking and Kuu_sigma differences.
  • deepgp.functional: pure functions (collapsed_bound, route_gradients, q(X) helpers) that the layers call.
  • Back-constrained MRD gradient bug fixed: MLP.update_gradient is now idempotent, and the derived q(X) parameters are fixed.
  • Diagnostics (Phase 3): ard_scales, show_scales, prune_model/restore_model (mask-style) and validated initialiser names.
  • Doubly stochastic inference (Phase 4):
    • whitened layer marginals with a backward pass;
    • a stacked bound with residual means and reparameterised samples;
    • DoublyStochasticDeepGP, selected with DeepGP(..., inference_method='doubly_stochastic');
    • seeded minibatch Adam;
    • a natural-gradient step for the top layer;
    • an unsupervised model with a latent q(X) (X=None).
  • Cross-check against GPc CIP-0035:
    • One layer is exact: ELBO to 1e-4, KL to 1e-6, predictions to 1e-5.
    • Two and three layers agree within Monte Carlo error.
    • The golden values are committed, so CI does not need GPc.
  • Examples (not run in CI): the V8 composite task and an oil/CMU comparison. Full tables are in backlog/features/2026-11-27_uncollapsed-whitened-core.md.

Results (single seeds, indicative only)

  • V8 (three layers): RMSE 0.207, NLL -0.188. The gate is RMSE <= 0.26 and NLL <= 0, so it is met. GPc's own run reached 0.193 / -0.344.
  • Oil, reconstruction RMSE: about 0.18-0.20 against 0.65-0.80 for the collapsed model.
  • CMU walk, held-out RMSE: 0.28 against 0.44.
  • Caveat: the collapsed baseline is under-tuned, and the new model is much slower (pure NumPy).

Limitations

  • Gaussian likelihood only.
  • Natural gradients apply to the top layer only.
  • No back-constraint or MRD views for the doubly stochastic model.
  • V8 and the real-data comparisons use few seeds and untuned initialisation.

Test plan

  • python -m pytest deepgp -q (123 passed locally on Python 3.13)
  • CI matrix

mpi_comm non-None now raises TypeError; SparseGP_MPI kept as a deprecated alias.
Deletes vardtc_parallel, util/parallel, MPI parity test and CI job.
…ing, Kuu_sigma delta

Adds sparse_linalg pass-through on SparseGPLayer; inferentia now raises NotImplementedError.
@codecov

codecov Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.00861% with 29 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.13%. Comparing base (5596423) to head (1d288bf).

Additional details and impacted files
@@             Coverage Diff             @@
##             main      #46       +/-   ##
===========================================
+ Coverage   74.96%   85.13%   +10.17%     
===========================================
  Files          17       25        +8     
  Lines        1254     1561      +307     
  Branches      185      205       +20     
===========================================
+ Hits          940     1329      +389     
+ Misses        255      184       -71     
+ Partials       59       48       -11     
Flag Coverage Δ
unittests 85.13% <95.00%> (+10.17%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lawrennd
lawrennd merged commit 76f8fdf into main Nov 27, 2026
5 checks passed
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