MarkTechPost AIAI工具與產品

Training Gemma-3 for Structured Mathematical Reasoning with Tunix GRPO, LoRA Adapters, and GSM8K Rewards

2026年7月6日 04:26

重點摘要

In this tutorial, we build an end-to-end GRPO training workflow that teaches Gemma-3 to reason through GSM8K math problems using Tunix, JAX, LoRA, and custom reward functions.

站內 AI 整理稿

In this tutorial, we build an end-to-end GRPO training workflow that teaches Gemma-3 to reason through GSM8K math problems using Tunix, JAX, LoRA, and custom reward functions. We start by preparing the environment, authenticating with Hugging Face, loading the Gemma-3 model, and wrapping GSM8K examples into a prompt format that requires both structured reasoning and a final numeric answer. We then define reward functions that assess format adherence and mathematical correctness, attach LoRA adapters to keep training lightweight, evaluate the baseline model, and run GRPO to improve the policy via group-sampled generations. It provides a reinforcement learning tutorial in which we train only the adapter weights while keeping the workflow compact enough for a single-accelerator setup. Installing Tunix and Configuring GRPO Training Copy CodeCopiedUse a different Browserimport importlib. util, os, shutil as _sh if importlib. find_spec("tunix") is None: print("Installing Tunix + JAX ecosystem — this takes ~5-8 min。 ") %pip install -q ipywidgets tensorboardX transformers grain nest_asyncio %pip install -q datasets huggingface_hub "numpy>2" %pip install -q tensorflow tensorflow_datasets %pip install -q git+https://github. com/jax-ml/jax %pip install -q git+https://github.

Related

相關文章

Fable 5被網友薅出省錢神招,最高減70%

賬號設置我的關注我的收藏申請的報道退出登錄登錄搜索36氪Auto數字時氪未來消費智能湧現未來城市啟動Power on36氪出海36氪研究院潮生TIDE36氪企服點評36氪財經職場bonus36碳後浪研究所暗湧Waves硬氪氪睿研究院媒體品牌企業號企服點評36Kr研究院36Kr創新諮詢企業服務核心服務城市之窗政府服務創投發佈LP源計劃VClubVClub投資機。

剛剛

Vibe Coding誤燒55萬元token,他靠嘲笑聲反手賺了7個億

賬號設置我的關注我的收藏申請的報道退出登錄登錄搜索36氪Auto數字時氪未來消費智能湧現未來城市啟動Power on36氪出海36氪研究院潮生TIDE36氪企服點評36氪財經職場bonus36碳後浪研究所暗湧Waves硬氪氪睿研究院媒體品牌企業號企服點評36Kr研究院36Kr創新諮詢企業服務核心服務城市之窗政府服務創投發佈LP源計劃VClubVClub投資機。

剛剛

我用了三個Co-work,只有Marvis轉正為“高級實習生”了

我們要根據給定的新聞標題和可用資料來重寫文章。標題是「我用了三個Co-work,只有Marvis轉正為“高級實習生”了」,可用資料只有一句「時間準了,批量順了,但它會曠工」。這顯然是一個非常簡短的資訊,可能來自某個報導或體驗分享。我們需要基於這個標題和一句話來重寫成自然、可讀的繁體中文新聞內文。注意不要新增來源沒有的內容,但可以合理推測一些背景,例如「Co-work」可能指協作工具或某種工作模式?

剛剛