{"licence":{"name":"CC BY-SA 4.0","spdx":"CC-BY-SA-4.0","url":"https://creativecommons.org/licenses/by-sa/4.0/","attribution":"Atlas, a bilingual technical dictionary (https://cmaintz.github.io/tech-atlas/)"},"id":"ai/rlhf","url":{"en":"https://cmaintz.github.io/tech-atlas/en/terms/ai/rlhf/","da":"https://cmaintz.github.io/tech-atlas/da/terms/ai/rlhf/"},"term":{"en":"Reinforcement learning from human feedback (RLHF)","da":"Forstærkningslæring fra menneskelig feedback (RLHF)"},"aka":{"en":["preference tuning"],"da":["præferencetræning"]},"domain":["ai"],"cluster":"training","layer":"training","status":"current","era":2017,"summary":{"en":"Improving a model by having people rank its answers, teaching a scorer from those rankings, then training the model to earn high scores.","da":"At forbedre en model ved at lade mennesker rangere dens svar, lære en bedømmer af rangeringerne og så træne modellen til at få høje scorer."},"body":{"formal":{"en":"A training method in which human raters compare pairs of model outputs, a separate reward model is fitted to predict their choices, and the main model is then tuned by reinforcement learning to produce outputs the reward model rates highly.","da":"En træningsmetode, hvor menneskelige bedømmere sammenligner par af modelsvar, en separat belønningsmodel tilpasses til at forudsige deres valg, og hovedmodellen derefter justeres med forstærkningslæring til at give svar, som belønningsmodellen vurderer højt."},"plain":{"en":"Like a comedian trying jokes on a test audience, noting which ones get laughs, and gradually shaping the act around what the crowd prefers.","da":"Som en komiker, der afprøver vittigheder på et prøvepublikum, noterer, hvilke der får grin, og gradvist former showet efter, hvad publikum foretrækker."},"inPractice":{"en":"Case officers from several municipalities compare pairs of answers from a citizen-service chat assistant to “How do I get a new health card?” and pick the clearer, correct one; thousands of such choices train the scorer that steers the assistant.","da":"Sagsbehandlere fra flere kommuner sammenligner par af svar fra en chatassistent til borgerservice på “Hvordan får jeg et nyt sundhedskort?” og vælger det klareste og korrekte; tusindvis af den slags valg træner den bedømmer, der styrer assistenten."},"whyItMatters":{"en":"It is a main tool for making models helpful and less harmful, but it rewards what raters like rather than what is true, which can teach flattery and confident-sounding errors.","da":"Det er et centralt værktøj til at gøre modeller hjælpsomme og mindre skadelige, men det belønner, hvad bedømmerne kan lide, snarere end hvad der er sandt, og kan lære modellen smiger og selvsikre fejl."}},"deepDive":{"en":"The canonical pipeline has three stages. First, a pretrained model is instruction-tuned on demonstrations (SFT). Second, human raters compare outputs for the same prompt and a reward model r(x, y), usually the SFT model with a scalar head, is fitted to their choices with a Bradley-Terry loss, −log σ(r(x, y_w) − r(x, y_l)), where y_w is the preferred and y_l the rejected answer. Third, the policy is optimised with reinforcement learning, classically PPO, to maximise r(x, y) − β·KL(π ‖ π_ref), where the KL penalty against the frozen SFT reference keeps the policy from drifting into text that exploits the reward model. The method was introduced for Atari and simulated robotics by Christiano et al. (2017), applied to summarisation by Stiennon et al. (2020) and made mainstream by InstructGPT (Ouyang et al., 2022), which used about 13,000 SFT prompts, 33,000 reward-model prompts with rankings of several outputs each, and 31,000 prompts for PPO; labellers preferred outputs of the 1.3-billion-parameter InstructGPT over those of the 175-billion-parameter GPT-3.\n\nPPO-based RLHF is operationally heavy: policy, reference model, reward model and a value (critic) model must all be held in memory, and training is sensitive to β, learning rate and reward normalisation. InstructGPT also mixed pretraining gradients into PPO (PPO-ptx) to reduce the regressions on public benchmarks that alignment otherwise caused.\n\nSeveral alternatives now share the label \"preference tuning\". Direct Preference Optimisation (Rafailov et al., 2023) shows that the KL-regularised objective has a closed-form optimum, so the policy can be trained directly on preference pairs with a classification-style loss and no explicit reward model or RL loop. RLAIF and Constitutional AI (Bai et al., 2022) replace most human comparisons with judgements by a model following written principles. GRPO (Shao et al., 2024) removes the value model by comparing each sample with the average of a group of samples for the same prompt, and is widely used with automatically verifiable rewards, such as passing unit tests or reaching a correct maths answer, to train reasoning models.\n\nThe failure modes follow from optimising a learned proxy. Gao et al. (2023) showed that as the policy moves further from its reference, the proxy reward keeps rising while the true (gold) reward peaks and then falls - reward over-optimisation, a form of Goodhart's law. Human preferences favour agreeable, confident and longer answers, and Sharma et al. (2023) linked such preference data to sycophancy. The GPT-4 technical report showed that the pre-trained model was well calibrated and that post-training reduced calibration. Rater instructions, rater demographics and disagreement are thus design decisions with ethical weight, not neutral data collection.","da":"Det klassiske forløb har tre trin. Først instruktionstilpasses en fortrænet model på eksempelsvar (SFT). Dernæst sammenligner menneskelige bedømmere output for samme prompt, og en belønningsmodel r(x, y), typisk SFT-modellen med et skalart output-hoved, tilpasses deres valg med et Bradley-Terry-tab, −log σ(r(x, y_w) − r(x, y_l)), hvor y_w er det foretrukne og y_l det fravalgte svar. Til sidst optimeres policyen med forstærkningslæring, klassisk PPO, til at maksimere r(x, y) − β·KL(π ‖ π_ref), hvor KL-straffen i forhold til den frosne SFT-reference forhindrer policyen i at glide over i tekst, der udnytter belønningsmodellen. Metoden blev introduceret til Atari og simuleret robotik af Christiano m.fl. (2017), anvendt på opsummering af Stiennon m.fl. (2020) og gjort udbredt af InstructGPT (Ouyang m.fl., 2022), der brugte omkring 13.000 SFT-prompts, 33.000 prompts til belønningsmodellen med rangering af flere svar hver og 31.000 prompts til PPO; bedømmerne foretrak svar fra InstructGPT med 1,3 milliarder parametre frem for GPT-3 med 175 milliarder.\n\nPPO-baseret RLHF er tungt at drive: policy, referencemodel, belønningsmodel og en værdimodel (critic) skal alle ligge i hukommelsen, og træningen er følsom over for β, læringsrate og normalisering af belønningen. InstructGPT blandede desuden fortræningsgradienter ind i PPO (PPO-ptx) for at mindske de tilbagefald på offentlige benchmarks, som alignment ellers gav.\n\nFlere alternativer deler nu betegnelsen præferencetræning. Direct Preference Optimisation (Rafailov m.fl., 2023) viser, at det KL-regulariserede mål har et lukket optimum, så policyen kan trænes direkte på præferencepar med et klassifikationslignende tab uden eksplicit belønningsmodel eller RL-løkke. RLAIF og Constitutional AI (Bai m.fl., 2022) erstatter de fleste menneskelige sammenligninger med vurderinger fra en model, der følger skrevne principper. GRPO (Shao m.fl., 2024) fjerner værdimodellen ved at sammenligne hvert svar med gennemsnittet af en gruppe svar på samme prompt og bruges bredt med automatisk verificerbare belønninger, som at bestå unittests eller nå et korrekt matematisk resultat, til at træne ræsonnerende modeller.\n\nFejlmønstrene følger af, at man optimerer mod en lært stedfortræder. Gao m.fl. (2023) viste, at når policyen bevæger sig længere væk fra referencen, bliver stedfortræderbelønningen ved med at stige, mens den sande (gold) belønning topper og derefter falder - overoptimering af belønningen, en form for Goodharts lov. Menneskelige præferencer favoriserer imødekommende, selvsikre og længere svar, og Sharma m.fl. (2023) forbandt den slags præferencedata med smiger (sycophancy). GPT-4's tekniske rapport viste, at den fortrænede model var velkalibreret, og at eftertræningen forringede kalibreringen. Bedømmernes instruktioner, sammensætning og uenighed er derfor designvalg med etisk vægt og ikke neutral dataindsamling."},"edges":[{"type":"requires","to":"ai/reinforcement-learning","confidence":"high","strength":"normal"},{"type":"requires","to":"ai/instruction-tuning","confidence":"high","strength":"normal"},{"type":"kind-of","to":"ai/fine-tuning","confidence":"high","strength":"normal"},{"type":"causes","to":"ai/hallucination","why":{"en":"Rewarding answers people prefer can favour confident-sounding replies over admitting uncertainty.","da":"At belønne svar, folk foretrækker, kan favorisere selvsikre svar frem for at indrømme usikkerhed."},"confidence":"medium","strength":"minor"}],"depth":4,"sources":[{"title":"Christiano et al. (2017), Deep Reinforcement Learning from Human Preferences","tier":"reference"},{"title":"Ouyang et al. (2022), Training language models to follow instructions with human feedback","tier":"reference"}],"draft":true}