Skip to content

Scheduler interface - #482

Open
andrewdalpino wants to merge 1 commit into
3.0from
scheduler-interface
Open

Scheduler interface#482
andrewdalpino wants to merge 1 commit into
3.0from
scheduler-interface

Conversation

@andrewdalpino

Copy link
Copy Markdown
Member

Add Scheduler interface for scheduler optimizers. Advance every batch instead of every parameter update.

A 3-Dense MLP with biases (6 Parameters per batch) now advances t by exactly 1 per batch instead of 6 — so the user-configured steps / length / decay parameters behave at the batch scale the docs promise, instead of at the parameter-update scale they were silently ticking at before.

@andrewdalpino
andrewdalpino changed the base branch from master to 3.0 September 8, 2026 03:16
@andrewdalpino
andrewdalpino requested review from a team and a lite review from Copilot September 8, 2026 03:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

It changes core training-loop semantics for learning-rate schedules and should be validated with real training runs/benchmarks in addition to the included unit tests.

Pull request overview

This PR introduces a Scheduler optimizer contract so global learning-rate schedules advance once per batch (forward+backward pass) rather than once per parameter update, aligning runtime behavior with the documented meaning of “steps”/schedule length.

Changes:

  • Added Scheduler interface with a tick() method, implemented by StepDecay and Cyclical.
  • Updated FeedForward::roundtrip() to call tick() once per batch for scheduler optimizers.
  • Added/updated PHPUnit coverage to ensure schedulers tick per batch and updated optimizer docs to define “step” as “batch”.
File summaries
File Description
tests/NeuralNet/Optimizers/StepDecayTest.php Adds a regression test ensuring StepDecay advances its schedule once per batch, not per parameter.
tests/NeuralNet/Optimizers/SchedulerTest.php Verifies which optimizers implement the new Scheduler contract.
tests/NeuralNet/Optimizers/CyclicalTest.php Adds a regression test ensuring Cyclical advances its schedule once per batch, not per parameter.
src/NeuralNet/Optimizers/StepDecay.php Implements Scheduler and moves schedule advancement into tick().
src/NeuralNet/Optimizers/Scheduler.php Introduces the Scheduler interface defining tick() for batch-level schedule advancement.
src/NeuralNet/Optimizers/Cyclical.php Implements Scheduler and moves schedule advancement into tick().
src/NeuralNet/FeedForward.php Advances scheduler optimizers exactly once per roundtrip() (per batch).
docs/neural-network/optimizers/step-decay.md Clarifies that a “step” corresponds to one batch and updates parameter wording accordingly.
docs/neural-network/optimizers/cyclical.md Clarifies batch semantics, aligns parameter naming (length) and updates the example signature.
Review details
  • Files reviewed: 9/9 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

2 participants