# allenai/RL4LMs

A modular RL library to fine-tune language models to human preferences

Repository: https://github.com/allenai/RL4LMs
Canonical: https://ross.abutalabs.com/products/rl4lms
Homepage: https://rl4lms.apps.allenai.org/
Language: Python
License: Apache-2.0
License Family: permissive
Topics: language-modeling, nlp, reinforcement-learning, dialogue-generation, machine-translation, natural-language-processing, summarization, table-to-text, text-generation
Last push: 2024-03-01T14:03:46+00:00

## Health v2 (maintenance only)
Score: 32/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 0, release rhythm 35, longevity 100
- inputs: {"age_days": 1476, "days_push": 915, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2394, forks 201 (observed 2026-08-28T04:06:43.467608+00:00)

## What it is
RL4LMs is a modular Python library from AllenAI for fine-tuning language models with reinforcement learning to align with human preferences. It provides customizable building blocks including on-policy algorithms (PPO, A2C, TRPO, NLPO), reward functions, NLG metrics, datasets, and actor-critic policies for causal and seq2seq LMs.

## Use cases
- fine-tune language models with reinforcement learning
- train LMs to optimize reward functions like ROUGE or sentiment scores
- run RLHF-style training on summarization or translation tasks
- benchmark on-policy RL algorithms on NLP generation tasks
- apply PPO or NLPO to GPT-2 or T5 models
- optimize text generation models on custom datasets

## When to choose
- you want to fine-tune causal or seq2seq LMs with RL algorithms like PPO or NLPO
- you need a library of NLG metrics usable as reward functions
- you want a tested, benchmarked framework for RL-based text generation experiments

## When to avoid
- you need modern large-scale RLHF infrastructure for instruction-tuned chat models
- you only need supervised fine-tuning without reinforcement learning
- you require active development and support for the latest LLM architectures

## Facets
- artifact type: library
- maturity: maintenance
- function: machine-learning, reinforcement-learning, llm-training, nlp, benchmarking
- domain: reinforcement-learning, machine-learning, large-language-models
- platform: python
- tags: rlhf, text-generation, ppo, nlpо, reward-functions, fine-tuning, human-preferences, actor-critic, natural-language-processing

## Member repositories
- allenai/RL4LMs (main) score 32

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:06:43.467608+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T02:34:24.014706+00:00, confidence not recorded.
  - readme: https://github.com/allenai/RL4LMs (fetched 2026-08-28T04:06:43.467608+00:00, sha 3eb52c0cc897)
- Data as of 2026-08-30T08:39:29.467469+00:00.
