Repository navigation
bioreason: default GRPO LoRA to q_proj/v_proj and add a target lister - #11
Open
balajiadarsha wants to merge 3 commits into
Open
balajiadarsha wants to merge 3 commits into
balajiadarsha wants to merge 3 commits into
Conversation
training.lora_target_modules was written to the adapter sidecar but never passed to apply_lora_torchtune, so every nn.Linear except lm_head was adapted regardless of the setting. Setting it via Hydra also crashed save_lora_adapter, because json cannot serialize an OmegaConf ListConfig. apply_lora_torchtune now takes target_modules (leaf names, matched like exclude) and raises on a name that matches no layer, an empty list, or a bare string. ZoneATrainer and ZoneDTrainer pass the config value through. With target_modules unset the result is unchanged (state dict bit-identical on a seeded toy backbone). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GmpnEoNqJpQjR59ie7ZMek
Review follow-ups on #9. - Move layer selection and the target_modules name checks out of apply_lora_torchtune into _select_lora_targets, which needs no torchtune. The selection and bad-name tests now run in CI (which does not install torchtune); only the LoRALinear and sidecar tests still skip without it. - Convert lora_target_modules from an OmegaConf ListConfig to a plain list in build_training_config, so the config the trainers dump into training_state.json records a list rather than its string form. A bare string passes through unchanged, so apply_lora_torchtune still rejects it. - Update the BioReason demo notebook, which still described lora_target_modules as metadata only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bioreason_grpo.yaml now ships lora_target_modules: [q_proj, v_proj], so GRPO adapts only the attention query/value projections (OLMo-1B: 32 of 112 layers) instead of every nn.Linear. bioreason_sft.yaml declares the key as null, keeping SFT's behavior. Declaring it in both lets training.lora_target_modules=[...] be overridden without Hydra's "+". tools/list_lora_targets.py prints the leaf names that can be targeted for any model, with layer counts. It builds the backbone on the meta device (config.json only, no weights) and uses the trainer's own _select_lora_targets. Both YAMLs and the notebook point to it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
Follow-up to #9, which makes
training.lora_target_modulestake effect. This branch is built on #9's latest commit (5c9e8c2), so merge #9 first. Until then the diff below also shows #9's changes. The only new commit is the last one. Independent of #10; they touch different files.q_projandv_projby default.bioreason_grpo.yamlnow shipslora_target_modules: [q_proj, v_proj]. On OLMo-1B that is 32 of 112 linear layers (0.164% of backbone params trainable instead of 0.933%).null, keeping its behavior (everynn.Linearexceptlm_head). With the key declared in both YAMLs,training.lora_target_modules=[...]overrides it without Hydra's+prefix; before, no YAML declared it and the plain override failed in struct mode.tools/list_lora_targets.pylists the leaf names that can be targeted for any model, with layer counts. It builds the backbone on the meta device (onlyconfig.jsonis read, no weights) and uses the trainer's own_select_lora_targets, so its list matches what training accepts:--backbone-id <HF id or path>skips Hydra. Both YAMLs and the notebook (section 9b) point to it.Type of Change
Compatibility
src.*import pathsprismCLI surfacetraining.lora_target_modulesis now declared inbioreason_grpo.yamlandbioreason_sft.yaml. BioReason GRPO results change: new GRPO runs adapt q/v only, so they are not directly comparable with earlier all-layer GRPO runs. Passtraining.lora_target_modules=nullto get the old behavior.How Has This Been Tested?
Aurora login node, CPU only:
New tests (no torchtune needed, so they run in CI): the shipped defaults for both YAMLs, the plain override without
+(list andnull) giving a reallist, and the tool's name counting.End-to-end: GRPO with
[q_proj, v_proj]was already run on Aurora when testing #9 (passed: 32 layers adapted, adapter saved and merged at eval). Aurora runs of this branch's defaults are in progress and will be reported here.New Dependencies, Data, or Assets
None.
Checklist
ruff check, ruff 0.16.9 perrequirements/ci.txt)AI/LLM Assistance
Written with Claude Code (Claude Opus 5.5).
🤖 Generated with Claude Code