solvers: auxiliary-task training seam#300
Open
selmanozleyen wants to merge 1 commit into
Open
Conversation
Add a joint multi-task training seam so extra heads (e.g. a phenotype predictor) can be trained together with the flow without forking the solver. - AuxiliaryTask protocol: name, loss_weight, init_state(vf, *, rng, optimizer) (may return None for a stateless task), is_active(batch), and a differentiable loss(vf_params, aux_params, batch, rng). Tasks self-report participation per batch via is_active, so the data loader is never coupled to a task schedule. - The default flow-matching objective is itself a task (_FlowMatchingTask, stateless), so step_fn treats every task uniformly with no special-casing: it sums each active task's weighted loss into one objective and differentiates once over the velocity field and all active heads. Loss weights therefore genuinely shift the shared gradient. The jitted joint update is cached per active-task signature. - Each weight lives on its task; loss_weight_gex is a property backed by the built-in task (single source of truth). Because the weight now enters the differentiated objective, it also affects the gex-only update. - Export AuxiliaryTask from cellflow.solvers. Training/step path only; the predict path is untouched. Docstrings spell out which state each loss updates.
51f02a7 to
66e3de8
Compare
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.
Adds a training seam to
OTFlowMatchingso extra heads (e.g. a phenotypepredictor) can be trained jointly with the flow, without forking the solver.