How rsoumyadeep/activerl_validation works
1. Project role and overall shape
- This is a Python research repo for validating ActiveRL sample-complexity theory.
- The architecture is organized as a pipeline: collect trajectories in an environment → estimate uncertainty/information gain → compute theoretical curves/bounds → compare against offline RL performance → generate plots/tables.
2. Experiment drivers are the orchestration entry points
- The experiments/ directory contains separate scripts for each study:
- scaling laws
- variance vs. information gain
- discount-factor ablation
- GP vs. ensemble comparison
- coverage ablation
- These scripts likely coordinate the full workflow for each paper figure/result, rather than containing core logic themselves.
3. Active data collection is one core subsystem
- src/active_collection/ contains the machinery for gathering data under an exploration strategy:
- initial_state_selector.py chooses starting states or reset conditions
- exploration_policy.py defines how the agent explores
- trajectory_collector.py executes rollouts and records trajectories
- This subsystem is the bridge between the environment and the rest of the analysis pipeline.
4. Environment adapters isolate the collection code from raw env details
- src/envs/wrappers.py suggests a boundary layer that normalizes environment behavior for the experiments.
- This likely handles state/action formatting, episode bookkeeping, or other environment-specific adjustments so the rest of the system can stay environment-agnostic.
5. Uncertainty estimation is a second major subsystem
- src/uncertainty/ provides two alternative uncertainty models:
- ensemble.py for ensemble-based uncertainty
- gp_proxy.py for a Gaussian-process-style proxy
- metrics.py for derived uncertainty statistics
- This layer turns collected experience into uncertainty signals used by theory validation and comparison experiments.
6. Theory and prediction logic are kept separate from data collection
- src/theory/ contains the mathematical side of the project:
- bounds.py for sample-complexity or performance bounds
- information_gain.py for theoretical information-gain calculations
- complexity_curve.py for predicted scaling behavior
- This separation makes the theory layer reusable across experiments and easy to compare against empirical results.
7. Offline RL baseline is isolated as its own module
- src/offline_rl/td3bc.py implements TD3+BC, the offline RL baseline used for evaluation.
- This is the main downstream consumer of collected data: trajectories produced by the active collection subsystem are used to train or evaluate the baseline.
8. Analysis is split from experiment execution
- The analysis/ directory contains post-processing scripts:
- plot_scaling.py
- plot_variance_sum.py
- tables.py
- These scripts consume experiment outputs and theory values to produce publication-style figures and tables, keeping visualization out of the core logic.
9. Configuration is centralized
- config/defaults.yaml appears to hold default experiment and model settings.
- This suggests the repo is meant to support repeated controlled runs across multiple ablations, with configuration driving behavior instead of hard-coded values.
10. Tests focus on the mathematical and uncertainty core
- tests/test_bounds.py, tests/test_ensemble.py, and tests/test_gp_proxy.py indicate that correctness checks are concentrated around the theoretical and uncertainty-estimation components.
- That fits the repo’s purpose: the most critical risk is not UI or integration, but whether the underlying theory and proxies are implemented correctly.
11. Likely data flow across the repository
- A typical run seems to move through these boundaries:
- environment wrapper sets up the task
- active collection gathers trajectories using an exploration policy
- uncertainty module computes ensemble/GP-based statistics
- theory module computes bounds or complexity predictions
- offline RL module provides empirical performance baselines
- analysis scripts compare the two and render plots/tables
12. Architectural takeaway
- The repo is organized as a research validation stack with clear separation between:
- interaction/data collection
- uncertainty estimation
- theory computation
- baseline RL training
- analysis/reporting
- That structure is well suited for reproducible experiments and for swapping uncertainty estimators or theoretical assumptions without rewriting the whole pipeline.
Main entry points: trajectory_collector.py Trajectory collector · exp1_scaling.py Scaling study · bounds.py Bounds · ensemble.py Ensemble
Components 21
Experiments
Study drivers that orchestrate end-to-end runs for different ablations and comparisons.
- Scaling study · Coordinates the scaling-law validation run.
experiments/exp1_scaling.py - Variance study · Drives the variance versus information-gain experiment.
experiments/exp2_variance_sum.py - Discount ablation · Runs discount-factor ablation experiments.
experiments/exp3_discount_ablation.py - GP vs ensemble · Compares Gaussian-process proxy and ensemble uncertainty.
experiments/exp4_gp_vs_ensemble.py - Coverage ablation · Runs coverage-focused ablation experiments.
experiments/exp5_coverage_ablation.py
Core pipeline
Main source modules for interaction, uncertainty, theory, and offline RL.
- Env wrappers · Normalizes environment behavior for data collection and experiments.
src/envs/wrappers.py - State selector · Chooses initial states or reset conditions for rollouts.
src/active_collection/initial_state_selector.py - Exploration policy · Defines how the agent explores during active data collection.
src/active_collection/exploration_policy.py - Trajectory collector · Executes rollouts and records trajectories from the environment.
src/active_collection/trajectory_collector.py - Ensemble · Computes ensemble-based uncertainty estimates.
src/uncertainty/ensemble.py - GP proxy · Provides a Gaussian-process-style uncertainty proxy.
src/uncertainty/gp_proxy.py - Uncertainty metrics · Derives summary statistics from uncertainty signals.
src/uncertainty/metrics.py - Bounds · Implements sample-complexity and performance bounds.
src/theory/bounds.py - Info gain · Computes theoretical information-gain quantities.
src/theory/information_gain.py - Scaling curve · Produces predicted complexity or scaling behavior.
src/theory/complexity_curve.py - TD3+BC · Offline RL baseline used to evaluate empirical performance.
src/offline_rl/td3bc.py
Analysis
Post-processing scripts that turn experiment outputs into plots and tables.
- Scaling plots · Generates figures for scaling-law results.
analysis/plot_scaling.py - Variance plots · Generates variance-sum comparison plots.
analysis/plot_variance_sum.py - Result tables · Builds publication-style tables from experiment outputs.
analysis/tables.py
Support
Central configuration and validation coverage for the research stack.
- Defaults · Central default settings for experiments and models.
config/defaults.yaml - Core tests · Covers bounds and uncertainty estimators.
Connections 31
- Scaling study → Env wrappers: uses · Scaling runs start from normalized environments.
- Scaling study → Trajectory collector: orchestrates · Coordinates active data collection for the study.
- Scaling study → Bounds: evaluates · Compares empirical results with theoretical bounds.
- Scaling study → Scaling curve: predicts · Uses predicted scaling behavior for comparison.
- Variance study → Ensemble: uses · Variance study consumes ensemble uncertainty.
- Variance study → Info gain: compares · Checks variance against theoretical information gain.
- Discount ablation → TD3+BC: evaluates · Tests downstream offline RL performance under different discounts.
- GP vs ensemble → GP proxy: compares · Benchmarks the GP proxy against the ensemble model.
- GP vs ensemble → Ensemble: compares · Benchmarks the ensemble against the GP proxy.
- Coverage ablation → Trajectory collector: orchestrates · Runs collection under coverage variations.
- Env wrappers → State selector: supports · Provides standardized environment resets for initial-state selection.
- State selector → Exploration policy: feeds · Selected starts shape the exploration rollout policy.
- Exploration policy → Trajectory collector: drives · Policy determines how trajectories are gathered.
- Trajectory collector → Ensemble: feeds · Collected trajectories provide data for ensemble uncertainty.
- Trajectory collector → GP proxy: feeds · Collected trajectories provide data for GP-style uncertainty.
- Ensemble → Uncertainty metrics: summarizes · Ensemble outputs are reduced to metrics.
- GP proxy → Uncertainty metrics: summarizes · GP proxy outputs are reduced to metrics.
- Uncertainty metrics → Info gain: informs · Empirical uncertainty metrics are compared to information-gain theory.
- Info gain → Bounds: supports · Information-gain calculations underpin bound derivations.
- Bounds → Scaling curve: constrains · Bounds shape predicted scaling curves.
- Trajectory collector → TD3+BC: trains · Collected data is reused by the offline RL baseline.
- TD3+BC → Result tables: reports · Baseline outcomes are summarized in tables.
- Bounds → Scaling plots: visualized by · Bound results are turned into scaling plots.
- Uncertainty metrics → Variance plots: visualized by · Variance summaries are turned into plots.
- Scaling plots → Result tables: complements · Plots and tables are produced from the same experiment outputs.
- Defaults → Scaling study: configures · Default settings parameterize experiment execution.
- Defaults → Variance study: configures · Default settings parameterize experiment execution.
- Defaults → GP vs ensemble: configures · Default settings parameterize experiment execution.
- Core tests → Bounds: covers · Tests validate the theory implementation.
- Core tests → Ensemble: covers · Tests validate the ensemble uncertainty implementation.
- Core tests → GP proxy: covers · Tests validate the GP proxy implementation.