Skip to content

docs: define vime integration design - #126

Open
inaniloquentee wants to merge 1 commit into
docs/ws5-vime-hook-pointsfrom
docs/ws5-vime-integration-design
Open

docs: define vime integration design#126
inaniloquentee wants to merge 1 commit into
docs/ws5-vime-hook-pointsfrom
docs/ws5-vime-integration-design

Conversation

@inaniloquentee

@inaniloquentee inaniloquentee commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Scope

This is a documentation-only PR.

It does not add a production integration, change Vime/slime/vLLM/Megatron source, inject RL-Kernel operators, or claim real-engine train-inference consistency.

Depends on #118
Closes #119
Part of #83

Signed-off-by: inaniloquentee <3051000145@qq.com>
@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0b230eb8-467f-44e4-ba90-273b83405a6b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/ws5-vime-integration-design

Comment @coderabbitai help to get the list of available commands and usage tips.

- context parallel slicing;
- tensor parallel vocabulary partitioning;
- optional all-gather-CP mode;
- temperature scaling with `args.rollout_temperature`;

@z1ying z1ying Jul 18, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could be replaced with:

  • Temperature scaling: the adapter divides logits by args.rollout_temperature before invoking the op. The RL-Kernel logp op is temperature-unaware and must not apply scaling itself; otherwise the parity comparison against Vime's native compute_log_probs would be made on differently-scaled logits.

contracts pass validation.
4. `rollout_ops` is blocked for selected-logprob recomputation until vLLM or
vllm-router exposes logits or an internal custom-op insertion point.
5. In non-strict mode, any import, shape, dtype, device, or backend failure logs

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Who implements this? get_op raises RuntimeError (registry.py:315) and shape errors raise at call time (pytorch/loss/logp.py:28) — nothing in RL-Kernel catches them, so shouldn't the doc say the adapter owns this try/except, not "RL-Kernel owns local fallback"?

fallback_or_raise(exc)
```

Do not import or initialize CUDA extensions on Vime's driver process unless the

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this import already violate the constraint below? registry.py:337 instantiates KernelRegistry() at import time, which calls torch.cuda.get_device_capability() (registry.py:255) → _lazy_init() → CUDA context on the driver process.

beta=...,
samples_per_prompt=...,
)
```

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This snippet no longer matches main: both NativeGRPOLossOp and TritonGRPOLossOp now take (policy_logits, ref_logits, action_ids, old_logps, rewards, completion_mask, ...) — logits-based via the fused ratio/KL op, not current_logps/ref_logps.

Two contract points worth capturing here:

  1. __call__/forward expect raw rewards and group-normalize internally, while L238 shows Vime supplies already-normalized batch["advantages"] — feeding those as rewards double-normalizes. Both ops expose apply(..., sample_advantages, ...) for precomputed advantages ("apply takes the per-sequence advantage vector directly", ops/triton/loss/grpo_loss.py:65-66); the doc should direct adapters there.
  2. The logits-based signature also changes the tensor contract below ([B, T] → logits are [B, T, V]), which affects the packing-adapter estimate.

| --- | --- | --- | --- |
| `logits` | `[N, V]` or reshapeable to that form | fp32/bf16 depending on backend | Must be contiguous for fused CUDA paths. |
| `token_ids` | `[N]` or same leading shape as `logits` | int64/int32 accepted by wrapper | Target token ids aligned to response logits. |
| output | `[N]` or original leading shape | fp32 preferred for comparison | One selected logprob per response token. |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"fp32 preferred" is worth pinning down: the default apply/__call__ entries return the input dtype (e.g. NativeLogpOp.apply uses output_dtype=logits.dtype); fp32 output requires calling apply_fp32 explicitly. Should the contract state that parity comparisons use apply_fp32? Relatedly, since this section motivates parity/drift testing, the separate logp_deterministic op type (batch-invariant, fp32 by design, registry.py:158-160) seems like the natural reference implementation to mention here.

@z1ying z1ying left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! I've left a few suggestions for clarification.

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