Expand description
LLM advantage and KL ops — forwarding re-exports from rlox-rl-ops.
The implementations live in rlox-rl-ops so that rlox-sandbox can depend
on that slim crate without pulling in all of rlox-core. Everything that
was previously defined here is still publicly accessible under the same
path (rlox_core::llm::ops::*, rlox_core::llm::ops::f32_ops::*, etc.)
so existing callers — including rlox-python PyO3 bindings — compile and
behave identically without any change.
The only item that remains defined here rather than re-exported is
DPOPair, which is a training-plane data container unrelated to advantage
estimation.
Modules§
Structs§
- DPOPair
- A DPO preference pair holding tokenized prompt, chosen, and rejected sequences.
Functions§
- compute_
batch_ group_ advantages - Batched GRPO group advantages: process all groups in a single call.
- compute_
batch_ token_ kl - Batched token-level KL divergence: process all sequences in a single call.
- compute_
batch_ token_ kl_ schulman - Batched token-level KL divergence using the Schulman (2020) estimator.
- compute_
group_ advantages - GRPO group advantage:
(reward - mean) / std. Returns zeros if std < 1e-8. - compute_
token_ kl - Token-level KL divergence:
sum(exp(log_p) * (log_p - log_q)). - compute_
token_ kl_ schulman - Token-level KL divergence using the Schulman (2020) estimator:
sum(exp(log_p - log_q) - (log_p - log_q) - 1).