---
title: Batch-Constrained Action Set for Offline RL
url: https://www.emergentmind.com/topics/batch-constrained-action-set
type: topic
---

# Batch-Constrained Action Set for Offline RL

A batch-constrained action set refers to the set of available actions that a learning agent—typically in the context of offline or batch reinforcement learning (RL)—can consider at any decision point, where this set is explicitly restricted to actions that are well-supported (i.e., confidently observed) in a fixed batch of logged data. This restriction is critical for stabilizing policy learning and mitigating extrapolation error when it is not possible to collect new interaction data, such as in pure offline learning scenarios or regulatory-constrained domains.

## 1. Formal Definitions and Construction

Let $\mathcal{B}$ denote a fixed batch of historical transition tuples $(s, a, r, s')$ generated by an unknown or suboptimal behavior policy $\pi_b$. The batch-constrained action set is constructed by fitting a state-conditioned behavioral cloning model to approximate the behavior policy using maximum-likelihood estimation or cross-entropy minimization:
\[
p_{\mathcal{M}}(a|s; \omega) \approx \pi_b(a|s)
\]
with loss
\[
\mathcal{L}_\omega = -\mathbb{E}_{(s,a)\sim\mathcal{B}} [ \log p_{\mathcal{M}}(a|s;\omega) ]
\]
For each state $s$, the batch-constrained action set is defined as:
\[
A_{bc}(s) = \{ a \in \mathcal{A} : p_{\mathcal{M}}(a|s) > \beta \}
\]
where $\beta$ is a user-specified probability threshold. Only actions with sufficiently high support in $\mathcal{B}$ (i.e., likely under the learned behavioral model) are permitted for policy improvement and evaluation [2012.08984].

In alternative implementations, such as in the discrete-action version of Batch-Constrained Q-learning (BCQ), the action set is defined relative to the behavioral model’s mode:
\[
A_\tau(s) = \{ a \in \mathcal{A} : G_\theta(a|s) / \max_{a'} G_\theta(a'|s) > \tau \}
\]
with $\tau \in [0,1]$ controlling the strictness of the constraint [1910.01708].

## 2. Algorithmic Integration in Offline RL

Batch-constrained action sets are integrated into RL algorithms by replacing standard unconstrained policy improvement steps with constrained maximizations. For instance, BCD4Rec (Batch-Constrained Distributional RL for Session-based Recommendation) performs Double-DQN-style updates, but the Q-value maximization in the Bellman update is restricted to $A_{bc}(s')$:
\[
a' = \arg\max_{a' \in A_{bc}(s')} \frac{1}{K} \sum_{i=1}^K Q_\theta^{\tau_i}(s',a')
\]
with the distributional Bellman loss evaluated as
\[
\mathcal{L}_{BCD}(\theta) = \frac{1}{K^2} \mathbb{E}_{(s,a,r,s') \sim \mathcal{B}} \Bigg[ \sum_{i=1}^K \sum_{j=1}^K l_{\tau_i}\big(r+\gamma Q_{\theta'}^{\tau_j}(s',a')-Q_{\theta}^{\tau_i}(s,a)\big) \Bigg]
\]
where $a'$ is chosen according to the batch-constrained action set [2012.08984].

In BCQ–Discrete for Atari, Q-learning updates use:
\[
(T_\tau Q)(s, a) = r + \gamma \max_{a' \in A_\tau(s')} Q(s', a')
\]
thus ensuring that only state–action pairs supported by $\mathcal{B}$ are considered during temporal-difference backups [1910.01708].

## 3. Extrapolation Error and Theoretical Motivation

A central motivation for batch-constrained action sets is the mitigation of extrapolation (out-of-distribution) error in offline RL. In standard Q-learning, Bellman updates can involve bootstrapping through state–action pairs $(s',a')$ never observed in the batch, for which $Q$ is unconstrained and may become arbitrarily large. This leads to error accumulation and unstable policies.

Restricting backups to $a' \in A_{bc}(s')$ guarantees that every $(s',a')$ in the update is observed with significant frequency (or probability) in $\mathcal{B}$. Empirically, this approach prevents value blowup and results in:
- High fidelity to observed data distributions
- Reduction in popularity bias and spurious generalization
- Substantially higher click-through and buy rates in SR, or improved performance on standard batch RL benchmarks (Atari) [2012.08984, 1910.01708]

BCQ–Discrete achieves game scores 2–3× higher than unconstrained DQN or QR-DQN and maintains value estimates within realistic ranges, matching or exceeding behavioral policy scores within a few million gradient steps [1910.01708].

## 4. Empirical and Algorithmic Results

Empirical validation demonstrates that batch-constrained action sets dramatically improve learning outcomes in purely offline regimes:
- BCD4Rec achieves >95% accuracy in recommending items from correct latent categories and reduces the influence of popularity bias in session-based recommendation [2012.08984].
- BCQ–Discrete on Atari delivers stable learning curves and consistently outperforms all non-constrained batch RL baselines.
- The policy improvement constraint is essential for reproducing these effects; unconstrained or weakly-constrained methods suffer from overestimation and degraded final performance [1910.01708].

Pseudocode for the core update within BCD4Rec and BCQ–Discrete follows a consistent pattern: sample a minibatch from $\mathcal{B}$, construct the constrained set $A_{bc}(s')$, select actions within this set, and update all parameters via gradient descent with cross-entropy or quantile-regression objectives.

## 5. Generalizations and Other Problem Settings

The batch-constrained action set principle generalizes across RL and bandit domains. In high-dimensional sparse linear contextual bandits with batch constraints, the family of feasible action-selection mappings $\pi_b$ is restricted to policies that may only adapt at predefined batch boundaries. The regret lower bound under a $B$-batch constraint quantifies how the frequency of allowable action-selection updates $B$ impacts achievable performance:
\[
E[R_T] \gtrsim \max \left\{ B^{-4} 2^{-7B/2} \sqrt{Ts} \cdot (T/s)^{1/[2(2^B-1)]}, \sqrt{Ts} \right\}
\]
A greedy LASSO-based algorithm achieves this minimax rate with only $O(\log\log(T/s))$ batch updates, demonstrating that periodic retraining with batch-constrained action sets suffices for minimax regret [2008.11918].

The batch-constrained approach is applied in:
- Offline robotics, constraining policy updates to trajectories supported by log data
- Healthcare, restricting candidate treatments to those seen in observational records
- Broad recommendation, dialog, personalized education, and related settings

For continuous action spaces or when the density of state–action coverage varies, the constraint may be formulated via divergences, e.g.,
\[
KL[\pi(\cdot|s)\Vert p_{\mathcal{M}}(\cdot|s)] \leq \epsilon
\]
or by rejection sampling to ensure sufficient overlap with batch support [2012.08984].

## 6. Summary Table of Batch-Constrained Action Set Approaches

| Domain/Algorithm     | Action Set Construction           | Constraint Criterion         |
|----------------------|----------------------------------|-----------------------------|
| BCD4Rec (SR, RL)     | $A_{bc}(s) = \{a: p_{\mathcal{M}}(a|s)\!>\!\beta\}$            | Behavioral clone threshold  |
| BCQ-Discrete (Atari) | $A_\tau(s) = \{a: G_\theta(a|s) / \max G_\theta(\cdot|s)\!>\!\tau\}$ | Relative mode threshold     |
| Batch Bandits (LBGL) | $\pi_b$: mapping fixed at batch, updated at boundaries     | Batched adaptation limits   |

This table illustrates that, across various algorithmic instantiations, the batch-constrained action set is always defined in relation to support in a historical batch, with constraints enforced at action selection or policy update time.

## 7. Implications and Limitations

While no general formal convergence guarantees are provided in [2012.08984], analogous results in BCQ indicate that Bellman updates restricted to the batch support collapse the algorithm to a fixed point bounded by the representational power of the batch, providing a theoretical limit on extrapolation error. Batch-constrained action sets thus form a key methodological advance for high-stakes, offline, or resource-constrained settings where out-of-distribution action selection poses fundamental risks. 

A plausible implication is that, as batch RL continues to expand to new domains, the explicit design and verification of the batch-constrained action set will become a core consideration for safe, robust offline policy learning.

Source: https://www.emergentmind.com/topics/batch-constrained-action-set