rlx_rl/lib.rs
1// RLX — versatile ML compiler + runtime.
2// Copyright (C) 2026 Eugene Hauptmann, Nataliya Kosmyna.
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, version 3.
7//
8// This program is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11// GNU General Public License for more details.
12//
13// You should have received a copy of the GNU General Public License
14// along with this program. If not, see <https://www.gnu.org/licenses/>.
15// RLX — Flow Map Q-Guidance (arxiv:2605.12416).
16//
17// Design:
18// - MLP actor/critic in `rlx-ir` (not `rlx-flow` LLM builders).
19// - CPU execution via `rlx-runtime` + `rlx-autodiff` + `legalize_broadcast` before AD.
20// - No simulator bindings: implement [`env::RlEnv`] and push [`buffer::Transition`]s.
21// - Optional QGBS at eval: [`policy::EvalConfig`] over [`CompiledFlowMapAgent`].
22
23//! # rlx-rl
24//!
25//! Compiled flow-map policies and twin critics for offline-to-online RL on RLX.
26
27pub mod buffer;
28pub mod dataset;
29pub mod distillation;
30pub mod env;
31pub mod flow_curriculum;
32pub mod graph;
33pub mod guidance;
34pub mod policy;
35pub mod qgbs;
36pub mod spec;
37
38#[cfg(feature = "toy")]
39pub mod toy_goal;
40
41#[cfg(feature = "compile")]
42pub mod trainer;
43
44pub use buffer::{ReplayBuffer, Transition};
45pub use dataset::OfflineDataset;
46pub use env::RlEnv;
47pub use flow_curriculum::sample_r_t;
48pub use graph::{
49 ActorGraphBundle, CompiledFlowMapAgent, CompiledTwinCritic, CriticGraphBundle, ParamSlot,
50 WeightStore, build_actor_graphs, build_critic_graphs, init_actor_weights, init_critic_weights,
51};
52pub use guidance::{eta_effective, q_guided_project};
53pub use policy::{EvalConfig, sample_noise, select_action};
54pub use qgbs::{QgbsConfig, qgbs_select_action};
55pub use spec::{DistillationType, RlSpec};
56
57#[cfg(feature = "compile")]
58pub use trainer::FmqTrainer;