Skip to content

Conversation

Thunderblok
Copy link
Collaborator

Core Additions

Native Keras 3 .keras round‑trip (architecture + weights + optimizer state) via save_model_and_meta / load_model_safe (safe_mode).
Deterministic seeding utilities for reproducible evaluation and resume training.
Graph exporter that preserves duplicate inbound edges (no accidental dedup), enabling faithful reconstruction in future backends (Torch / ONNX).
Serialization audit script to surface unregistered custom layers early.
CI workflow (minimal deps) exercising persistence and custom layer round‑trip.
Connectivity Semantics Fix

Reinterprets p_lateral_connection as an intensity λ (expected multiplicity) rather than a Bernoulli probability.
Supports hyperdense regimes (λ > 1) discovered by prior TPE / Bayesian optimization; removes accidental clamping that collapsed search space.
Adds floor(λ * decay) + fractional Bernoulli sampling logic for duplicate lateral edges (stable, lightweight alternative to Poisson draws).
Updated docstrings and terminology to prevent future regressions.
Testing & Validation

Round‑trip persistence test: prediction parity + resume training parity within tolerance.
Custom layer safe_mode serialization test (no custom_objects needed).
Duplicate edge fidelity verified in exporter (repeated inbound edges retained in JSON spec).
New statistical expectation tests: empirical mean multiplicity ≈ λ * decay within tight tolerance.
Gating / max consecutive lateral connection behavior preserved (legacy invariant).
Added intensity sampling unit tests (fractional part, negative intensity → zero multiplicity).
Risk & Mitigation

Wide try/except in exporter isolated; future validate_spec() planned.
No shape/dtype metadata yet—intentional to keep initial spec minimal/stable.
Intensity semantics documented to prevent reintroduction of probability clamping.
Why It Matters

Deterministic, restartable training flows (optimizer state continuity).
Faithful structural export unlocks cross‑framework rebuilds and visualization.
Preserves hyperdense architectural expressivity critical to observed performance gains.
Establishes a clean, versionable contract for future tooling (spec validators, Torch builder).
Follow‑Up (Not in this PR)

Add shapes/dtypes to spec metadata.
Negative custom layer test (unregistered should fail clearly).
Idempotent save→load→save validation.
Multi‑IO + regularization layer export tests.
Optional Poisson-mode sampler (if ever needed) behind a flag.

…sistence helpers and seeding utilities; force CPU in test for determinism
…i: run both tests. Note: NumPy 2.x emits harmless __array__(copy=...) deprecation warning; CI pins numpy==1.26.4 to avoid it.
…rt; implement helper functions for tensor history
- Introduced a minimal end-to-end smoke test script for Cerebros core components, validating model training, saving, and reloading.
- Implemented a utility function `clamp_probability` to ensure user-provided probability values are constrained within the [0.0, 1.0] range, with options for handling NaN values.
- Created a new CSV file to log model performance metrics during trials.
- Added a JSON metadata file for model trials to store configuration and versioning information.
- Developed unit tests for the probability clamping functionality and its integration with the DenseLateralConnectivity class.
…connections; enhance documentation and tests for clarity
@Copilot Copilot AI review requested due to automatic review settings August 21, 2025 22:31
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces comprehensive Keras 3 persistence functionality, graph export capabilities, and fixes hyperdense connectivity semantics in the Cerebros neural architecture search framework. The changes enable deterministic training workflows with complete model state preservation and faithful cross-framework model reconstruction.

  • Native Keras 3 persistence with round-trip validation for architecture, weights, and optimizer state
  • Graph export functionality that preserves duplicate edges for accurate model reconstruction
  • Reinterpretation of p_lateral_connection as intensity λ rather than probability to support hyperdense regimes

Reviewed Changes

Copilot reviewed 25 out of 32 changed files in this pull request and generated no comments.

Show a summary per file
File Description
cerebros/persistence/keras_io.py Core persistence functions for saving/loading models with metadata
cerebros/keras_export.py Graph export utilities for cross-framework model reconstruction
cerebros/denseautomlstructuralcomponent/dense_automl_structural_component.py Connectivity semantics fix for hyperdense lateral connections
tests/ Comprehensive test suite for persistence, export, and connectivity features
cerebros/utils/random.py Deterministic seeding utilities for reproducible training

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

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