Skip to content

SFT, MPNN Stream - #15

Merged
Iznoanygod merged 5 commits into
radical-collaboration:mainfrom
Iznoanygod:main
Sep 21, 2026
Merged

Iznoanygod merged 5 commits into
radical-collaboration:mainfrom
Iznoanygod:main

Conversation

@Iznoanygod

Copy link
Copy Markdown
Contributor

Add MPNN stream, SFT trainer

claude and others added 5 commits September 21, 2026 02:01
…verwritten

Previously publish_into_repo wrote every round to the same repo weights path
({model_name}.pt), overwriting the last version — so history was lost and the
checkpoint file could not even serve as a completion signal.

Now each round writes {model_name}_v{version}.pt into its own per-version
directory (versioned_checkpoint_path), never overwritten, so the whole history
is kept with the version in the filename. That versioned file is what the
manager publishes, so get_current_model() and any reload off it point at the
exact version.

publish_into_repo is preserved as a *pointer copy*: the wrapper copies the
latest versioned checkpoint onto the repo's fixed {model_name}.pt (repo_pointer_
path) so IMPRESS's next pass still picks it up with no wrapper change — the
pointer is just "current", the versioned files are the archive. The job spec
carries target_weights (versioned) and publish_copy (pointer or null); the
wrapper writes the versioned file atomically, then atomically refreshes the
pointer, then the train_complete marker.

Replaces published_weights_path with versioned_checkpoint_path + repo_pointer_
path. Tests and docs (§4) updated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012NhrMrisx8FqTqraTpBbdv
The LLM half now ships both objectives: rome.train.llm.SFTTrainer / SFTConfig
alongside the existing GRPO. SFT trains the model to imitate chosen
(prompt, completion) pairs — building the training text from the tokenizer's
chat template when a record has no preformatted `text` field — and is exported
lazily from rome.train like GRPO.

examples/agnostic/llm_sft_streams.py is the supervised counterpart to
llm_grpo_streams.py and uses all three managers: an inference stream samples
candidate math answers, a reward stream grades them with a real math reward
(extract the final integer, compare to gold), and the data manager keeps only
the correct ones (top_k by score, deduped). The SFT trainer then fine-tunes on
those winners and the stream hot-swaps onto the new adapter — the STaR /
rejection-sampling loop, where the reward selects the data rather than feeding
an RL objective.

Tests for SFTConfig/SFTTrainer validate + config building + the chat-template
fallback; README and the train/ layout note updated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012NhrMrisx8FqTqraTpBbdv
…ions)

The trainer improves ProteinMPNN; this runs it as a ROME-A inference stream, so
a protein workflow can use all three managers (generate → score → train →
hot-swap) the way the LLM examples do. Feed backbone PDBs, get designed
sequences; when the trainer publishes a checkpoint the stream reloads onto it.

examples/impress_r/mpnn_stream.py provides two implementations, both subprocess
(neither reimplements ProteinMPNN sampling — they run the checkout's tested
inference):

- mpnn_run_stream: ROME-native, protein_mpnn_run.py per backbone with
  --path_to_model_weights so it uses the exact published versioned checkpoint.
- impress_mpnn_stream: the IMPRESS path via this example's mpnn_wrapper.py;
  since that wrapper takes no weights path, each reload refreshes the repo's
  fixed {model_name}.pt pointer (the one publish_into_repo maintains).

load_func/process_func are module-level and settings ride as load_kwargs, so
they pickle by reference to a Dragon task process. A request is
{backbone_id, pdb_path, design_chains?, num_seqs?}; each output record is
{backbone_id, sequence, score, sample, model_version, pdb_path}, ready for a
reward stream and add_training_data.

Tests cover the FASTA parser (per-sequence score kept distinct from
global_score), both command builders, the reload hook + repo-pointer refresh,
and the stream builders. Docs (§8) and README updated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012NhrMrisx8FqTqraTpBbdv
The three applied commits were written before the ROME-A to ROME rename, so
their comments and docs still carried the old name. No behaviour change.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PMu7bbyPmzeV1vzkiGtDoj
@Iznoanygod Iznoanygod self-assigned this Sep 21, 2026
@Iznoanygod
Iznoanygod merged commit 8d21cbb into radical-collaboration:main Sep 21, 2026
1 check passed
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