Repository navigation
Conversation
Signed-off-by: 0z5a <dezhen.lu@student.uni-tuebingen.de>
Signed-off-by: 0z5a <dezhen.lu@student.uni-tuebingen.de>
Signed-off-by: 0z5a <dezhen.lu@student.uni-tuebingen.de>
Signed-off-by: 0z5a <dezhen.lu@student.uni-tuebingen.de>
Signed-off-by: 0z5a <dezhen.lu@student.uni-tuebingen.de>
Signed-off-by: 0z5a <dezhen.lu@student.uni-tuebingen.de>
Signed-off-by: 0z5a <dezhen.lu@student.uni-tuebingen.de>
Signed-off-by: 0z5a <dezhen.lu@student.uni-tuebingen.de>
Signed-off-by: 0z5a <dezhen.lu@student.uni-tuebingen.de>
Signed-off-by: 0z5a <dezhen.lu@student.uni-tuebingen.de>
Signed-off-by: 0z5a <dezhen.lu@student.uni-tuebingen.de>
… objectives Signed-off-by: 0z5a <dezhen.lu@student.uni-tuebingen.de>
Signed-off-by: 0z5a <dezhen.lu@student.uni-tuebingen.de>
Documentation build overview
51 files changed ·
|
There was a problem hiding this comment.
Code Review
This pull request introduces a native vLLM-RLT rollout backend supporting recurrent policy training (PPO, GRPO, DPPO, Flow-DPPO) for Ouro, Nanbeige, and Huginn models, along with a categorical Flow-DPPO extension, robust vLLM response parsing, and improved NVLink detection. The review feedback highlights several critical runtime issues that need to be addressed, including a TypeError from an invalid enable_gqa argument in F.scaled_dot_product_attention, missing imports of inspect and copy causing NameErrors, a potential KeyError in the recipe launcher for unsupported model types, and a potential TypeError in the RLT engine if exit_depths is null. Additionally, the reviewer recommends using F.kl_div to avoid numerical instability (NaN values) during manual KL divergence calculation.
| F.scaled_dot_product_attention( | ||
| q.transpose(0, 1).unsqueeze(0), | ||
| k.transpose(0, 1).unsqueeze(0), | ||
| v.transpose(0, 1).unsqueeze(0), | ||
| is_causal=True, | ||
| enable_gqa=True, | ||
| ) | ||
| .squeeze(0) |
There was a problem hiding this comment.
F.scaled_dot_product_attention does not accept an enable_gqa argument in standard PyTorch. Passing enable_gqa=True will raise a TypeError and crash at runtime. Standard SDPA natively supports Grouped Query Attention (GQA) based on the input shapes, so this argument should be removed.
attended = (\n F.scaled_dot_product_attention(\n q.transpose(0, 1).unsqueeze(0),\n k.transpose(0, 1).unsqueeze(0),\n v.transpose(0, 1).unsqueeze(0),\n is_causal=True,\n )\n )| @@ -100,6 +99,10 @@ def wrapped_model_provider( | |||
| pre_process: bool = True, post_process: bool = True, vp_stage: int | None = None | |||
| ) -> GPTModel: | |||
| custom_model_provider = load_function(args.custom_model_provider_path) | |||
| prompt_ids = _prepare_prompt_ids(sample, state.tokenizer, state.processor) | ||
| # Prompt preparation may populate multimodal_train_inputs. Keep these | ||
| # changes local until the response's trainable metadata has been validated. | ||
| prepared_sample = copy.copy(sample) |
| ) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]: | ||
| log_probs = F.log_softmax(logits.float(), dim=-1) | ||
| old_log_probs = old_log_probs.detach().to(log_probs.device) | ||
| divergence = (old_log_probs.exp() * (old_log_probs - log_probs)).sum(-1).clamp_min(0) |
There was a problem hiding this comment.
Calculating the KL divergence manually using old_log_probs.exp() * (old_log_probs - log_probs) can lead to NaN values if old_log_probs contains -inf (zero probability tokens), because 0.0 * -inf is NaN in PyTorch. Using F.kl_div with log_target=True is a much safer, cleaner, and standard way to compute the categorical KL divergence while avoiding numerical instability.
| divergence = (old_log_probs.exp() * (old_log_probs - log_probs)).sum(-1).clamp_min(0) | |
| divergence = F.kl_div(log_probs, old_log_probs, log_target=True, reduction="none").sum(-1).clamp_min(0) |
| or output.weight_version != version | ||
| or output.log_probs is None | ||
| or len(output.log_probs) != response_length | ||
| or len(output.exit_depths) != response_length |
There was a problem hiding this comment.
| providers = {"ouro": "ouro", "nanbeige": "nanbeige", "huginn_raven": "huginn"} | ||
| provider = providers[family] |
There was a problem hiding this comment.
If family is not found in providers, a KeyError will be raised on line 50. We should validate family and raise a clean parser error with a list of supported model types.
providers = {"ouro": "ouro", "nanbeige": "nanbeige", "huginn_raven": "huginn"}\n if family not in providers:\n parser.error(f"Unsupported model type: {family}. Supported types: {list(providers.keys())}")\n provider = providers[family]Signed-off-by: 0z5a <dezhen.lu@student.uni-tuebingen.de>
Signed-off-by: 0z5a <dezhen.lu@student.uni-tuebingen.de>
Signed-off-by: 0z5a <dezhen.lu@student.uni-tuebingen.de>
Signed-off-by: 0z5a <dezhen.lu@student.uni-tuebingen.de>
…tives Signed-off-by: 0z5a <dezhen.lu@student.uni-tuebingen.de>
Signed-off-by: 0z5a <dezhen.lu@student.uni-tuebingen.de>
d154a44 to
f6790fe
Compare
Signed-off-by: 0z5a <dezhen.lu@student.uni-tuebingen.de>
Signed-off-by: 0z5a <dezhen.lu@student.uni-tuebingen.de>
Signed-off-by: 0z5a <dezhen.lu@student.uni-tuebingen.de>
Signed-off-by: 0z5a <dezhen.lu@student.uni-tuebingen.de>
Purpose
Add Huginn-0125 to PPO, GRPO, Decoupled PPO and categorical Flow-DPPO. Actor/critic replay preserves per-completion latent seeds, the prelude/core/coda and sandwich norms; conversion and full policy publication preserve tied embeddings and FP32 RoPE.
Shared backend/objective wiring is inherited from #463 (
45f2dd7). Huginn layer at the GPU-tested source: 20 files, +554/-38. Updated onto merged #460/#454 at8c8b8e8e; current base diff: 57 files, +2772/-33.Test Plan
Recipe. Tested
71860e5, official revisionbb6621b, RLTd2a3589, two RTX 5090s, Torch 2.12.1/CUDA 13.0. Real Ray/MCore, FP32/native SGD (momentum 0), recomputation, full disk publication, fixed 32 recurrences; four prompts, up to 16 response tokens/completion, controlled binary rewards.Compare three continuous rollouts against two saved rollouts plus one in fresh processes. This validates reproducibility; default FP16 training and model quality remain unmeasured.
Test Result
Optimizer/scheduler/RNG, data cursor, tokens, latent traces and publication digests match; all cases exit 0. Earlier CPU suites: 70 provider/recipe + 110 shared regressions passed. Merge
dff03a95passes 131 HF conversion/collector/argument CPU regressions, 0 skipped, plus Ruff/Black/isort for all 16 merged Python files. Huginn provider, conversion, engine, loss and recipe blobs retain the GPU-tested versions. DCO/docs pass; automatic CI #1448 is queued.PPO Graph comparison: three complete matched pairs (AB/BA/AB), same Triton backend, seeds and full publication; only Graph mode changes. Median of three run medians per arm; warm measurements exclude capture.
Warm rollout improves; complete training time is effectively unchanged. Graph fresh resume and cross-arm full-state/token comparisons pass; zero fallbacks or warm recaptures. Timings cover PPO only.