Add value-model (critic) support: state_values, GAE/EV helpers, frozen modules - #15
Draft
qywu wants to merge 1 commit into
Draft
Add value-model (critic) support: state_values, GAE/EV helpers, frozen modules#15qywu wants to merge 1 commit into
qywu wants to merge 1 commit into
Conversation
…n modules Pairs with togethercomputer/xorl#85 (SAO-style value-model training): - LossFnOutput.state_values: per-token V(s_t) from the value_loss / value_prediction loss functions (dedicated field; named state_values because .values() is the tinker dict-compat method). - Datum dtype hints for the new per-token fields: returns, old_values. - compute_skip_observation_gae (SAO Eq. 4-5) and explained_variance helpers, pure Python, exported at package top level. - create_lora_training_client(frozen_module_patterns=...): per-session frozen adapter modules (frozen-attention critic). Validated end-to-end against a live 2-GPU Qwen3-8B server.
Broly Security ScanNote Baseline snapshot is missing for this repo. Broly is running in PR-only fallback mode until the first scheduled baseline completes. This does not block the PR. Note ✅ Clean scan Note Re-scan this PR anytime with
|
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.
Client side of togethercomputer/xorl#85 / togethercomputer/xorl#84 (SAO-style value-model training over the tinker-compat API).
LossFnOutput.state_values— per-tokenV(s_t)returned by the server'svalue_loss/value_predictionloss functions, as a dedicated field (namedstate_valuesbecause.values()is the tinker dict-compat method). Full dict-like surface (__getitem__/__contains__/keys/values/items/to_dict/from_dict) covered.returns,old_values→ float32.compute_skip_observation_gae(SAO, arXiv:2607.07508 Eq. 4–5) andexplained_variancehelpers — pure Python, exported at package top level; the GAE chains the Bellman recursion across action tokens only, and EV derives from thevalue_lossmoment metrics (is_value_error_sq_mean,is_return_mean,is_return_sq_mean).create_lora_training_client(frozen_module_patterns=...)— per-session frozen adapter modules (the paper's frozen-attention critic), sync and async variants.Tests:
tests/test_rl_helpers.py(dtype inference, state_values roundtrip + dict-compat, GAE observation-skipping, EV identities); all 51 client type tests pass.Validated end-to-end against a live 2-GPU Qwen3-8B xorl server (fresh-critic zero prediction, value-loss descent, GAE over live values, frozen-attention factor zeros on disk). Merge together with togethercomputer/xorl#85; the server accepts old clients (
dropout: 0.0tolerated,state_valuesmerely absent for older parsers).