---
title: "Building an RL theorem-proving workflow on Modal"
description: "AE Studio built a reinforcement-learning loop on Modal that trains an LLM to write Lean proofs, comparing Evolution Strategies (ES) against GRPO using Lean verification as the reward. vLLM generation runs on GPU workers fanned out with .map(), Lean verification runs in short-lived sandboxes so bad proofs can't crash the run, and model state is stored as a ~200-byte-per-iteration history of perturbation seeds and rewards that each worker replays onto base weights from a Volume."
url: "https://swe.quest/articles/building-an-rl-theorem-proving-workflow-on-modal-091b48c98bf6e356"
canonical: "https://modal.com/blog/building-an-rl-theorem-proving-workflow-on-modal"
source: "Modal"
published: "2026-04-29"
difficulty: "hard"
kind: "Case study"
reading_minutes: 10
tags: ["model-training","ml-platform","sandboxing","llms"]
---

# Building an RL theorem-proving workflow on Modal

A post on [Modal](https://swe.quest/sources/modal.md), published 2026-04-29, 10 min read, Case study. Original: [https://modal.com/blog/building-an-rl-theorem-proving-workflow-on-modal](https://modal.com/blog/building-an-rl-theorem-proving-workflow-on-modal)

## Summary

AE Studio built a reinforcement-learning loop on Modal that trains an LLM to write Lean proofs, comparing Evolution Strategies (ES) against GRPO using Lean verification as the reward. vLLM generation runs on GPU workers fanned out with .map(), Lean verification runs in short-lived sandboxes so bad proofs can't crash the run, and model state is stored as a ~200-byte-per-iteration history of perturbation seeds and rewards that each worker replays onto base weights from a Volume. ES matched or beat GRPO in several runs and looked sample efficient with limited data, though results varied and scaling remains unclear. The authors estimate the run cost about $122, with generation at 147s of a 538s iteration, but these figures are vendor-favorable estimates.

Written by swe.quest, not by the author.

**Difficulty:** Hard: written for specialists in the field

## Topics

- [Model training](https://swe.quest/tags/model-training.md) (AI & ML)
- [ML platforms](https://swe.quest/tags/ml-platform.md) (AI & ML)
- [Sandboxing & isolation](https://swe.quest/tags/sandboxing.md) (Security)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)

## Prerequisites

- reinforcement learning for LLMs ([easy posts on Model training](https://swe.quest/tags/model-training.md?difficulty=easy))
- GRPO
- Lean theorem prover basics
- PyTorch model parameters

## Keywords

Modal, Evolution Strategies, GRPO, Lean, vLLM, Kimina-Prover

## Related posts

- [Kimina-Prover: Applying Test-time RL Search on Large Formal Reasoning Models](https://swe.quest/articles/kimina-prover-applying-test-time-rl-search-on-large-formal-reasoning-models-321ecfd38f3146da.md): Hugging Face · 2025-07-10 · Hard · 38 min read · Model training, LLMs, Formal methods, Evaluation
  Kimina-Prover-72B, trained with the Kimi k1.5 RL pipeline on Qwen2.5-72B, reaches a 92.2% pass rate on miniF2F-test for Lean 4 theorem proving by combining a lemma-enabled RL pattern, a recursive Test-Time RL search over candidate lemmas, and learned error-fixing from Lean feedback.
- [Kimina-Prover-RL](https://swe.quest/articles/kimina-prover-rl-3205962549f99099.md): Hugging Face · 2025-08-14 · Hard · 8 min read · Model training, LLMs, Formal methods, Evaluation
  Kimina-Prover-RL is an open-source GRPO training pipeline, released as a recipe in a fork of verl, that teaches small LLMs to prove Lean 4 theorems using a think-then-code output format.
- [Reinforcement learning is an infrastructure problem](https://swe.quest/articles/reinforcement-learning-is-an-infrastructure-problem-5f300edd7294912f.md): Modal · 2026-06-01 · Medium · 10 min read · Model training, LLMs, Hardware, Open source
  RL post-training of LLMs is bottlenecked by infrastructure rather than algorithms: training engines, rollout inference and isolated environments must all scale together, and once training goes multi-node, trainer-to-rollout weight sync dominates.
- [Advancing science & engineering with Antigravity’s /teamwork](https://swe.quest/articles/advancing-science-engineering-with-antigravity-s-teamwork-0e40d692e8fc9ab5.md): Google Research · 2026-11-13 · Easy · 14 min read · AI agents, LLMs, Formal methods, Algorithms
  Antigravity's /teamwork multi-agent harness pairs parallel exploration with independent falsifiers (Lean 4, unmodified test suites, simulators, hardware counters) and partitions context so each agent sees only the files and tools it needs, with critics and auditors verifying results from clean contexts.
- [StackLLaMA: A hands-on guide to train LLaMA with RLHF](https://swe.quest/articles/stackllama-a-hands-on-guide-to-train-llama-with-rlhf-9d42cc2a0ae4620b.md): Hugging Face · 2023-04-05 · Hard · 14 min read · Model training, LLMs, Machine learning, Python
  A 7B LLaMA model is trained to answer Stack Exchange questions with the full RLHF pipeline: supervised fine-tuning on packed Stack Exchange text, a pairwise reward model trained on upvote-derived preference scores, and PPO with a KL penalty against a frozen reference model.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
