# Uczenie z celami i odtwarzanie z perspektywy czasu (HER)

EN: **Goal-conditioned RL and hindsight experience replay** · id `goalconditioned` · aliases: goal-conditioned RL, goal-conditioned reinforcement learning, hindsight experience replay, HER, universal value function approximators, UVFA, uczenie warunkowane celem

Path: [AI Atlas](https://aiatlasgraph.com/llms.txt) › [Uczenie ze wzmocnieniem i decyzje](https://aiatlasgraph.com/t/decisions.md) › [Algorytmy RL](https://aiatlasgraph.com/t/rlalgorithms.md) › Uczenie z celami i odtwarzanie z perspektywy czasu (HER)

## Description

- PL: Jedna polityka uczona dla wielu celów naraz, z celem podawanym jako dodatkowe wejście. Odtwarzanie z perspektywy czasu przepisuje nieudane próby tak, jakby celem było to, co faktycznie osiągnięto, co pozwala uczyć się przy nagrodzie tylko za sukces.
- EN: One policy trained for many goals at once, with the goal given as an extra input. Hindsight replay relabels failed attempts as if the goal had been whatever was actually reached, enabling learning from success-only rewards.

## In one sentence

- PL: To uczenie jednego programu wielu celów naraz, także na próbach, które nie trafiły tam, gdzie miały.
- EN: This teaches one program many goals at once, including from attempts that missed where they were aimed.

## Problem it solves

- PL: Gdy punkt jest tylko za pełny sukces, początkujący program prawie nigdy go nie zdobywa i nie ma z czego się uczyć.
- EN: When points come only for full success, a beginner program almost never earns them and has nothing to learn from.

## What it does

- PL: Jak rzut lotką obok tarczy: zamiast uznać go za porażkę, zapamiętujesz, jak trafić dokładnie w to miejsce, gdzie lotka wbiła się w ścianę.
- EN: Like a dart that misses the board: instead of writing it off, you remember how to hit exactly the spot where it landed on the wall.

## Everyday example

- PL: Ramię robota ma przesunąć kubek na zaznaczone miejsce; gdy przesunie go gdzie indziej, ta próba i tak uczy, jak dostawić kubek właśnie tam.
- EN: A robot arm must push a mug to a marked spot; when it pushes it somewhere else, that attempt still teaches how to place the mug right there.

## This concerns you if you…

- PL: uczysz program zadań, w których sukces zdarza się bardzo rzadko
- PL: chcesz, by jeden program wykonywał wiele podobnych poleceń z różnym celem
- PL: pracujesz z ramieniem robota lub nawigacją do wskazanego miejsca
- EN: teach software tasks where success is very rare
- EN: want one program to carry out many similar commands with different targets
- EN: work with a robot arm or navigation to a chosen spot

## Keywords

hindsight experience replay · universal value function approximators · goal relabeling · sparse rewards · DDPG · off-policy RL · FetchPush · multi-goal RL

## How it works

- PL: Polityka i funkcja wartości przyjmują stan oraz cel (uniwersalne aproksymatory funkcji wartości). Odtwarzanie z perspektywy czasu zapisuje każde przejście w buforze z pierwotnym celem oraz z celami podstawionymi – w najprostszej wersji ze stanem końcowym epizodu, w najlepszej w eksperymentach z kilkoma stanami osiągniętymi później w tym samym epizodzie – i przelicza dla nich binarną nagrodę. Działa z dowolnym algorytmem off-policy, bo cel wpływa na działania agenta, ale nie na dynamikę środowiska.
- EN: The policy and value function take both the state and the goal (universal value function approximators). Hindsight replay stores each transition in the buffer with the original goal and with substituted goals – in the simplest version the episode's final state, in the best-performing one several states reached later in the same episode – recomputing the binary reward for them. It works with any off-policy algorithm, because the goal influences the agent's actions but not the environment dynamics.

## Limits

- PL: Zakłada, że dla każdego stanu łatwo wskazać cel, który on spełnia, i przeliczyć nagrodę dla nowego celu. Zbyt wiele podstawionych celów na przejście pogarsza wyniki, bo w buforze zostaje mało zwykłych danych. W oryginalnych eksperymentach zadanie podnoszenia wymagało startu części epizodów od stanu z chwyconym klockiem, a proste kształtowanie nagrody pogarszało wyniki zamiast pomagać.
- EN: It assumes that for every state one can easily name a goal it satisfies and recompute the reward for a new goal. Too many substituted goals per transition hurt results, because little ordinary data remains in the buffer. In the original experiments the pick-and-place task needed some episodes to start from a state with the box already grasped, and simple reward shaping made results worse rather than better.

## Key terms

- PL: **przepisywanie celu**: Zapisanie przejścia z celem zastąpionym stanem faktycznie osiągniętym w tym epizodzie.
- PL: **strategia przyszłych celów**: Podstawianie kilku stanów osiągniętych później w tym samym epizodzie; najlepsza w oryginalnych eksperymentach.
- PL: **nagroda binarna**: Sygnał mówiący tylko, czy cel osiągnięto.
- EN: **goal relabelling**: Storing a transition with the goal replaced by a state actually reached in that episode.
- EN: **future strategy**: Substituting several states reached later in the same episode; best in the original experiments.
- EN: **binary reward**: A signal saying only whether the goal was reached.

## Know first

- [Q-learning i głębokie sieci Q (DQN) (Q-learning and deep Q-networks (DQN))](https://aiatlasgraph.com/t/qlearning.md)
- [Projektowanie i kształtowanie nagrody (Reward design and reward shaping)](https://aiatlasgraph.com/t/rewarddesign.md)

## Examples

- PL: odtwarzanie z perspektywy czasu · funkcje wartości warunkowane celem · zadania pchania i podnoszenia
- EN: hindsight experience replay · goal-conditioned value functions · push and pick-and-place tasks

## Related topics

Untyped, symmetric "see also" links.

- [Bufor doświadczeń i priorytetowe odtwarzanie (Experience replay and prioritised replay)](https://aiatlasgraph.com/t/experiencereplay.md)
- [Manipulacja przedmiotami (Robotic manipulation)](https://aiatlasgraph.com/t/manipulation.md)
- [Projektowanie i kształtowanie nagrody (Reward design and reward shaping)](https://aiatlasgraph.com/t/rewarddesign.md)

## Sources

- [Hindsight Experience Replay](<https://papers.nips.cc/paper_files/paper/2017/file/453fadbd8a1a3af50a9df4df899537b5-Paper.pdf>) `her-2017` · by M. Andrychowicz, F. Wolski, A. Ray, J. Schneider, R. Fong, P. Welinder, B. McGrew, J. Tobin, P. Abbeel, W. Zaremba

---

AI Atlas revision 122 (2026-10-30) · HTML: https://aiatlasgraph.com/t/goalconditioned · index: https://aiatlasgraph.com/llms.txt · everything: https://aiatlasgraph.com/llms-full.txt · updated 2026-10-30
