Skip to content

Deep reinforcement learning and decision models · Method reference · DRL009 · Algorithm

Twin delayed DDPG (TD3)

Reduce actor–critic errors through twin critics, delayed actor updates, and smoothing of target actions. TD3 preserves a deterministic policy while changing several training mechanisms that make DDPG vulnerable to…

Explained here Component demo, not a trained model CodeSplash's run and the reference's record

In CodeSplash

Documented in the Academy only. There's no Set up button.

Availability
Explained here
Code example
Component demo, not a trained model
Who ran it
CodeSplash's run and the reference's record
CodeSplash's run
The reference's example ran in Python and R here, and they agree.
The reference's record
Python: Ran in the reference's review. The report doesn't record which version of the code ran. R: Reviewed but not run: R wasn't available to the reference's authors.

Purpose

Reduce actor–critic errors through twin critics, delayed actor updates, and smoothing of target actions. TD3 preserves a deterministic policy while changing several training mechanisms that make DDPG vulnerable to optimistic critic errors.

Question / hypotheses

Can less optimistic, smoother bootstrap targets improve continuous control? The method addresses approximation error, but neither a minimum of critics nor delayed updates creates a formal confidence bound on actual returns.

Architecture / computational structure

A deterministic actor and two independently parameterized critics have delayed target copies. Replay minibatches update both critics frequently; the actor and target networks update less often. Small clipped noise perturbs the next target action before critic evaluation, and action bounds are enforced.

Assumptions

Replay must cover useful state–action regions, critic inputs must use the correct action scale, and local target-action perturbations should have meaningful semantics. The two critics can share systematic errors despite separate parameters. Off-policy learning still depends on exploratory data collection.

Formula / computational definition

a~=clip⁡(μθˉ(s′)+clip⁡(ϵ,−c,c),amin⁡,amax⁡)\tilde a=\operatorname{clip}(\mu_{\bar\theta}(s^\prime)+\operatorname{clip}(\epsilon,-c,c),a_{\min},a_{\max}) and y=r+γ(1−d)min⁡i=1,2Qϕˉi(s′,a~)y=r+\gamma(1-d)\min_{i=1,2}Q_{\bar\phi_i}(s^\prime,\tilde a). Each critic fits this target; delayed actor steps maximize the first critic at current actor actions.

Parameters and notation

Learned weights are actor and twin critics, with target copies. Hyperparameters include policy delay, target-noise standard deviation and clip, actor/critic learning rates, target averaging, replay settings, discount, and exploration noise. Target smoothing noise and behavior exploration noise serve different purposes.

Fitting, fine-tuning, and adaptation

Transfer compatible actor/encoder weights, initialize or refit critics for changed dynamics or rewards, and synchronize target copies. Use fresh replay coverage before trusting aggressive actor gradients. Tune action-scale-dependent noise again on the new task and compare partial freezing with full updates.

How to use and calibrate

Measure return across seeds, critic disagreement, value bias when assessable, action saturation, and interaction efficiency. Ablate the minimum target, delay, and smoothing separately if explaining improvements. Compare at equal environment steps and record different numbers of optimizer updates.

Example application

Control bounded continuous actuators in a simulated system. The example forms clipped noisy target actions and a twin-critic minimum target; critic outputs are supplied, so it demonstrates the target mechanism rather than training a controller.

Interpretation / pitfalls

Watch out

The minimum can introduce underestimation, and correlated critics may fail together. Too much smoothing can erase narrow high-reward actions; too little may not regularize the target. TD3’s deterministic policy does not remove the need for explicit exploration or correct terminal handling.

Python and R code examples

Scope: computational component described in the application subsection; not a complete estimator, neural trainer, or environment loop. Dependencies/validation: Python with NumPy executed successfully; base R not executed. Targets and supplied network outputs are ordinary arrays here, so this does not validate automatic-differentiation boundaries.

Python and R

The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.

Python

Component demo, not a trained model — computational component described in the application subsection; not a complete estimator, neural trainer, or environment loop. · needs numpy

import numpy as np
target_action=np.array([.9,-.9]); noise=np.array([.4,-.3])
smoothed=np.clip(target_action+np.clip(noise,-.2,.2),-1,1)
q1=np.array([3.,2.]); q2=np.array([2.5,2.2]); reward=np.array([1.,0.])
target=reward+.99*np.minimum(q1,q2)
assert np.all(np.abs(smoothed)<=1); print(smoothed,target)
R

Component demo, not a trained model — computational component described in the application subsection; not a complete estimator, neural trainer, or environment loop.

target_action <- c(.9,-.9); noise <- c(.4,-.3)
smoothed <- pmin(pmax(target_action+pmin(pmax(noise,-.2),.2),-1),1)
q1 <- c(3,2); q2 <- c(2.5,2.2); reward <- c(1,0)
target <- reward+.99*pmin(q1,q2)
stopifnot(all(abs(smoothed)<=1)); print(smoothed); print(target)

Sources

From the CodeSplash reference, entry DRL009.