Skip to main content

rlox_rl_ops/
lib.rs

1//! Estimator-agnostic advantage and token-KL ops for rlox.
2//!
3//! This crate has no dependency on `rlox-core` (no environment physics, replay
4//! buffers, or GAE).  It is intentionally slim so that `rlox-sandbox` can depend
5//! on it without pulling in the entire training data-plane.
6//!
7//! # Public API
8//!
9//! - [`error::RlOpsError`] — the single error type for this crate.
10//! - [`estimator::AdvantageEstimator`] — pluggable trait for advantage algorithms.
11//! - [`grpo::GroupRelativeEstimator`] — GRPO implementation (z-score normalisation).
12//! - [`kl`] — token-level KL ops (exact + Schulman 2020, f32 + f64 sub-modules).
13//!
14//! The f64 KL functions are re-exported at crate root via `kl::*`.
15
16pub mod error;
17pub mod estimator;
18pub mod grpo;
19pub mod kl;
20
21// Flatten the top-level API: re-export the most commonly used items.
22pub use error::RlOpsError;
23pub use estimator::AdvantageEstimator;
24pub use grpo::GroupRelativeEstimator;
25// Re-export all f64 kl functions at crate root for ergonomic access.
26pub use kl::*;