docs: migrate learner workflows to sequence-driver APIs - #154
Merged
chaoming0625 merged 1 commit intoJul 29, 2026
Merged
Conversation
Reviewer's GuideMigrates all user-facing online learning docs and examples from ad-hoc algorithm objects to the unified learner workflow built around braintrace.compile and sequence-driver methods, and clarifies compile()’s vmap semantics and return types. Sequence diagram for the new learner compile and sequence-driver workflowsequenceDiagram
actor User
participant Model
participant braintrace_compile as braintrace.compile
participant Learner
User->>Model: construct_model()
User->>braintrace_compile: compile(Model, D_RTRL, x0, batch_size, vmap)
braintrace_compile-->>User: Learner (ETraceAlgorithm or ETraceVmap)
User->>Learner: etrace_evolve(prefix_inputs)
Learner->>Model: forward(prefix_inputs)
Learner-->>User: prefix_outputs
User->>Learner: etrace_grad(sequence_inputs, targets, step_fn)
loop over time steps
Learner->>Learner: step_fn(step_input, step_target)
Learner->>Model: forward(step_input)
end
Learner-->>User: gradients, losses
User->>Model: apply_gradients(gradients)
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
chaoming0625
approved these changes
Jul 29, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Description
This PR completes the migration of application-facing online-learning workflows to the public learner API:
braintrace.compile(...)learner.etrace_evolve(...)learner.etrace_grad(...)learner.moduleThe Algorithms API documentation, compile docstring, tutorials, notebooks, and affected D-RTRL examples have been updated consistently.
No algorithm implementation or public function signature is changed.
How Has This Been Tested
python -m pytest braintrace/_compile_test.py braintrace/_algorithm/sequence_test.py -q(134 passed)python -m pytest examples/drtrl/tests/test_smoke.py -q(9 passed, 1 skipped)docs/advanced/custom_algorithms.ipynbpython -m sphinx -W --keep-going -E -a -b html docs docs/_build/htmlpython -m pytest -q: 2590 passed, 5 skipped, 4 deselected, and 120 failed in the current environment. The failures are associated with the third-partysaiunit.math.exprel(mV)compatibility issue and known order-dependent D-RTRL smoke behavior.Types of changes
Checklist
Other information
The low-level benchmark and oracle paths remain intentionally unchanged because replacing them would alter the measured workload or correctness oracle.
Summary by Sourcery
Migrate online-learning documentation, tutorials, and D-RTRL examples to the public learner workflow built around
braintrace.compile,etrace_evolve, andetrace_grad, clarifying vmap behavior and sequence-driver usage.Enhancements:
braintrace.compileand use sequence-driver APIs for warm-up prefixes and step-wise gradients, including vmap batching and final-step objectives.Documentation:
learner.etrace_evolveandlearner.etrace_gradrather than raw JAX gradients.braintrace.compileAPI docs for vmap mode, emphasizing theETraceVmapwrapper and how to drive sequences via the learner APIs.