---
title: "Jupyter Agents: training LLMs to reason with notebooks"
description: "Fine-tuning Qwen3-4B on 51k synthetic Jupyter notebook traces, combined with a minimal ~200-line two-tool scaffold (code execution plus final_answer), raised its DABStep easy-split accuracy from 38.67% to 75%."
url: "https://swe.quest/articles/jupyter-agents-training-llms-to-reason-with-notebooks-1236432acb183b7c"
canonical: "https://huggingface.co/blog/jupyter-agent-2"
source: "Hugging Face"
published: "2025-09-10"
difficulty: "hard"
kind: "Research"
reading_minutes: 14
tags: ["ai-agents","model-training","llms","evals","data-pipelines"]
---

# Jupyter Agents: training LLMs to reason with notebooks

A post on [Hugging Face](https://swe.quest/sources/hugging-face.md), published 2025-09-10, 14 min read, Research. Original: [https://huggingface.co/blog/jupyter-agent-2](https://huggingface.co/blog/jupyter-agent-2)

## Summary

Fine-tuning Qwen3-4B on 51k synthetic Jupyter notebook traces, combined with a minimal ~200-line two-tool scaffold (code execution plus final\_answer), raised its DABStep easy-split accuracy from 38.67% to 75%. The scaffold change alone accounted for roughly 14 points of that gain. The dataset pipeline starts from ~2TB of Kaggle notebooks and runs deduplication (~90% were duplicates), linked-dataset download, LLM educational scoring and relevance filtering, verified QA generation with Qwen3-32B, and trace generation with Qwen3-Coder-480B in E2B sandboxes. Training findings include using full-parameter SFT over PEFT, assistant-only loss, NEFTune noise, and about 5 epochs as the sweet spot.

Written by swe.quest, not by the author.

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

## Topics

- [AI agents](https://swe.quest/tags/ai-agents.md) (AI & ML)
- [Model training](https://swe.quest/tags/model-training.md) (AI & ML)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)
- [Evaluation](https://swe.quest/tags/evals.md) (AI & ML)
- [Data pipelines](https://swe.quest/tags/data-pipelines.md) (Data & databases)

## Prerequisites

- LLM fine-tuning (SFT) ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))
- tool calling in LLM agents ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))
- Jupyter notebooks

## Keywords

Jupyter Agent, DABStep, Qwen3-4B, Qwen3-Coder-480B, TRL, E2B, Datatrove, Kaggle

## Related posts

- [DSGym: A holistic framework for evaluating and training data science agents](https://swe.quest/articles/dsgym-a-holistic-framework-for-evaluating-and-training-data-science-agents-bae78ad698feea9c.md): Together AI · 2026-01-26 · Hard · 7 min read · Evaluation, AI agents, Model training, LLMs
  DSGym unifies data science agent benchmarks behind a single JSON task interface with containerized execution environments.
- [DaisyRose-27B: Pushing the Frontier of Post-Training Efficiency](https://swe.quest/articles/daisyrose-27b-pushing-the-frontier-of-post-training-efficiency-d0f8a1d5a44a14e8.md): Hugging Face · 2026-11-18 · Hard · 6 min read · Model training, AI agents, LLMs, Sandboxing & isolation, Evaluation
  DaisyRose-27B is an RL post-trained version of Qwen3.8-27B, trained with the Miles framework on about 1,200 curated long-horizon agent tasks over 18 days on 144 H200s.
- [CoderForge-Preview: SOTA open dataset for training efficient coding agents](https://swe.quest/articles/coderforge-preview-sota-open-dataset-for-training-efficient-coding-agents-83e1f3c7a7bdb67a.md): Together AI · 2026-02-25 · Hard · 14 min read · Model training, AI for coding, AI agents, Evaluation, LLMs
  CoderForge-Preview is an open dataset of 258K test-verified coding agent trajectories (155K passing) covering 51K tasks across 1,655 repositories from R2E-Gym, SWE-Smith and SWE-Rebench.
- [DeepMath: A lightweight math reasoning Agent with smolagents](https://swe.quest/articles/deepmath-a-lightweight-math-reasoning-agent-with-smolagents-e010b89eb984330e.md): Hugging Face · 2025-12-04 · Hard · 5 min read · Model training, AI agents, LLMs, Evaluation, Sandboxing & isolation
  DeepMath fine-tunes Qwen3-4B Thinking with GRPO so it emits short Python snippets for intermediate math steps, runs them in a sandbox (module allow-list, no file I/O or network, per-snippet timeouts), and feeds results back into its reasoning.
- [Turning Database Grading into RL Rewards: Post-Training Agents with ThinkingBox](https://swe.quest/articles/turning-database-grading-into-rl-rewards-post-training-agents-with-thinkingbox-9126975f97c5fba4.md): Hugging Face · 2026-10-22 · Hard · 18 min read · Model training, AI agents, Evaluation, LLMs
  Executable checks on terminal database state, originally built to grade agents in ThinkingBox-Bench, double as binary RL rewards for post-training tool-using agents.

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)
