Deep dive on proximal policy optimization (PPO) in RL


In today's newsletter:

  • The strategy layer most AI engineers never see.
  • Deep dive on proximal policy optimization (PPO) in RL, with code.
  • [RECAP] 7 LLM generation parameters.

TODAY'S ISSUE

AI STRATEGY BLUEPRINT BOOK

​The strategy layer most AI engineers never see​

95% of enterprise AI projects fail to deliver, and the technology is rarely the problem.

Governance gaps, an inability to justify ROI to finance, and deployment patterns that weren’t built for regulated environments are where things break down.

The AI Strategy Blueprint distills seven years of Fortune 500 and government AI deployments into a book practitioners can actually follow:

  • The 10-20-70 rule for AI investment
  • Governance frameworks that accelerate adoption
  • ROI methods that hold up under CFO scrutiny
  • Deployment patterns for regulated and air-gapped environments
  • A maturity roadmap from crawl to scale
  • Case studies from deployments that shipped

Through our partnership with Iternal Technologies, DailyDoseofDS readers can claim the full book for FREE (PDF or Kindle).

The offer is only valid for the next 72 hours.

​Grab your free copy here before time ends →​

AI ENGINEERING

​Deep dive on proximal policy optimization (PPO) in RL​

Part 8 of the Reinforcement Learning course is available now.

It covers PPO, the algorithm that laid the foundation for everything we are seeing right now in LLM alignment and modern RL. RLHF for ChatGPT was built on PPO.

GRPO, DPO, and every major alternative that followed were designed in direct response to it.

​You can read Part 8 of the course here →​

It covers:

  • Why large policy updates can cause irreversible collapse
  • How trust regions keep updates safe
  • The clipped surrogate objective
  • How the full PPO algorithm works
  • The KL-penalty variant used in LLM alignment like PPO
  • Practical diagnostics for spotting unhealthy training runs
  • A from-scratch implementation trained on LunarLander
  • How PPO connects to RLHF for language models

Everything is covered from scratch, so no RL background is required.

​You can read Part 8 of the course here →​


Why care?

PPO is the algorithm that started the current era of LLM alignment.

When OpenAI first aligned language models with human preferences, the RL algorithm underneath was PPO.

Every major alternative that came after was designed with PPO as the reference point.

  • DPO was introduced specifically to avoid the complexity of running PPO’s RL loop.
  • GRPO modified the advantage estimation to remove the need for a learned critic.
  • Constitutional AI restructured the reward signal but kept the same trust-region optimization underneath.

You cannot fully understand any of these methods without understanding the algorithm they are all responding to.

Beyond language models, PPO remains the go-to algorithm across robotics, game-playing, and agentic systems.

It earned that position by being simple enough to implement in a few hundred lines of PyTorch and robust enough to handle a remarkably wide range of problems with minimal tuning.

This chapter is also the convergence point of the series. Every idea we have covered so far (value functions, policy gradients, actor-critic, GAE) comes together here into one working system.

Here’s what we have covered so far:

Just like the MLOps course, each chapter will clearly explain necessary concepts, provide examples, diagrams, and implementations.

👉 Over to you: What topics would you like us to cover in this RL series?

LLMs

​7 LLM generation parameters​

Every generation from an LLM is shaped by parameters under the hood.

Knowing how to tune is important so that you can produce sharp and more controlled outputs.

Here are the 7 levers that matter most:

1) Max tokens

  • This is a hard cap on how many tokens the model can generate in one response.
  • Too low → truncated outputs; too high → could lead to wasted compute.

2) Temperature (covered in detail here):

  • Governs randomness. Low temperature (~0) makes the model deterministic.
  • Higher temperature (0.7–1.0) boosts creativity, diversity, but also noise.
  • Use case: lower for QA/chatbots, higher for brainstorming/creative tasks.

3) Top-k:

  • The default way to generate the next token is to sample from all tokens, proportional to their probability.
  • This parameter restricts sampling to the top k most probable tokens.
  • Example: k=5 → model only considers 5 most likely next tokens during sampling.
  • Helps enforce focus, but overly small k may give repetitive outputs.

4) Top-p (nucleus sampling):

  • Instead of picking from all tokens or top k tokens, model samples from a probability mass up to p.
  • Example: top_p=0.9 → only the smallest set of tokens covering 90% probability are considered.
  • More adaptive than top_k, useful when balancing coherence with diversity.

5) Frequency penalty:

  • Reduces likelihood of reusing tokens that have already appeared frequently.
  • Positive values discourage repetition, negative values exaggerate it.
  • Useful for summarization (avoid redundancy) or poetry (intentional repetition).

6) Presence penalty

  • Encourages the model to bring in new tokens not yet seen in the text.
  • Higher values push for novelty, lower values make the model stick to known patterns.
  • Handy for exploratory generation where diversity of ideas is valued.

7) Stop sequences

  • Custom list of tokens that immediately halt generation.
  • Critical in structured outputs (e.g., JSON), preventing spillover text.
  • Let's you enforce strict response boundaries without heavy prompt engineering.

👉 Over to you: What other LLM generation params have we missed?

THAT'S A WRAP

NO-FLUFF RESOURCES TO...

​Succeed in AI Engineering roles​

All businesses care about impact. That’s it!

  • Can you reduce costs?
  • Drive revenue?
  • Can you scale ML models?
  • Predict trends before they happen?

We have discussed several other topics (with implementations) in the past that align with such topics.

Here are some of them:

All these resources will help you cultivate key skills that businesses and companies care about the most.

​

Today’s email was brought to you by Avi Chawla and Akshay Pachaar.

​Update your profile | Unsubscribe​

Looking for more? Unlock our premium DS/ML resources.

© 2026 Daily Dose of Data Science

Daily Dose of Data Science

Daily no-fluff issues that help you succeed and stay relevant in DS/ML roles.

Read more from Daily Dose of Data Science

Master Full-stack AI Engineering In today's newsletter: Build voice agents that hear the details. RAG vs. Jev + RAG, clearly explained! 5 vector DB indexing strategies. TODAY'S ISSUE SPEECH AI Build voice agents that hear the details Speechmatics Linden is a speech-to-text model built specifically for voice agents. It focuses on the inputs that tend to cause expensive mistakes: strong accents, background noise, non-native speech, names, and alphanumeric strings such as booking references....

Master Full-stack AI Engineering In today's newsletter: How to build your own AI company (100% local). A cheaper model does not imply a cheaper turn. The anatomy of a Claude prompt. What do AI companies think about Agent Harness? TODAY'S ISSUE OPEN-SOURCE How to build your own AI company (100% local) Multi-agent orchestration is not new. Plenty of frameworks already let agents hand off tasks, run in parallel, and talk to each other. So the key question is not whether agents can collaborate...

Master Full-stack AI Engineering In today's newsletter: The operating system for AI research labs! Why agent crashes are nothing like database crashes. [Hands-on] Deploy a Qwen 3 Agentic RAG. TODAY'S ISSUE OPEN-SOURCE The operating system for AI research labs! Transformer Lab is an open-source ML platform that orchestrates GPUs across any cloud and runs any training or eval workflow you define: supports LoRA, QLoRA, DPO, ORPO, SIMPO use it from a GUI, CLI, or agent skill. works with MLX,...