Skip to content

Add partial diffusion (SDEdit) seeding - #2

Open
ssiddhantsharma wants to merge 2 commits into
escalante-bio:mainfrom
ssiddhantsharma:partial-diffusion-seeding
Open

Add partial diffusion (SDEdit) seeding#2
ssiddhantsharma wants to merge 2 commits into
escalante-bio:mainfrom
ssiddhantsharma:partial-diffusion-seeding

Conversation

@ssiddhantsharma

Copy link
Copy Markdown

What

Adds SDEdit-style partial diffusion to the flow-matching sampler: start integration from a partially-noised copy of an existing structure instead of pure noise, to produce variants of a design rather than de-novo samples.

  • flow_matching.seed_state(...) — build a partially-noised DenoiseState at a start step from a clean (bb, lat); the SDEdit analog of init_noise, using the model's own linear interpolant x = t*clean + (1-t)*noise.
  • flow_matching.generate(..., seed=None, start=0) — begin from a seeded state. Backward-compatible: seed defaults to None, so existing calls are unchanged.
  • pdb.seed_from_encoder(encoder, chain) — convenience to encode a chain into a (ca_coords, z_latent) seed via the deterministic encoder.

Tests

tests/test_seed.py (pure JAX, no weights): interpolant endpoints (t=1 -> clean, t=0 -> noise), monotonic closeness in start, a zero-velocity generate(seed=) round-trip, and the start>0 guard. All pass locally.

Design choices (feedback welcome)

  • start is an integer step index (matches denoise_steps). A float t/renoise_frac in (0,1) would be more ergonomic (caller needn't know nsteps) — happy to switch.
  • Overloaded generate with seed/start rather than a separate generate_partial, to keep one entry point and full backward-compat. Can split if preferred.
  • Frame: seed_state zero-COMs only the noise, preserving whatever frame the caller passes (target-frame for conditioned SDEdit; zero-COM for unconditioned single-chain). Documented in the docstring.
  • Self-conditioning starts at zero for the first partial step (same as generate's step-0 behavior).

- flow_matching.seed_state: build a partially-noised DenoiseState at a start step from a
  clean (bb, lat), i.e. the SDEdit analog of init_noise.
- flow_matching.generate(seed=, start=): begin integration from a seeded state instead of
  pure noise. Backward-compatible (seed defaults to None; existing calls unchanged).
- pdb.seed_from_encoder: encode a chain to a (ca_coords, z_latent) seed for generate().
- tests/test_seed.py: seeding-math endpoints, monotonicity, and a zero-velocity round-trip.
@ssiddhantsharma ssiddhantsharma changed the title Add partial diffusion (SDEdit) seeding to generate() Add partial diffusion (SDEdit) seeding Jul 8, 2026
…eeding

# Conflicts:
#	src/jproteina_complexa/flow_matching.py
#	src/jproteina_complexa/pdb.py
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