Papers › Offline Reinforcement Learning as One Big Sequence Modeling Problem

Offline Reinforcement Learning as One Big Sequence Modeling Problem

3 Jun 2021NeurIPS 2021 12arXiv:2106.02039archive 2025-07-28

Michael Janner, Qiyang Li, Sergey Levine

Reinforcement learning (RL) is typically concerned with estimating stationary policies or single-step models, leveraging the Markov property to factorize problems in time. However, we can also view RL as a generic sequence modeling problem, with the goal being to produce a sequence of actions that leads to a sequence of high rewards. Viewed in this way, it is tempting to consider whether high-capacity sequence prediction models that work well in other domains, such as natural-language processing, can also provide effective solutions to the RL problem. To this end, we explore how RL can be tackled with the tools of sequence modeling, using a Transformer architecture to model distributions over trajectories and repurposing beam search as a planning algorithm. Framing RL as sequence modeling problem simplifies a range of design decisions, allowing us to dispense with many of the components common in offline RL algorithms. We demonstrate the flexibility of this approach across long-horizon dynamics prediction, imitation learning, goal-conditioned RL, and offline RL. Further, we show that this approach can be combined with existing model-free algorithms to yield a state-of-the-art planner in sparse-reward, long-horizon tasks.

PaperPDFConference PDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2106.02039")

Code

Syntology Ran 3 of 28 code samples harvested from 2 repositories linked to this paper; 25 have no recorded run. Of those that ran: 1 ran · honoured contract; 1 ran · our draft was wrong; 1 ran with no contract checked.

By repository: official repository: 21 samples from 1 repository, 3 ran; community (archive-listed): 7 samples from 1 repository, 0 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

JannerM/trajectory-transformer officialmentioned in papermentioned on GitHubpytorchMIT report
howuhh/faster-trajectory-transformer mentioned on GitHubpytorchMIT report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

28 samples harvested; 3 ran; 1 honoured the contract we drafted; 25 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · honoured contract
1ran · our draft was wrong
1ran
25unverified

Licence: 0 of the 28 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 2 repositories linked to this paper, official or community; each sample names its own and says which. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

get_activation JannerM/trajectory-transformer/trajectory/models/mlp.py official repository ran MIT (permissive) · 308e4d2dcc2d67f2 · report
to_np JannerM/trajectory-transformer/trajectory/utils/arrays.py official repository ran · honoured contract MIT (permissive) · 0e8d8251e66ab160 · report
top_k_logits JannerM/trajectory-transformer/trajectory/search/sampling.py official repository ran · our draft was wrong fingerprinted MIT (permissive) · 0f0021cdea13e4da · report
add_stop_token JannerM/trajectory-transformer/trajectory/models/embeddings.py official repository unverified MIT (permissive) · f0bbd8cb02e1d63f · report
ant_preprocess_fn JannerM/trajectory-transformer/trajectory/datasets/preprocessing.py official repository unverified MIT (permissive) · 0164e9415395d715 · report
beam_plan JannerM/trajectory-transformer/trajectory/search/core.py official repository unverified MIT (permissive) · f3d303190e64c4e4 · report
beam_search JannerM/trajectory-transformer/trajectory/search/core.py official repository unverified MIT (permissive) · c6b3fddb40879156 · report
extract_actions JannerM/trajectory-transformer/trajectory/search/utils.py official repository unverified MIT (permissive) · 9c84ff02a4f59c05 · report
filter_cdf JannerM/trajectory-transformer/trajectory/search/sampling.py official repository unverified MIT (permissive) · c2129c72e2f07f7f · report
flatten JannerM/trajectory-transformer/trajectory/models/mlp.py official repository unverified MIT (permissive) · 12754b16911ecee4 · report
kitchen_preprocess_fn JannerM/trajectory-transformer/trajectory/datasets/preprocessing.py official repository unverified MIT (permissive) · d3a9e7f0b010aa47 · report
load_environment JannerM/trajectory-transformer/trajectory/datasets/d4rl.py official repository unverified MIT (permissive) · 8368faab224d9322 · report
make_prefix JannerM/trajectory-transformer/trajectory/search/utils.py official repository unverified MIT (permissive) · 6dafa63552e84e1c · report
make_weights JannerM/trajectory-transformer/trajectory/models/embeddings.py official repository unverified MIT (permissive) · 73db3cbbc056327e · report
normalize JannerM/trajectory-transformer/trajectory/utils/arrays.py official repository unverified MIT (permissive) · e256f0dfb18dd284 · report
qlearning_dataset_with_timeouts JannerM/trajectory-transformer/trajectory/datasets/d4rl.py official repository unverified MIT (permissive) · 47b8a48fc0f2ac80 · report
round_to_multiple JannerM/trajectory-transformer/trajectory/search/sampling.py official repository unverified MIT (permissive) · 35aa466eb16f5e15 · report
segment JannerM/trajectory-transformer/trajectory/datasets/sequence.py official repository unverified MIT (permissive) · 48bd963796baa6f4 · report
to_torch JannerM/trajectory-transformer/trajectory/utils/arrays.py official repository unverified MIT (permissive) · 429e141abcf66681 · report
update_context JannerM/trajectory-transformer/trajectory/search/utils.py official repository unverified MIT (permissive) · 6ba529c9388c1d12 · report
vmap JannerM/trajectory-transformer/trajectory/datasets/preprocessing.py official repository unverified MIT (permissive) · 3e098abac7794b97 · report
create_env howuhh/faster-trajectory-transformer/trajectory/utils/env.py community (archive-listed) unverified MIT (permissive) · 36bb7ea2ef4a54a3 · report
d4rl_dataset howuhh/faster-trajectory-transformer/trajectory/datasets/get_d4rl.py community (archive-listed) unverified MIT (permissive) · 730393eba4e1cb7a · report
join_trajectory howuhh/faster-trajectory-transformer/trajectory/datasets/d4rl_dataset.py community (archive-listed) unverified MIT (permissive) · 8fe2aea76aedd71b · report
round_to_multiple howuhh/faster-trajectory-transformer/trajectory/utils/common.py community (archive-listed) unverified MIT (permissive) · e58135c9c7b6ed0e · report
segment howuhh/faster-trajectory-transformer/trajectory/datasets/d4rl_dataset.py community (archive-listed) unverified MIT (permissive) · 53c137a7abd88735 · report
top_k_logits howuhh/faster-trajectory-transformer/trajectory/utils/common.py community (archive-listed) unverified MIT (permissive) · c7cbcd467cc49a53 · report
weight_decay_groups howuhh/faster-trajectory-transformer/trajectory/utils/common.py community (archive-listed) unverified MIT (permissive) · ae1cccd21623b2cc · report

Tasks

Imitation LearningOffline RLReinforcement LearningReinforcement Learning (RL)reinforcement-learning

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

Absolute Position EncodingsAdamAttentionBPEDense ConnectionsDropoutLabel SmoothingLayer NormalizationLinear LayerMulti-Head AttentionPosition-Wise Feed-Forward LayerResidual ConnectionSoftmaxTransformer

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections