| Objects and reward | |
|---|---|
| a finished object, such as a molecule or a grid cell; in MAP-Elites, a solution such as a robot's genome | |
| set of finished objects | |
| reward of the finished object , ; in MAP-Elites, the performance of solution , which may be negative (that paper writes ) | |
| , the normalizer of the target ; at a consistent flow it equals | |
| exponent on the reward in the molecule runs (an inverse temperature): sampling in proportion to concentrates on the top modes as grows | |
| Construction graph and flows | |
| a state: a partial object, reached from by a sequence of actions | |
| start state of every construction: the empty object | |
| an edge of the construction graph: one action turns state into state | |
| a path of states from to a finished object | |
| finished object at the end of the path | |
| number of distinct paths from that end at | |
| parents of state : the states with an edge into | |
| children of state : the states one action away from ; a finished object has none | |
| flow on the edge , a positive number (the paper writes with ) | |
| flow through , : reward plus outflow, equal to the inflow at a consistent flow | |
| flow policy, : from , move to child in proportion to the edge's flow | |
| probability that the flow policy passes through state ; at a consistent flow | |
| entropy of a distribution over paths, (Step 1) | |
| , the reward summed over paths instead of objects (Step 1) | |
| maximizer of the maximum-entropy objective of Step 1, on paths; is the probability it gives the object | |
| Training | |
| parameters of the network that predicts the edge flows | |
| edge flows predicted by the network, which outputs | |
| predicted flow into a state, | |
| reward plus predicted flow out of a state, | |
| flow-matching loss of a path, ; zero when every visited state is consistent | |
| MAP-Elites | |
| feature descriptor of solution : a vector of features the user chooses, such as a robot's height and weight (the paper writes for ) | |
| number of random solutions that start a MAP-Elites run | |
| number of iterations of a MAP-Elites run | |
| Constants | |
| constant in the log loss, set near the smallest reward (Step 3) | |
| reward floor of the grid task, the reward between the 16 modes; 0.1 to 0.001 | |
Context. A standard bandit or RL objective maximizes expected reward and puts all its probability on one answer. In molecule design, training usually relies on a cheap proxya fast stand-in for the real measurement, such as a docking simulation or a model fitted to past assays for a slow, expensive lab measurement, and candidates are tested in large batches. A batch of near copies of the proxy's favorite fails together if the proxy is wrong about that region. The batch therefore needs many distinct candidates that all score well. Bengio et al. (2021) and Mouret and Clune (2015) each change the objective to ask for that.
GFlowNetgenerative flow network: a policy that builds an object step by step, trained so that finished objects come out with probability proportional to their reward (Bengio et al., 2021) trains a policy to build an object one part at a time, drawing each finished object with probability proportional to its reward. An object with 90% of the top reward appears 90% as often as the best one; a reward maximizer almost never samples it. Many objects, such as molecules assembled from blocks, can be built in many orders. Maximum-entropy RL makes each construction path probable in proportion to its final reward. That weights each object by its reward times its number of paths, biasing the sampler toward larger molecules (Step 1).
GFlowNet avoids that bias by assigning a positive flow to every edge of the construction graph. It chooses those flows so that total inflow equals total outflow at every partial object, and equals the reward at every finished object. A policy that picks each outgoing edge in proportion to its flow then samples objects in proportion to reward, however many paths reach them (Step 2). Flow balance is a local condition at each state, so training penalizes the mismatch between inflow and outflow at visited states. Like temporal-difference learning, this consistency loss trains off-policy on paths from any sampler that reaches every state (Step 3).
MAP-Elitesmulti-dimensional archive of phenotypic elites: a search that keeps the best solution found in each cell of a grid over user-chosen features (Mouret and Clune, 2015) asks for variety along features the user names. It lays a grid over a few features, such as a robot's height and weight, and keeps the best solution found in each cell. A new solution competes only with the current occupant of its own cell, so a slow heavy robot is never discarded for losing to a fast light one. In the papers' experiments, both methods return varied, high-scoring candidates and match or beat single-objective search on the best solution. On molecules, GFlowNet's ten best candidates outscore PPO's, with both trained on powers of the proxy reward. On a retina task, MAP-Elites finds a better network than an evolutionary algorithma search that keeps a population of solutions and makes new ones by randomly mutating and recombining the better ones selecting on performance alone. On simulated soft robots, its best robot matches that performance-only search.
Setting. Write a finished object, such as a molecule for a finished object, the set of finished objects for the set of them, and the reward of ; positive for GFlowNet, which needs it as a flow and removes zero-reward objects by disallowing the actions that lead to them for its reward. Construction starts from the empty state the start of every construction: the empty object, with each action adding one part. Each state a partial object, reached from by some sequence of actions is a partial object, and an edge joins to when one action turns into . Because many action orders reach the same state, these states form a directed acyclic grapha graph whose edges have a direction and contain no cycle; here a tree only if every object has a single construction order (DAG) rather than a tree. Write a path of states from to a finished object, written for a path from to a finished object , and the number of distinct paths from to for the number of paths ending at . The target distribution samples with probability
Making each path probable in proportion to reward overweights objects with many paths. Maximum-entropy RL with terminal reward maximizes the expected log-reward plus the path entropy , the entropy of the path distribution over distributions on paths. In a deterministic environment, path entropy equals the expected sum of the policy's per-state entropies along the path, so soft Q-learningQ-learning for maximum-entropy RL: the max over next actions becomes , and the policy is proportional to (Haarnoja et al., 2017) and related maximum-entropy methods optimize this objective. Write and . Rewriting the objective givesso by Gibbs' inequality, with equality only when , is the unique maximizer. Summing over the paths that end at gives its sampling probability:Unfolding the graph into a tree of paths proves the same bias for a policy that picks each child in proportion to the summed reward of all continuations from it. Because the number of assembly orders grows rapidly with molecule size, these policies sample larger molecules exponentially more often than their reward warrants.
To remove that path-count factor, GFlowNet represents the sampler as a flow on the DAG. Assign a positive flow the flow on edge ; the paper writes with to every edge, and write the parents of : states with an edge into and the children of : states one action away from for a state's parents and children. Set at partial states; finished objects have no children. A flow is consistentinflow equals reward plus outflow at every state other than if total inflow equals reward plus total outflow at every state :At a partial state, inflow equals outflow; at a finished object, inflow equals . Write , the flow through ; equal to the inflow at a consistent flow, and to at a finished object for the right side, the total flow through . The flow policy: from , move to child with probability proportional to the edge's flow starts at and steps from to child with probability until it reaches a finished object. Since at partial states, these probabilities sum to 1 over the children.
A consistent flow samples each object in proportion to its reward. Write for the probability that the flow policy passes through , so . Because the graph has no cycles, a trajectory visits at most once. Arrivals from different parents are therefore disjoint events, so sums over . Suppose holds at every parent of ; consistency then gives the same formula at :Since the formula holds at and the graph is acyclic, induction covers every state. At a finished object , so . Every trajectory ends at one finished object, so these probabilities sum to 1 and . The path count never enters; only the total flow into matters, however parents split it. That split is not unique. If the graph consists solely of the two paths and , any positive flows with are consistent, so many flows induce the same sampler.
Matching log inflow to log outflow trains the flows from any sampler that reaches every state. A network with parameters outputs , keeping every predicted edge flow positive. Write , the predicted flow into for the predicted inflow to , and , the reward plus the predicted flow out of for its reward plus predicted outflow. A sampled path's loss sums the squared log mismatch over its states other than :Flows near sum over exponentially many objects, while flows near the end are single rewards. Raw differences would span many orders of magnitude; the log scale gives every state comparable weight. Adding a small positive constant added inside both logarithms, set close to the smallest reward, set near the smallest reward, keeps tiny flows out of the logarithm and weights errors more heavily at large flows, where the top modes sit.
The loss is zero exactly when every visited state is consistent, and each state's term ignores which policy generated the path. Like asynchronous dynamic programmingdynamic programming that updates states one at a time in any order; it converges as long as every state keeps being updated, training therefore works off-policy. Suppose the training paths come from a sampler with the same support as the flow policywhy: the loss constrains flows only on states the sampler visits, so an unvisited region can keep inconsistent flows and wrong probabilities, and the network can represent a consistent flowwhy: otherwise no parameter value reaches zero loss, and a minimizer trades errors between states. Because every edge flow is positive, that support visits every state. Every global minimizer of the expected loss is then consistent on the states the sampler reaches, so by Step 2 its flow policy samples with probability .
GFlowNet results. On a 4-dimensional grid with 16 separated modes, GFlowNet fits the target with far fewer samples than MCMC and finds every mode faster than PPO. Each object is a cell of a side-8 grid, built by raising one coordinate at a time. Reward equals a floor everywhere, plus higher values on small bands near the 16 corners. The grid is small enough to compute and measure the fit to directly. Across 10 runs per setting, GFlowNet reaches low error for every from 0.1 down to 0.001. Metropolis-Hastingsan MCMC method that proposes a move from to and, for a symmetric proposal, accepts it with probability , which makes its long-run distribution MCMC needs exponentially more samples for the same error, and as shrinks it takes far longer to visit every mode. PPO needs an entropy bonus of 0.5, far above usual values, to find all 16 modes in reasonable time. Even then, it finds them much more slowly than GFlowNet.
The gap between GFlowNet and MCMC comes from how each treats the low-reward floor between modes. A Metropolis-Hastings chain at a mode accepts a step onto the floor with probability only about , so shrinking traps it. The flow policy never weighs an intermediate floor state by its own reward. By Step 2, it visits state with probability . The flow through a floor state carries the summed rewards of every object built beyond it, so the policy crosses the floor as often as it ends at the modes on the far side.
| Method | Top 10 reward | Top 1,000 reward | Similarity |
|---|---|---|---|
| GFlowNet | 8.45 | 8.17 | 0.44 |
| MARS | 8.31 | 7.64 | 0.59 |
| PPO | 8.25 | 7.82 | 0.62 |
When the proxy is refitted to each new batch, varied batches find better candidates. GFlowNet is built for an active-learning loop. Each round fits a proxy to past data, trains the generator on a power of that proxy, scores a generated batch with the expensive measurement, and refits the proxy. Batches that stay near known modes teach the refitted proxy only about those regions. On the grid at , runs start from points covering 4 of the 16 modes and query 16 points per round. GFlowNet found 10 modes within 5 rounds, MCMC found 10 within 10 rounds, and PPO reached 8 by the end. On molecules, docking 200 candidates per round for 1,800 evaluations, GFlowNet's top 10 average 8.83 against 8.27 for MARS; PPO diverged in every attempt.
archive = {} # cell -> (solution, performance)
for it in range(I):
if it < G:
x = random_solution()
else:
cell = random.choice(list(archive.keys()))
x = mutate(archive[cell][0])
c = to_cell(features(x)) # bin each feature
p = performance(x)
if c not in archive or archive[c][1] < p:
archive[c] = (x, p)Mouret and Clune score a run's final map on four measures. Global performance is the run's single best score anywhere, divided by the best found by any run of any algorithm. Coverage is the share of fillable cells this run fills, counting a cell as fillable if at least one run of some algorithm reaches it. Precision divides the run's best score in each cell by the best any run found there, then averages over only the cells this run filled. Global reliabilitythe average, over every cell that any run of any algorithm filled, of the run's best performance in the cell divided by the best any run found there; an empty cell counts 0 takes the same average over all fillable cells, scoring empty cells as 0. An illumination algorithmthe paper's term for a search that returns the best solution at each point of a user-chosen feature space targets global reliability. A narrow optimizer can score high on global performance and precision by searching a few cells well, while scoring low on coverage and reliability.
On networks for a retina task, MAP-Elites beats every control on all four measures. A network sees an 8-pixel retina and decides whether an object appears on both its left and right halves. The two features are connection cost (the sum of squared connection lengths) and modularityNewman's : for the split of the nodes into groups that makes it largest, the fraction of connections that fall inside groups minus the fraction expected if connections were placed at random with each node's number of connections kept; high when nodes form groups densely connected inside and sparsely connected between (Leicht and Newman, 2008), binned on a 512 by 512 grid. Three controls get the same evaluation budget: an evolutionary algorithm selecting on performance alone, NS+LC, and random sampling. Each control is scored by the best solution it discovered in each cell. Over 20 runs each, every difference is significant (), with the gap much narrower on precision than on reliability. The authors attribute MAP-Elites' better best network to deception. Reaching the best networks requires passing through worse intermediate ones, which performance-only search discards. Ancestry supports this. Many high performers descend from a high-performing cell some distance away, and the full lineages of randomly chosen elites pass through many regions of the map. Solutions kept in other cells serve as stepping stones.
On simulated soft robots, MAP-Elites fills far more of the map at some cost in precision. Each robot is a 10 by 10 by 10 block of voxels, each empty or one of four materials including bone. Performance is distance covered in 10 simulated seconds, and the two features are the share of bone voxels and the share of filled voxels. Two controls compete against it: an evolutionary algorithm optimizing performance alone, and one that also rewards distance from other solutions in feature space. Against both, MAP-Elites achieves higher reliability and coverage (), and a higher median best performance that is not significantly different (). Its precision is lower (), which the authors note is likely because the controls spend all their evaluations on a few cells.
Consequences and limits. GFlowNet fits problems where candidates are built by a sequence of choices, a proxy scores any candidate cheaply, and the next step needs a batch covering high-scoring regions. After training, each new candidate costs one run of the policy from . Generating a batch therefore takes time linear in batch size, whereas pairwise comparison methods take at least quadratic time. In practice, raising to a power an exponent on the reward (an inverse temperature); sampling in proportion to concentrates on the top modes as grows before training concentrates samples on the top modes. Roughly, and not the paper's account, rewards in the bulk often differ by only a factor of two or three while bulk objects outnumber top objects by orders of magnitude. Under that imbalance, sampling directly in proportion to returns mostly middling candidates. MAP-Elites fits problems where the user can name the features along which variety matters and supply a mutation operator. It returns a finite archive mapping how the best achievable performance varies across those features, and cannot produce solutions outside the chosen grid.
Sampling in proportion to maximizes expected plus entropy over objects, by Step 1's identity applied to objects instead of paths. The KL-regularized objective used to fine-tune language models has the same optimum, with equal to the reference model's probability times the exponential of reward divided by the KL weight. A language model writes a given token sequence in exactly one order, so its construction graph over token sequences is a tree and the many-paths bias of Step 1 does not arise there. That bias arises when one object can be assembled in several orders, as graphs and sets can (the link is drawn here; the papers do not draw it).
Steps 1 to 3 prove the GFlowNet propositions, and the grid runs check them against an exact target. Every molecule result rests on a proxy reward. Like temporal-difference methods, the loss also bootstraps from its own flow estimates, and in the molecule runs the learned flows appear to underestimate the highest rewards (Technical notes). The MAP-Elites paper is a preliminary draft whose authors state the experiments will be redone; one method in one domain has only 5 finished runs.
Terms
- GFlowNet target
- sample with probability ; an object with half the top reward is drawn half as often
- Many-paths bias
- path-proportional sampling (maximum-entropy RL) gives , favoring objects with many construction orders
- Flow consistency
- at every state, inflow equals reward plus outflow; finished objects absorb flow
- Flow policy
- ; visits with probability , and
- Flow-matching loss
- squared log ratio of +inflow to +outflow at each visited state; trainable off-policy
- Non-uniqueness
- many consistent flows split the flow differently among parents and give the same sampler
- Molecule result
- trained toward , top 1,000 average 8.17 against 7.82 (PPO) and 7.64 (MARS), Tanimoto similarity 0.44 against 0.62 and 0.59
- Active learning
- refitting the proxy on each batch rewards varied batches: 10 grid modes in 5 rounds against 10 rounds for MCMC
- MAP-Elites rule
- pick a random elite, mutate, keep the child if its cell is empty or it beats the occupant
- Global reliability
- average over fillable cells of the run's best relative to the best known, 0 if empty
- Precision; coverage
- the same average over the run's filled cells; share of fillable cells filled
- Stepping stones
- elites in other cells lead to better solutions; lineages cross the map
Sources
- Emmanuel Bengio, Moksh Jain, Maksym Korablyov, Doina Precup, and Yoshua Bengio. Flow Network based Generative Models for Non-Iterative Diverse Candidate Generation. NeurIPS, 2021.
- Jean-Baptiste Mouret and Jeff Clune. Illuminating search spaces by mapping elites. arXiv preprint, 2015.
- E. A. Leicht and M. E. J. Newman. Community Structure in Directed Networks. Physical Review Letters, 2008.
- Joel Lehman and Kenneth O. Stanley. Evolving a diversity of virtual creatures through novelty search and local competition. GECCO, 2011.
- Jeff Clune, Jean-Baptiste Mouret, and Hod Lipson. The evolutionary origins of modularity. Proceedings of the Royal Society B, 2013.
- Tuomas Haarnoja, Haoran Tang, Pieter Abbeel, and Sergey Levine. Reinforcement Learning with Deep Energy-Based Policies. ICML, 2017.
- Yutong Xie, Chence Shi, Hao Zhou, Yuwei Yang, Weinan Zhang, Yong Yu, and Lei Li. MARS: Markov Molecular Sampling for Multi-objective Drug Discovery. ICLR, 2021.
Connected notes
- Direct preference optimizationLearning from human preferences · Exponential tilting
Without the KL term the best policy puts all its mass on one sequence; with it the target is , which puts mass on exactly the sequences the reference model gives mass to and moves toward the best sequences as falls.
- PPO and RLOO for language modelsReinforcement learning for reasoning · Feedback between a model and its data
Labelers were told to penalize inaccuracy but not copying, so summarization policies learned to copy whole sentences, and collecting labels on the current policy's samples during training mattered for summarization, where labelers preferred the online model 64% and 65% of the time.
- Dataset distillation via driftingDataset distillation · Aiming at many good answers
Classifier-confidence distillation collapses images onto typical prototypes and attraction-only drifting reduces to mean shift on density peaks (FID 177 against 8.5), while adding repulsion between synthetic views spreads ten images across each class and raises SigLIP2 coverage from under 10% to 77.0%.
- Nonvacuous PAC-Bayes boundsGeneralization bounds · Exponential tilting
In a PAC-Bayes bound the KL from posterior to prior is the complexity term, and a Gaussian prior centered at the initialization makes it grow with how precisely the weights are specified and how far they move in training.