Descriptor-conditioned MAP-Elites

DCG-MAP-Elites and DCRL-MAP-Elites learn a single actor that takes a target behavior descriptor as input. Both also build a QDpy archive of ordinary policies. The descriptor-conditioned critic guides gradient offspring toward higher return at the parent policy’s descriptor. DCRL additionally uses the conditioned actor to generate archive candidates for sampled targets.

Install the existing RL extra from a QDpy checkout.

python -m pip install -e '.[rl]'
# With uv in your active environment:
uv pip install -e '.[rl]'

Export a goal-directed actor

conditioned_policy() returns an independent copy of the trained actor. Request the goal in the same physical coordinates as the episode descriptor.

from qdpy.rl import DescriptorConditionedPolicy

search.conditioned_policy().save("tracking-conditioned.npz")
actor = DescriptorConditionedPolicy.load("tracking-conditioned.npz")

with Tracking() as env:
    observation, _ = env.reset(seed=100_011)
    goal = (0.5, -0.5)
    action = actor.act(observation, goal)
    fixed_policy = actor.specialize(goal)
    fixed_policy.save("tracking-fixed-goal.npz")

Specialization folds the normalized goal into the bias of the first affine layer and copies the remaining layers. It returns an ordinary ContinuousPolicy with the same flat genome layout as the archive. The requested goal expresses intent. Run the episode and measure its descriptor to see where the policy actually goes.

Where the two methods collect experience

Source

DCG replay target

DCRL replay target

Random initialization or Iso+LineDD offspring

Achieved episode descriptor

Achieved episode descriptor

Gradient offspring

Achieved episode descriptor

Parent’s measured descriptor

Conditioned actor

Noisy elite descriptor. The rollout supplies replay.

Uniformly sampled descriptor. The specialized policy competes for an archive cell.

DCG samples elites uniformly with replacement for its additional actor episodes. It adds Gaussian noise with standard deviation goal_noise in normalized units and clips the perturbed targets to the domain. These episodes spend stats.training_steps. DCRL samples goals uniformly over the full descriptor domain for injection. Injected policies spend stats.evaluation_steps, like other archive candidates. Each archive candidate competes by its measured descriptor and raw return by default. When evaluation_episodes exceeds one, QDpy averages the fitness and descriptor for placement while retaining each episode’s own replay label.

Replay stores the actual actions, raw step rewards, true successors, and both descriptors for each completed episode. The normalized descriptor transform maps the domain of each coordinate to [-1, 1]. When the learner samples a transition, it multiplies the raw reward by exp(-distance / length_scale), where distance is Euclidean in these normalized coordinates. The target critic and target actor also receive the requested descriptor. True terminations stop bootstrapping. Time-limit truncations bootstrap from their final observations.

A budget-cut episode consumes its actual steps and contributes to stats.unlabeled_steps. The buffer receives only episodes with observed labels. Rejected candidates’ completed episodes still enter replay. Unstarted proposals stay queued across training calls.

Reference profiles

DCG uses the archive and collection schedule in the 2023 paper, including the achieved replay target on gradient offspring and the extra actor evaluation batch. DCRL uses the parent target and the actor-injection schedule in the 2024 paper. The conditioned replay and inference code use per-coordinate normalization to [-1, 1] for both methods, as in the authors’ DCRL implementation. The pinned GECCO code divides descriptors by a single scale and samples active goals directly from the repertoire. QDpy uses the Gaussian perturbation in the 2023 text. Default and pilot network widths, optimizer budgets, and length scales are sized for CPU use. DCG paper · DCRL paper · Pinned authors’ implementation.

Tracking benchmark

The tracking task rewards velocity tracking and uses final position to place policies in an 8 by 8 grid. The benchmark gives each method 4,096 environment steps on seeds 11, 29, and 47. DCRL uses four genetic, two PG, and two injected policies per generation. The no-injection ablation reallocates the two injection slots to PG. DCG uses four genetic and four PG candidates plus eight replay-only actor episodes per generation. Both conditioned methods use 32 critic updates per generation, four actor steps per PG offspring, and a similarity length scale of 0.25.

python examples/continuous_qd_rl.py --steps 4096 --seeds 11 29 47 \
    --methods neural-map-elites pga-map-elites dcg-map-elites dcrl-map-elites dcrl-no-injection \
    --archive-audit --output-dir build/descriptor-rl/pilot

The held-out archive audit reevaluates each elite once against the same held-out target for its seed. It rebins by the measured descriptor and keeps the highest held-out return when elites land in the same cell. QD scores sum raw returns with a zero offset. The example reports the original and rebinned coverage, collisions, and QD scores. Each conditioned actor also attempts four fixed goals after export and reload. Goal error is the mean Euclidean distance between the requested and achieved positions over the four episodes. These held-out rollouts are separate from the search budget.

The 15 runs took 58 seconds on an Intel Xeon E5-2630 v4 with one Torch thread, including the archive audit and export. The environment used CPython 3.12, Gymnasium 1.4, and PyTorch 2.15+cpu.

Method

Occupied cells of 64

Held-out rebinned cells

Mean held-out goal error across seeds

Neural MAP-Elites

21–28

13–21

—

PGA-MAP-Elites

16–24

14–19

—

DCG-MAP-Elites

5–20

5–18

0.711–1.052

DCRL-MAP-Elites

20–34

19–27

0.524–0.843

DCRL without injection

10–30

9–24

0.727–1.222

DCG spent 2,048 of its 4,096 steps on 128 replay-only actor episodes. DCRL evaluated 62 injected candidates per seed within its archive budget. DCRL’s conditioned actor had lower mean goal error than the no-injection configuration on each of the three paired seeds. The training coverage difference varied by seed. Raw benchmark and held-out results.