Skip to content

solvers: auxiliary-task training seam#300

Open
selmanozleyen wants to merge 1 commit into
theislab:mainfrom
selmanozleyen:feat/auxiliary-tasks
Open

solvers: auxiliary-task training seam#300
selmanozleyen wants to merge 1 commit into
theislab:mainfrom
selmanozleyen:feat/auxiliary-tasks

Conversation

@selmanozleyen

@selmanozleyen selmanozleyen commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Adds a training seam to OTFlowMatching so extra heads (e.g. a phenotype
predictor) can be trained jointly with the flow, without forking the solver.

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.
@selmanozleyen selmanozleyen force-pushed the feat/auxiliary-tasks branch from 51f02a7 to 66e3de8 Compare July 10, 2026 15:30
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