# Gradient polityki (REINFORCE)

EN: **Policy gradient methods (REINFORCE)** · id `policygradient`

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) › Gradient polityki (REINFORCE)

## Description

- PL: Bezpośrednie poprawianie parametrów polityki w kierunku akcji, które dały wyższą nagrodę. Proste i ogólne, ale wymaga wielu prób.
- EN: Directly adjusting policy parameters towards actions that led to higher reward. Simple and general, but sample-hungry.

## In one sentence

- PL: To poprawianie sposobu wybierania działań, żeby częściej prowadziły do lepszego wyniku.
- EN: This improves how actions are chosen so they more often lead to better outcomes.

## Problem it solves

- PL: Masz ocenę całej próby, ale potrzebujesz powiązać ją z wyborami, które program wykonał po drodze.
- EN: You have a score for a whole trial but need to relate it to choices the program made along the way.

## What it does

- PL: Zwiększa szanse wyborów powiązanych z lepszym wynikiem i zmniejsza szanse gorszych, aktualizując wyuczone ustawienia na podstawie prób.
- EN: It raises the chances of choices associated with better outcomes and lowers worse ones, updating learned settings from trials.

## Everyday example

- PL: W symulatorze robot próbuje różnych ruchów ramienia, a udane przeniesienie przedmiotu wpływa na przyszłe wybieranie podobnych ruchów.
- EN: In a simulator, a robot tries different arm movements, and successfully moving an object influences future selection of similar actions.

## This concerns you if you…

- PL: chcesz bezpośrednio uczyć sposób wybierania działań
- PL: możesz przeprowadzać próby i oceniać ich wyniki
- EN: want to learn action selection directly
- EN: can run trials and score their outcomes

## Keywords

score-function estimator · likelihood-ratio gradient · reward baseline · advantage estimation · variance reduction

## How it works

- PL: Gradient logarytmu prawdopodobieństwa wykonanych akcji waży się osiągniętym zwrotem lub przewagą. Uśrednianie po trajektoriach daje estymator zmiany parametrów zwiększającej oczekiwaną nagrodę.
- EN: The gradient of selected actions' log probabilities is weighted by return or advantage. Averaging over trajectories estimates parameter changes that increase expected reward.

## Limits

- PL: Estymator ma dużą wariancję, szczególnie przy długich trajektoriach. Potrzebne są liczne interakcje i redukcja wariancji; próbkowanie z innej polityki wymaga odpowiedniej korekty.
- EN: The estimator has high variance, especially on long trajectories. Many interactions and variance reduction are needed; sampling from another policy requires suitable correction.

## Key terms

- PL: **przewaga**: Ocena działania względem typowego wyniku dostępnego w danym stanie.
- PL: **baseline**: Punkt odniesienia zmniejszający wariancję estymatora gradientu.
- EN: **advantage**: An action's value relative to the typical outcome available in that state.
- EN: **baseline**: A reference value reducing gradient-estimator variance.

## Know first

- [Proces decyzyjny Markowa (MDP) (Markov decision processes (MDP))](https://aiatlasgraph.com/t/mdp.md)
- [Rachunek różniczkowy i gradienty (Calculus and gradients)](https://aiatlasgraph.com/t/calculus.md)

## Examples

- PL: REINFORCE · baseline · funkcja przewagi (advantage) · on-policy
- EN: REINFORCE · baseline · advantage function · on-policy

## Sources

- [Berkeley CS185/285 · Deep Reinforcement Learning (2026)](<https://rail.eecs.berkeley.edu/deeprlcourse/>) `rl` · reference: Uczenie przez wzmacnianie, imitacja, sterowanie i RL dla LLM.
- [OpenAI Spinning Up — Part 2: Kinds of RL Algorithms](<https://spinningup.openai.com/en/latest/spinningup/rl_intro2.html>) `spinningup-rl-taxonomy` · by Joshua Achiam / OpenAI
- [Hugging Face Deep Reinforcement Learning Course — unit list](<https://huggingface.co/learn/deep-rl-course/unit0/introduction>) `hf-deep-rl-course` · by Hugging Face

---

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