---
title: "Introducing Decision Transformers on Hugging Face 🤗"
description: "Decision Transformer, an offline reinforcement learning method that recasts RL as return-conditioned sequence modeling, is now part of the 🤗 transformers library, with nine pretrained checkpoints for Gym continuous-control tasks (Hopper, Walker2D, HalfCheetah)."
url: "https://swe.quest/articles/introducing-decision-transformers-on-hugging-face-53b9486d51c912ca"
canonical: "https://huggingface.co/blog/decision-transformers"
source: "Hugging Face"
published: "2022-03-28"
difficulty: "medium"
kind: "Announcement"
reading_minutes: 8
tags: ["machine-learning","python","open-source"]
---

# Introducing Decision Transformers on Hugging Face 🤗

A post on [Hugging Face](https://swe.quest/sources/hugging-face.md), published 2022-03-28, 8 min read, Announcement. Original: [https://huggingface.co/blog/decision-transformers](https://huggingface.co/blog/decision-transformers)

## Summary

Decision Transformer, an offline reinforcement learning method that recasts RL as return-conditioned sequence modeling, is now part of the 🤗 transformers library, with nine pretrained checkpoints for Gym continuous-control tasks (Hopper, Walker2D, HalfCheetah). Instead of fitting a value function, a GPT-2 model takes the last K timesteps of return-to-go, state and action tokens and autoregressively predicts actions that reach a desired return. Code covers loading the model, padding and masking a 20-step context window, normalizing states with the mean and standard deviation from each model card, and running an evaluation loop. Setting the target return directly controls how well the resulting policy performs.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Machine learning](https://swe.quest/tags/machine-learning.md) (AI & ML)
- [Python](https://swe.quest/tags/python.md) (Languages)
- [Open source](https://swe.quest/tags/open-source.md) (Engineering practices)

## Prerequisites

- reinforcement learning basics ([easy posts on Model training](https://swe.quest/tags/model-training.md?difficulty=easy))
- transformer models
- PyTorch

## Keywords

Decision Transformer, Hugging Face Transformers, GPT-2, OpenAI Gym, offline reinforcement learning, Hugging Face Hub

## Related posts

- [Train your first Decision Transformer](https://swe.quest/articles/train-your-first-decision-transformer-d9877713a380ce1a.md): Hugging Face · 2022-09-08 · Hard · 8 min read · Model training, Machine learning, Python
  Decision Transformers recast reinforcement learning as conditional sequence modeling: a GPT-2 model takes the last K timesteps of return-to-go, state and action tokens and autoregressively predicts actions that achieve a desired return.
- [Decision Models in Hugging Face](https://swe.quest/articles/decision-models-in-hugging-face-8e72d537e83c9634.md): Hugging Face · 2026-11-10 · Medium · 16 min read · LLMs, Machine learning, Inference & serving, Python
  Decision models take a state plus a set of typed questions with predefined answers and return structured decisions with probabilities instead of generating text, avoiding schema violations and autoregressive decoding overhead.
- [Jack of All Trades, Master of Some, a Multi-Purpose Transformer Agent](https://swe.quest/articles/jack-of-all-trades-master-of-some-a-multi-purpose-transformer-agent-eac8be04880a3ed1.md): Hugging Face · 2024-04-22 · Hard · 8 min read · Machine learning, Model training, AI agents
  JAT (Jack of All Trades) is an open reproduction of DeepMind's Gato: a single GPT-Neo-based Transformer trained by behavioral cloning on a new dataset of expert trajectories from Atari, BabyAI, Meta-World and MuJoCo, plus text and image-caption data.
- [Turning Database Grading into RL Rewards: Post-Training Agents with ThinkingBox](https://swe.quest/articles/turning-database-grading-into-rl-rewards-post-training-agents-with-thinkingbox-9126975f97c5fba4.md): Hugging Face · 2026-10-22 · Hard · 18 min read · Model training, AI agents, Evaluation, LLMs
  Executable checks on terminal database state, originally built to grade agents in ThinkingBox-Bench, double as binary RL rewards for post-training tool-using agents.
- [Together AI at ICML 2026: frontier research across the full stack](https://swe.quest/articles/together-ai-at-icml-2026-frontier-research-across-the-full-stack-7ba2ab06914581c4.md): Together AI · 2026-06-30 · Hard · 10 min read · Inference & serving, Model training, LLMs, AI agents, Evaluation
  Together AI's nine ICML 2026 papers span the AI stack from agents to GPU kernels, each with a headline result.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
