---
title: Anticipated Reweighted TBPTT (ARTBP)
url: https://www.emergentmind.com/topics/anticipated-reweighted-tbptt-artbp
type: topic
---

# Anticipated Reweighted TBPTT (ARTBP)

Anticipated Reweighted Truncated Backpropagation (ARTBP) is an algorithm for gradient estimation in recurrent computational graphs that preserves the computational and memory efficiency of Truncated Backpropagation Through Time (truncated BPTT) while restoring unbiasedness to the gradient estimates. ARTBP is designed to address the inherent bias present in truncated BPTT—particularly its inability to capture long-term dependencies in sequence modeling—by randomizing truncation lengths and applying carefully chosen compensation factors that ensure unbiased stochastic gradients. This allows ARTBP to come with standard stochastic gradient convergence guarantees while maintaining scalable resource requirements [1705.08209].

## 1. Motivation and Historical Context

Backpropagation Through Time (BPTT) is the canonical method to compute exact gradients in recurrent models by unrolling the computation graph over all timesteps, requiring $O(T)$ activations for a length-$T$ sequence and $O(T)$ compute per update. The high cost of BPTT is addressed in practice by truncated BPTT, which computes gradients over fixed-length blocks of size $L \ll T$, carrying forward the hidden state but truncating the backward dependencies at block boundaries. However, truncation introduces bias by omitting contributions from losses more than $L$ timesteps in the future. This destroys the guarantees offered by unbiased stochastic gradient methods and can lead to divergence, particularly when long-term dependencies significantly impact the loss [1705.08209].

ARTBP was introduced by Tallec & Ollivier to eliminate this bias while maintaining tractable memory and computation scaling, exploiting randomized truncation and importance weighting to unbiasedly estimate gradients.

## 2. Algorithmic Structure and Theoretical Foundation

ARTBP replaces fixed-length truncations with a random process: at each timestep $t$, a Bernoulli variable $X_t$ determines whether to truncate between $t$ and $t+1$. The (possibly conditional) truncation probability is $c_t = \Pr[X_t=1 \mid X_{1:t-1}]$. The waiting time between cuts is sampled from a distribution with prescribed mean $L_0$ and optional power-law tail, e.g.,
$$
c_t = \frac{\alpha - 1}{(\alpha - 2)L_0 + (t - \tau_t)}, \quad \alpha > 3
$$
where $\tau_t$ is the most recent previous truncation.

To preserve unbiasedness, every time the backward flow of gradients is preserved across a non-truncated timestep, the message is amplified by a factor $1/(1 - c_t)$. The modified ARTBP recurrence is:
$$
\tilde\ell_t = 
\begin{cases}
  \dfrac{\partial \ell}{\partial s}(s_t) & \text{if } X_t=1 \text{ or } t=T \\
  \frac{1}{1 - c_t} \, \tilde\ell_{t+1} \, \frac{\partial F}{\partial s}(x_{t+1}, s_t, \theta) + \frac{\partial \ell}{\partial s}(s_t) & \text{if } X_t = 0
\end{cases}
$$
The resulting parameter gradient estimator is
$$
\tilde{g} = \sum_{t=1}^T \tilde\ell_t \frac{\partial F}{\partial\theta}(x_t, s_{t-1}, \theta)
$$

Backward induction shows that this estimator is unbiased: $\mathbb{E}[\tilde g] = \nabla_\theta \mathcal{L}_T$. This is a direct consequence of an importance sampling logic over the possible paths determined by the random truncation [1705.08209].

## 3. Practical Implementation and Pseudocode

In a concrete implementation, gradients are computed over random-length segments with memory and compute cost proportional to the average segment length $L_0$. The backward accumulator at each timestep uses the compensation factors $m_t$ as follows:
$$
\tilde\ell_t = \frac{\partial\ell}{\partial s}(s_t) + m_t \tilde\ell_{t+1} \frac{\partial F}{\partial s}(x_{t+1}, s_t, \theta)
$$
with 
$$
m_t = 
\begin{cases}
0 & X_t=1 \\
\frac{1}{1 - c_t} & X_t=0 \text{ and } t<T \\
0 & t=T
\end{cases}
$$

**ARTBP pseudocode (from [1705.08209]):**
```python
Algorithm: ARTBP (one pass over sequence of length T)
Input:  parameters θ, inputs x₁:T, targets o₁:T
        truncation probabilities c₁:T
Output: unbiased estimate ẑ of ∂ℒ_T/∂θ

1. Forward pass: compute states s₀=initial, then for t=1..T
    s_t ← F(x_t, s_{t-1}; θ)
    ℓ_t^out ← ∂ℓ/∂s (s_t, o_t)
2. Initialize backward accumulator:
    ẽ_{T+1} ← 0
3. For t = T downto 1:
    Sample X_t ∼ Bernoulli(c_t)
    if X_t = 1 or t=T:
       m_t ← 0
    else:
       m_t ← 1/(1 - c_t)
    end if
    ẽ_t ← ℓ_t^out + m_t ⋅ [ẽ_{t+1} ⋅ ∂F/∂s (x_{t+1},s_t; θ)]
    ẑ ← ẑ + ẽ_t ⋅ ∂F/∂θ (x_t, s_{t-1}; θ)
end for
Return ẑ
```
Only the buffer for the current random segment is required, matching the efficiency profile of truncated BPTT with mean segment length $L_0$.

## 4. Computational Properties and Trade-offs

ARTBP offers time per step and memory requirements proportional to those of truncated BPTT using block size $L_0$. The additional cost is a single multiplication by $1/(1 - c_t)$ per backward step. Storage is required only for the activations and Jacobians within the current segment. The variance of the estimated gradient increases as $L_0$ decreases, since compensation factors can become large for long surviving backward messages. Larger average segment lengths reduce variance but increase computational cost and memory.

There is a tunable trade-off between memory/compute and estimation variance, controlled by $L_0$ and the tail parameter $\alpha$ of the cut distribution. This allows ARTBP to interpolate between truncated BPTT and standard BPTT, with precise quantitative control [1705.08209].

## 5. Convergence Guarantees and Theoretical Properties

Because its gradient estimates are unbiased under any truncation probability schedule $\{c_t\}$, ARTBP inherits convergence properties from standard stochastic gradient methods. Under classical assumptions of Lipschitz continuity and smoothness for the loss and model, ARTBP’s iterates converge almost surely to stationary points of the objective. No adversarial bias can accumulate across updates, in contrast to truncated BPTT, which is subject to persistent bias and is susceptible to divergence even in convex problems [1705.08209].

## 6. Empirical Results and Benchmarks

Empirical evaluation in [1705.08209] demonstrates the efficacy of ARTBP in two distinct tasks:

- **Synthetic Influence Balancing Task**: In a linear chain of $p + n$ agents with state diffusion, loss is measured as $\frac{1}{2}(s_t^1-1)^2$. This task is chosen so that correct balancing of long- and short-term influences is required. Truncated BPTT with $L=10, 100, 200$ diverges unless $L$ exceeds the true dependency length by a substantial margin. ARTBP, with $L_0=16, \alpha=6$, converges in all trials, highlighting practical robustness.

- **Penn Treebank Character-Level Language Modeling**: On a single-layer LSTM (batch size 64), truncated BPTT (fixed $L=50$) and ARTBP (mean $L_0=50$, $\alpha=4$) are compared. Using Adam at learning rate $10^{-4}$, ARTBP achieves lower validation and test bits-per-character (≈1.40 bpc) than truncated BPTT (≈1.43 bpc), with similar training performance. This confirms the utility of unbiased estimation in capturing longer-range dependencies relevant for sequence modeling.

The following table summarizes key empirical configurations and results:

| Task                                   | Truncation (BPTT/ARTBP)              | Validation/Test Metric      |
|-----------------------------------------|---------------------------------------|----------------------------|
| Influence Balancing (synthetic)         | BPTT: $L=10,100,200$; ARTBP: $L_0=16$ | BPTT: divergence; ARTBP: convergence |
| Penn Treebank (character LSTM)          | BPTT: $L=50$; ARTBP: $L_0=50$         | BPTT: ≈1.43 bpc; ARTBP: ≈1.40 bpc   |

## 7. Related Methods and Future Directions

ARTBP occupies an intermediate position between full BPTT and fully-online methods such as UORO and NoBackTrack. It achieves unbiasedness via randomized truncation and importance weighting, requiring $O(L_0)$ memory—less than BPTT but more than fully online methods, and introduces no additional noise beyond that arising from the compensation factors.

Potential extensions include adaptive truncation schedules based on gradient norms, integration with variance reduction strategies such as control variates, or non-uniform sampling to emphasize long-range dependencies. Tuning the tail-parameter $\alpha$ or the sequence $\{c_t\}$ allows practitioners to customize the method to the memory and variance budget appropriate for their application [1705.08209].

A plausible implication is that ARTBP offers a tractable pathway to deploying unbiased stochastic gradient learning in settings with severe sequence length or memory constraints, without forfeiting theoretical soundness or suffering systematic estimation bias.

Source: https://www.emergentmind.com/topics/anticipated-reweighted-tbptt-artbp