{
  "source_file": "0930",
  "source_platform": "Medium",
  "author": "Benjamin Nweke",
  "title_listed": "How GRPO Trains Small Language Models with Verifiable Rewards",
  "keywords": "",
  "domain": "大模型算法",
  "content_type": "深度技术解析",
  "is_paid_flag": "否",
  "url": "https://towardsdatascience.com/how-grpo-trains-small-language-models-with-verifiable-rewards/",
  "publish_date": "2026-09-23",
  "corpus_stage": "",
  "notes": "",
  "id": "9d0c01073e9a",
  "collected_at": "2026-10-02T07:28:45",
  "title": "How GRPO Trains Small Language Models with Verifiable Rewards | Towards Data Science",
  "body_markdown": "![Revisit consent button](../images/body-df29beacd7496220cc94.svg)\nWe value your privacy\nWe use cookies to enhance your browsing experience, serve personalised ads or content, and analyse our traffic. By clicking \"Accept All\", you consent to our use of cookies.\nCustomise Reject All Accept All\nCustomise Consent Preferences ![](../images/body-2159bb67f3de8ad870eb.svg)\nWe use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.\nThe cookies that are categorised as \"Necessary\" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... Show more\nNecessaryAlways Active\nNecessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.\n  * Cookie\nBCTempID\n  * Duration\n10 minutes\n  * Description\nNo description available.\n\n\n  * Cookie\n__cf_bm\n  * Duration\n1 hour\n  * Description\nThis cookie, set by Cloudflare, is used to support Cloudflare Bot Management. \n\n\n  * Cookie\nAWSALBCORS\n  * Duration\n7 days\n  * Description\nAmazon Web Services set this cookie for load balancing.\n\n\n  * Cookie\n_cfuvid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to track users across sessions to optimize user experience by maintaining session consistency and providing personalized services\n\n\n  * Cookie\nli_gc\n  * Duration\n6 months\n  * Description\nLinkedin set this cookie for storing visitor's consent regarding using cookies for non-essential purposes.\n\n\n  * Cookie\n__hssrc\n  * Duration\nsession\n  * Description\nThis cookie is set by Hubspot whenever it changes the session cookie. The __hssrc cookie set to 1 indicates that the user has restarted the browser, and if the cookie does not exist, it is assumed to be a new session.\n\n\n  * Cookie\n__hssc\n  * Duration\n1 hour\n  * Description\nHubSpot sets this cookie to keep track of sessions and to determine if HubSpot should increment the session number and timestamps in the __hstc cookie.\n\n\n  * Cookie\nwpEmojiSettingsSupports\n  * Duration\nsession\n  * Description\nWordPress sets this cookie when a user interacts with emojis on a WordPress site. It helps determine if the user's browser can display emojis properly.\n\n\n  * Cookie\nBCSessionID\n  * Duration\n1 year 1 month 4 days\n  * Description\nBlueconic sets this cookie as a unique identifier for the BlueConic profile.\n\n\n  * Cookie\n_octo\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nlogged_in\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\n__Secure-YEC\n  * Duration\npast\n  * Description\nYouTube sets this cookie to stores the user's video player preferences using embedded YouTube video\n\n\n  * Cookie\n__eoi\n  * Duration\n6 months\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTGCORS\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\nlogin-status-p\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTG\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\ncsrf_token\n  * Duration\nsession\n  * Description\nNo description available.\n\n\n  * Cookie\ntoken_v2\n  * Duration\n1 day\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nD\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nPHPSESSID\n  * Duration\nsession\n  * Description\nThis cookie is native to PHP applications. The cookie stores and identifies a user's unique session ID to manage user sessions on the website. The cookie is a session cookie and will be deleted when all the browser windows are closed.\n\n\n  * Cookie\nVISITOR_PRIVACY_METADATA\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to store the user's cookie consent state for the current domain. \n\n\n  * Cookie\ncookietest\n  * Duration\nsession\n  * Description\nThe cookietest cookie is typically used to determine whether the user's browser accepts cookies, essential for website functionality and user experience.\n\n\n  * Cookie\n__Host-airtable-session\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\n__Host-airtable-session.sig\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\nm\n  * Duration\n1 year 1 month 4 days\n  * Description\nStripe sets this cookie for fraud prevention purposes. It identifies the device used to access the website, allowing the website to be formatted accordingly.\n\n\n  * Cookie\nBIGipServer*\n  * Duration\nsession\n  * Description\nMarketo sets this cookie to collect information about the user's online activity and build a profile about their interests to provide advertisements relevant to the user. \n\n\n  * Cookie\n__cfruid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to identify trusted web traffic.\n\n\n  * Cookie\n_GRECAPTCHA\n  * Duration\n6 months\n  * Description\nGoogle Recaptcha service sets this cookie to identify bots to protect the website against malicious spam attacks.\n\n\n  * Cookie\n__Secure-YNID\n  * Duration\n6 months\n  * Description\nGoogle cookie used to protect user security and prevent fraud, especially during the login process.\n\n\n  * Cookie\ncookieyes-consent\n  * Duration\n1 year\n  * Description\nCookieYes sets this cookie to remember users' consent preferences so that their preferences are respected on subsequent visits to this site. It does not collect or store any personal information about the site visitors.\n\n\nFunctional\nFunctional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.\n  * Cookie\nlidc\n  * Duration\n1 day\n  * Description\nLinkedIn sets the lidc cookie to facilitate data center selection.\n\n\n  * Cookie\nbrw\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nbrwConsent\n  * Duration\n5 minutes\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nWMF-Uniq\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nloom_anon_comment\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nloom_referral_video\n  * Duration\nsession\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nVISITOR_INFO1_LIVE\n  * Duration\n6 months\n  * Description\nA cookie set by YouTube to measure bandwidth that determines whether the user gets the new or old player interface.\n\n\n  * Cookie\nyt-remote-connected-devices\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nytidb::LAST_RESULT_ENTRY_KEY\n  * Duration\nNever Expires\n  * Description\nThe cookie ytidb::LAST_RESULT_ENTRY_KEY is used by YouTube to store the last search result entry that was clicked by the user. This information is used to improve the user experience by providing more relevant search results in the future.\n\n\n  * Cookie\nyt-remote-device-id\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-name\n  * Duration\nsession\n  * Description\nThe yt-remote-session-name cookie is used by YouTube to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\nyt-remote-fast-check-period\n  * Duration\nsession\n  * Description\nThe yt-remote-fast-check-period cookie is used by YouTube to store the user's video player preferences for embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-app\n  * Duration\nsession\n  * Description\nThe yt-remote-session-app cookie is used by YouTube to store user preferences and information about the interface of the embedded YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-available\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-available cookie is used to store the user's preferences regarding whether casting is available on their YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-installed\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-installed cookie is used to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\ncp_session\n  * Duration\n3 months\n  * Description\nCodepen sets this cookie for Help systems found in the website.\n\n\n  * Cookie\nloid\n  * Duration\n1 year 1 month 4 days\n  * Description\nThis cookie is set by the Reddit. The cookie enables the sharing of content from the website onto the social media platform.\n\n\nAnalytics\nAnalytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.\n  * Cookie\n__hstc\n  * Duration\n6 months\n  * Description\nHubspot set this main cookie for tracking visitors. It contains the domain, initial timestamp (first visit), last timestamp (last visit), current timestamp (this visit), and session number (increments for each subsequent session).\n\n\n  * Cookie\nhubspotutk\n  * Duration\n6 months\n  * Description\nHubSpot sets this cookie to keep track of the visitors to the website. This cookie is passed to HubSpot on form submission and used when deduplicating contacts.\n\n\n  * Cookie\n_ga\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to calculate visitor, session and campaign data and track site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognise unique visitors.\n\n\n  * Cookie\n_ga_*\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to store and count page views.\n\n\n  * Cookie\n__Host-psifi.analyticsTrace\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n__Host-psifi.analyticsTraceV2\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n_gh_sess\n  * Duration\nsession\n  * Description\nGitHub sets this cookie for temporary application and framework state between pages like what step the user is on in a multiple step form.\n\n\n  * Cookie\nYSC\n  * Duration\nsession\n  * Description\nYSC cookie is set by Youtube and is used to track the views of embedded videos on Youtube pages.\n\n\n  * Cookie\najs_anonymous_id\n  * Duration\n1 year\n  * Description\nThis cookie is set by Segment to count the number of people who visit a certain site by tracking if they have visited before.\n\n\n  * Cookie\nvuid\n  * Duration\n1 year 1 month 4 days\n  * Description\nVimeo installs this cookie to collect tracking information by setting a unique ID to embed videos on the website. \n\n\nPerformance\nPerformance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors.\n  * Cookie\nAWSALB\n  * Duration\n7 days\n  * Description\nAWSALB is an application load balancer cookie set by Amazon Web Services to map the session to the target.\n\n\n  * Cookie\nacq\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nacq.sig\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nptc\n  * Duration\n2 years\n  * Description\nNo description available.\n\n\nAdvertisement\nAdvertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns.\n  * Cookie\nmuc_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to collect user behaviour and interaction data to optimize the website.\n\n\n  * Cookie\nguest_id_marketing\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\nguest_id_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\npersonalization_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to integrate and share features for social media and also store information about how the user uses the website, for tracking and targeting.\n\n\n  * Cookie\nguest_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor. It registers if a user is signed in to the Twitter platform and collects information about ad preferences.\n\n\n  * Cookie\nbcookie\n  * Duration\n1 year\n  * Description\nLinkedIn sets this cookie from LinkedIn share buttons and ad tags to recognize browser IDs.\n\n\n  * Cookie\n__Secure-ROLLOUT_TOKEN\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to manage feature rollout and experimentation. It helps Google control which new features or interface changes are shown to users as part of testing and staged rollouts, ensuring consistent experience for a given user during an experiment.\n\n\n  * Cookie\nyt.innertube::nextId\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nyt.innertube::requests\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nsession_tracker\n  * Duration\nsession\n  * Description\nThis cookie is set by the Reddit. This cookie is used to identify trusted web traffic. It also helps in adverstising on the website.\n\n\n  * Cookie\nedgebucket\n  * Duration\nsession\n  * Description\nReddit sets this cookie to save the information about a log-on Reddit user, for the purpose of advertisement recommendations and updating the content.\n\n\n  * Cookie\ndid\n  * Duration\n1 year\n  * Description\nArbor sets this cookie to show targeted ads to site visitors.This cookie expires after 2 months or 1 year.\n\n\nUncategorised\nOther uncategorised cookies are those that are being analysed and have not been classified into a category as yet.\nNo cookies to display.\nReject All Save My Preferences Accept All\nToggle Search[](https://towardsdatascience.com/)Toggle Mobile Navigation\n[](https://towardsdatascience.com/)\nPublish AI, ML & data-science insights to a global community of data professionals.\nSign in[Submit an Article](https://write.insightmediagroup.io)\n[Latest](https://towardsdatascience.com/latest/)[Editor's Picks](https://towardsdatascience.com/tag/editors-pick/)[Newsletter](https://towardsdatascience.com/tag/the-variable/)[ShipAI](https://towardsdatascience.com/shipai/)\n* * *\n[Write For TDS](https://towardsdatascience.com/submissions/)\n[LinkedIn](https://www.linkedin.com/company/towards-data-science/)[X](https://x.com/TDataScience)Toggle Search\n[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)\n# How GRPO Trains Small Language Models with Verifiable Rewards\nThe mechanics behind local reasoning experiments with Unsloth and why the reward function matters as much as the model.\n[Benjamin Nweke](https://towardsdatascience.com/author/benjaminnweke/)\nSeptember 23, 202610 min read\n![A blue processor on a laptop-shaped platform connects to several branching paths, with one orange path passing through an arch.](../images/000.webp)\nImage by author (Generated with ChatGPT)\nConceptual illustration of GRPO reinforcement learning for small language models. Branching paths represent possible responses, while the highlighted orange route symbolizes an answer that passes verification and receives a positive reward.\nA language model can write \"let me double-check that\" and still get the multiplication wrong. It can even write \"wait, let me reconsider,\" and land on a different wrong answer. Neither sentence is evidence of thinking. If the goal is solving the problem, only the number at the end counts.\n[DeepSeek’s R1-Zero](https://arxiv.org/abs/2501.12948) brought considerable attention to reinforcement learning without a preliminary supervised fine-tuning stage. Its researchers reported behaviors such as revisiting an approach and spending more tokens on difficult problems. DeepSeek-R1, in contrast, used a broader training pipeline, including cold-start data, so we shouldn’t treat the two training processes as interchangeable. \nWhat interests me the most about Group Relative Policy Optimization, or GRPO as most of us know it, is how little feedback the basic setup needs. \nA model can generate several attempts at a question, receive a score for each, and use the differences to adjust its behavior. We can even check the final answer without writing out the solution we want it to imitate. Combined with techniques that reduce training memory, this makes smaller reasoning experiments more accessible.\nThat leaves two things worth understanding before choosing a model or a GPU: how those scores guide an update, and what happens when the scoring rule rewards the wrong thing.\nA simple arithmetic example helps explain both. Consider four possible responses to the same question and how a reward function would score each one.\n···\nLearn this step by step with the interactive [Machine Learning](https://roadmap.sh/machine-learning) roadmap.\n## A problem with an answer we can check\nConsider this question:\n> A shop has 6 boxes with 8 items in each box. It sells 6 items. How many items remain?\nThe answer is 42. A Python expression can verify it:\npython\n\n```\nboxes, items_per_box, sold = 6, 8, 6\nexpected_count = boxes * items_per_box - sold\n\nassert expected_count == 42\n```\n\nNow, that simple check gives us something valuable: an independent way to score the final answer. We do not need another language model to decide whether the response sounds convincing.\nIn a training dataset, the question goes to the model while the expected answer stays with the verifier. The model generates a response, the verifier scores it, and the training algorithm uses that score to adjust the model’s behavior.\nEasy.\nWe can therefore use question-and-answer pairs without providing worked solutions as supervised targets. This is the appeal of reinforcement learning with verifiable rewards: the feedback can come from checking an outcome.\nFor a real inventory system, ordinary arithmetic is still the sensible solution. The language model would be an expensive calculator with opinions. Here, the example makes the learning mechanism easy to inspect.\nThis also shows where our verifier falls short, because checking that the final integer is correct doesn’t tell us whether the reasoning behind it makes sense.\n## GRPO compares attempts at the same question\nGRPO was introduced in the [DeepSeekMath work](https://arxiv.org/abs/2402.03300) as an alternative to the memory requirements of conventional PPO-based training. \nCommon actor-critic implementations of PPO train a value estimator, often called a critic, alongside the policy. That estimator supplies a baseline for judging an action’s outcome.\nGRPO obtains its baseline from a group of responses sampled for the same prompt. Instead of asking a separate critic to estimate how well the model should do, it compares how well several attempts actually did.\nImagine the model produces these four answers:  \n| Attempt  | Final answer  | Correctness reward  |  \n| --- | --- | --- |  \n| 1  | 42  | 1  |  \n| 2  | 40  | 0  |  \n| 3  | 42  | 1  |  \n| 4  | 48  | 0  |  \nThe group’s average reward is 0.5. Attempts 1 and 3 performed better than that average; attempts 2 and 4 performed worse.\nThe original outcome-reward formulation standardizes that comparison:\n[Ai=ri−rˉσr+ϵ][ A_i = \\frac{r_i - \\bar{r}}{\\sigma_r + \\epsilon} ][Ai​=σr​+ϵri​−rˉ​]\nHere, (ri)(r_i)(ri​)is an attempt’s reward, (rˉ)(\\bar{r})(rˉ)is the group mean, and (σr)(\\sigma_r)(σr​)is the group’s reward standard deviation. The small (ϵ)(\\epsilon)(ϵ)provides numerical protection in the denominator. This quantity is called the _advantage_.\nFor these binary rewards, we can handle a group with no variation explicitly and divide by the standard deviation otherwise:\npython\n\n```\nfrom statistics import mean, pstdev\n\nrewards = [1.0, 0.0, 1.0, 0.0]\ngroup_mean = mean(rewards)\ngroup_std = pstdev(rewards)\n\n# Equal rewards give us nothing to rank within this group.\nif group_std == 0:\n    advantages = [0.0] * len(rewards)\nelse:\n    advantages = [(r - group_mean) / group_std for r in rewards]\n\nprint(advantages)\n# [1.0, -1.0, 1.0, -1.0]\n```\n\nThis example assumes a nonempty group of finite binary rewards. It uses the population standard deviation and omits epsilon in the nonzero branch, so it illustrates the comparison rather than reproducing a trainer’s normalization exactly. A library implementation may use a different estimator or normalization option, changing the numerical scale without changing the basic idea of comparing attempts within a group.\nThe optimizer uses the advantages to adjust the probabilities of the sampled responses, favoring higher-reward attempts relative to lower-reward ones. In outcome-based training, that signal applies across a response; it does not identify the exact arithmetic step responsible for success.\nThat gives us a way to compare the attempts, but honestly there’s still the question of how those scores change the model. \nActual training involves token probabilities and a [policy objective that controls how the model changes](https://huggingface.co/docs/trl/grpo_trainer). Clipping and, in some configurations, a penalty for drifting from a reference policy help regulate those updates. \nThe Python calculation above shows how we get the advantages; the optimizer handles what happens next.\nIf every answer in a group earns the same reward, whether all zero or all one, subtracting the mean leaves every attempt with zero advantage: there's no difference in reward to tell the model which attempt to favor. This makes task difficulty a practical consideration.\nIf the model never succeeds, sparse correctness rewards may provide little useful direction. If it already succeeds consistently, the task offers little room for improvement. The group has to contain informative differences often enough for learning to benefit.\n## The reward function defines success\nSuppose we reward a response whenever the string `42` appears in it. That would accept:\n> I first considered 42, but my final answer is 40.\nThe verifier would be wrong before training even started.\nFor this illustration, require a single final answer block, with no text after it. Then extract its integer value:\npython\n\n```\nimport re\n\n# Keep integer conversion bounded; 12 digits is ample for this toy task.\nFINAL_INTEGER = re.compile(\n    r\"<answer>\\s*([+-]?[0-9]{1,12})\\s*</answer>\\s*\\Z\"\n)\n\n\ndef extract_final_count(response: str) -> int | None:\n    # Don't let a response submit several answers and win on the last one.\n    if response.count(\"<answer>\") != 1 or response.count(\"</answer>\") != 1:\n        return None\n\n    match = FINAL_INTEGER.search(response)\n    if match is None:\n        return None\n\n    return int(match.group(1))\n\n\ndef correctness_reward(response: str, expected_count: int) -> float:\n    count = extract_final_count(response)\n    if count is None:\n        return 0.0\n\n    return float(count == expected_count)\n\n\nassert correctness_reward(\"48 - 6 = 42. <answer>42</answer>\", 42) == 1.0\nassert correctness_reward(\"I considered 42. <answer>40</answer>\", 42) == 0.0\nassert correctness_reward(\"<answer>40</answer><answer>42</answer>\", 42) == 0.0\nassert correctness_reward(\"<answer>0</answer>\", 0) == 1.0\n```\n\nThe parser accepts surrounding whitespace, signs, and leading zeros. It returns `None` for an invalid answer, which keeps a valid zero distinct from a parse failure. \nIt rejects duplicate answer blocks, trailing text, decimals, and comma-separated numbers. That suits this constructed integer task but would be too narrow for a general math answer checker.\nThe score is one or zero, but the decisions behind it are less tidy. Our parser rejects `42.0` even though it represents the same quantity. \nA different task might require a unit, or accept equivalent fractions. \nThose decisions belong in the verifier because they determine which responses training will favor.\nOur simple reward combines two things: getting the arithmetic right and obeying an output format. A model can improve its score just by learning the required tags, even if its arithmetic barely changes, which is why evaluation should track malformed responses separately.\nThe verifier deliberately gives no extra credit for longer answers or phrases such as “wait” and “let me reconsider.” Rewarding those features would encourage the model to use them without establishing that they improve problem-solving.\nGRPO itself does not require deterministic rules. [TRL supports reward models as well as custom reward functions](https://huggingface.co/docs/trl/grpo_trainer). \nFrom my experience, rules are attractive when the task allows them because they make the scoring process inspectable. For open-ended explanations, correctness is somewhat harder to compress into a reliable automatic check.\nI would settle those decisions before spending time on the training configuration. Otherwise, it becomes difficult to tell whether a rising reward means the model is solving more problems or simply getting better at satisfying the checker.\n···\n## Why the memory requirement becomes more manageable\nFor me, the practical question is how much of this can fit on a local machine. \nRemoving the learned critic reduces memory use, and local training becomes more manageable when we also limit which parameters get updated and store model weights more efficiently.\n[LoRA](https://arxiv.org/abs/2106.09685) represents weight updates using low-rank matrices, reducing the number of parameters that require gradients and optimizer state. \n[QLoRA](https://arxiv.org/abs/2305.14314) combines adapter training with a four-bit backbone and additional memory-saving techniques. Neither removes the cost of generating responses or processing them during training.\nUnsloth brings these ideas into practical workflows, including GRPO-based reinforcement learning. Its [reinforcement-learning documentation](https://unsloth.ai/docs/get-started/reinforcement-learning-rl-guide/advanced-rl-documentation) also covers integration with vLLM for rollout generation. \nThe pieces are complementary: GRPO is the learning algorithm, adapters define the trainable parameters, and the software stack determines how efficiently the operations run.\nA small model such as Qwen2.5-1.5B-Instruct illustrates the scale at which someone might begin exploring. Its [model card](https://huggingface.co/Qwen/Qwen2.5-1.5B-Instruct) lists approximately 1.54 billion parameters and an Apache 2.0 license. Because it is instruction-tuned, it already carries behavior learned before any new GRPO run. Any improvements would easily build on that starting point.\nI wouldn’t judge whether a model fits on my GPU by its parameter count alone. At four bits per parameter, 1.5 billion parameters would take up roughly 0.75 GB, but that only covers the weights in an idealized calculation. \nThe GPU also needs room for quantization metadata, components kept at higher precision, adapters, activations, generation caches, and temporary buffers.\nGRPO also samples several responses for each prompt. Longer responses and more concurrent generations increase the workload. \nTwo experiments using the same model can have very different memory requirements because their rollout settings differ.\nSo when you see a published VRAM figure, check which model and training settings it refers to, including the software version. A similarly sized model may need more memory on the same GPU, and hardware compatibility depends on the tools you use. The [Unsloth installation guide](https://unsloth.ai/docs/get-started/install) is a useful place to check whether your setup is supported.\n## Longer answers can be a misleading result\nReasoning is an attractive interpretation when responses become longer and contain self-corrections. But it is not the only possible interpretation.\n[Research examining R1-Zero-style training](https://arxiv.org/abs/2503.20783) found that some behaviors associated with an “aha moment” were already present in the starting models. \nThe same work identified biases in GRPO’s original formulation, including effects on response length, and proposed Dr. GRPO to address them.\nThis changes what we should look for in a training run. A model may be making more useful calculations, learning a preferred response style, or reacting to an optimization bias. A few impressive examples aren’t enough to distinguish those possibilities.\nIt also explains why two tutorials labeled “GRPO” may use different settings. \nLoss normalization, reward scaling, and reference-policy penalties are implementation choices that matter. A comparison should record them instead of assuming the algorithm’s name completely describes the experiment.\nFor a run that improves its reward, the first defensible observation is quite specific: under that task and inference budget, the model became more likely to produce answers the verifier accepts. \nWhether that improvement survives new questions is something we still have to test.\n## How to tell whether the model improved\nThe comparison I'd want to see is the original model and the trained version answering the same unseen questions, with the same instructions, sampling settings, and token budget, so we can judge whether training actually made a difference.\nFor the arithmetic example, measure accuracy across all test questions and track formatting failures separately, counting them as failures in the overall score. \nThat helps distinguish better arithmetic from better compliance with the answer format. Don't forget, response length matters too, because an improvement that requires twice as much output comes at a different cost.\nThe conclusion should stay close to what was tested. \nBetter accuracy on new inventory questions is useful evidence that the model improved at that task, but it doesn’t establish general reasoning ability. \nI’d be more convinced by the model getting more answers right than by explanations that make it sound like it’s thinking harder.\n···\n## Final thoughts and conclusion\nGRPO makes one part of language-model reinforcement learning simpler. It derives a learning signal by comparing responses to the same prompt, and avoiding a separately trained critic. \nAdapter training and quantization can reduce other parts of the memory burden, making smaller experiments more approachable.\nThe difficult judgment is deciding what those experiments should reward. \nA score should reflect the behavior you actually care about, while a held-out evaluation checks whether the model can do more than satisfy the scoring rule.\nFor arithmetic, the verifier can be a calculation. \nFor generated programs, it might be tests executed in an isolated environment. \nAnd then for an open-ended explanation, building a trustworthy check may be the largest part of the project.\nBefore choosing a model or a GPU, I would write down one question, one accepted answer, and one plausible response the verifier should reject. \nThat small exercise exposes assumptions a training configuration cannot fix.\nGRPO gives those judgments a way to influence the model. Whether the result is useful still depends on what we chose to reward, and what we checked afterward.\n···\n## Before you go!\nI write about how AI models work, where they fall short, and how to tell whether they’re actually getting better. If you’d like more of that, you can [subscribe to my newsletter](https://thatcsguy.substack.com/).\n**Connect With Me**\n  * [LinkedIn](http://www.linkedin.com/in/nwekebenjamin)\n  * [Substack](https://thatcsguy.substack.com/)\n\n\n## Register Now to Continue Reading\n### Unlock Towards Data Science with a Free Account\nAll articles on Towards Data Science are available to registered users. Create a free account today to access this article and thousands more.\nRegister for freeSign in to your account\n* * *\n![](../images/body-4ad89a2fc5e69dde007d.jpeg)\nWritten By\n## [Benjamin Nweke](https://towardsdatascience.com/author/benjaminnweke/)\nBenjamin Nweke is a Computer Science graduate and technical writer exploring AI, machine learning, and data science. He writes about building reliable AI systems, model evaluation, agentic architectures, and the practical challenges that appear when machine learning moves beyond experiments. His work focuses on making technically complex ideas clear, useful, and grounded in real implementation.\n[See all from Benjamin Nweke](https://towardsdatascience.com/author/benjaminnweke/)\n[Artificial Intelligence](https://towardsdatascience.com/tag/artificial-intelligence/)[Fine Tuning](https://towardsdatascience.com/tag/fine-tuning/)[Llm](https://towardsdatascience.com/tag/llm/)[Machine Learning](https://towardsdatascience.com/tag/machine-learning/)[Reinforcement Learning](https://towardsdatascience.com/tag/reinforcement-learning/)\nShare This Article\n  * [](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Ftowardsdatascience.com%2Fhow-grpo-trains-small-language-models-with-verifiable-rewards%2F&title=How%20GRPO%20Trains%20Small%20Language%20Models%20with%20Verifiable%20Rewards)\n  * [](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Ftowardsdatascience.com%2Fhow-grpo-trains-small-language-models-with-verifiable-rewards%2F&title=How%20GRPO%20Trains%20Small%20Language%20Models%20with%20Verifiable%20Rewards)\n  * [](https://x.com/share?url=https%3A%2F%2Ftowardsdatascience.com%2Fhow-grpo-trains-small-language-models-with-verifiable-rewards%2F&text=How%20GRPO%20Trains%20Small%20Language%20Models%20with%20Verifiable%20Rewards)\n\n\nTowards Data Science is a community publication. Submit your insights to reach our global audience and earn through the TDS Author Payment Program.\n[Write for TDS](https://towardsdatascience.com/submissions/)\n## Related Articles\n  * [![](../images/001.jpeg)](https://towardsdatascience.com/6-machine-learning-algorithms-to-know-when-learning-data-science-6e45ef139b99/)\n## [6 Machine Learning Algorithms to Know About When Learning Data Science](https://towardsdatascience.com/6-machine-learning-algorithms-to-know-when-learning-data-science-6e45ef139b99/)\n[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)\nShort Explanations of 6 Popular Machine Learning Algorithms\n[Andy McDonald](https://towardsdatascience.com/author/andymcdonaldgeo/)\nJuly 25, 20229 min read\n  * [![](../images/002.jpeg)](https://towardsdatascience.com/why-is-feature-scaling-important-in-machine-learning-discussing-6-feature-scaling-techniques-2773bda5be30/)\n## [Why is Feature Scaling Important in Machine Learning? Discussing 6 Feature Scaling Techniques](https://towardsdatascience.com/why-is-feature-scaling-important-in-machine-learning-discussing-6-feature-scaling-techniques-2773bda5be30/)\n[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)\nStandardization, Normalization, Robust Scaling, Mean Normalization, Maximum Absolute Scaling and Vector Unit Length Scaling\n[Rukshan Pramoditha](https://towardsdatascience.com/author/rukshanpramoditha/)\nAugust 15, 202313 min read\n  * [![](../images/003.jpg)](https://towardsdatascience.com/bayesian-machine-learning-and-julia-are-a-match-made-in-heaven-c3c498f2d221/)\n## [Bayesian Machine Learning and Julia are a match made in heaven](https://towardsdatascience.com/bayesian-machine-learning-and-julia-are-a-match-made-in-heaven-c3c498f2d221/)\n[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)\nTwo Julia libraries to make Bayesian Machine Learning a breeze\n[Sarem Seitz](https://towardsdatascience.com/author/sarem-seitz/)\nMarch 8, 20226 min read\n  * [![](../images/004.png)](https://towardsdatascience.com/can-unconditional-language-models-recover-arbitrary-sentences-a-paper-summary-98530f2316c7/)\n## [Can Unconditional Language Models Recover Arbitrary Sentences? - A paper summary](https://towardsdatascience.com/can-unconditional-language-models-recover-arbitrary-sentences-a-paper-summary-98530f2316c7/)\n[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)\nSummary of an unconventional approach towards pre-trained language models to determine if they can function as general-purpose decoders.\n[Devansh Goenka](https://towardsdatascience.com/author/devanshgoenka97/)\nOctober 11, 20206 min read\n  * [![](../images/005.png)](https://towardsdatascience.com/transfer-learning-covid-19-from-chest-x-rays-classifier-66d6c483fb03/)\n## [Transfer Learning: COVID-19 from Chest X-Rays Classifier](https://towardsdatascience.com/transfer-learning-covid-19-from-chest-x-rays-classifier-66d6c483fb03/)\n[Deep Learning](https://towardsdatascience.com/category/artificial-intelligence/deep-learning/)\nA detailed overview on how to do transfer learning and some theory behind each step.\n[Alfonso Santacruz Garcia](https://towardsdatascience.com/author/ponchosg96/)\nDecember 17, 202111 min read\n  * [![](../images/006.jpeg)](https://towardsdatascience.com/spicing-up-ice-hockey-with-ai-player-tracking-with-computer-vision-ce9ceec9122a/)\n## [Spicing up Ice Hockey with AI: Player Tracking with Computer Vision](https://towardsdatascience.com/spicing-up-ice-hockey-with-ai-player-tracking-with-computer-vision-ce9ceec9122a/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nUsing PyTorch, computer vision techniques, and a CNN, I worked on a model that tracks players, teams, and basic performance statistics\n[Raul Vizcarra Chirinos](https://towardsdatascience.com/author/raul.vizcarrach/)\nJuly 9, 202433 min read\n  * [![](../images/007.jpg)](https://towardsdatascience.com/starting-ml-product-initiatives-on-the-right-foot-cf24cbe163b3/)\n## [Starting ML Product Initiatives on the Right Foot](https://towardsdatascience.com/starting-ml-product-initiatives-on-the-right-foot-cf24cbe163b3/)\n[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)\nTop 3 lessons learned: the problem, the size, and the data\n[Anna Via](https://towardsdatascience.com/author/annaviaba/)\nMay 2, 20249 min read\n  * [![](../images/008.jpg)](https://towardsdatascience.com/kernel-regression-from-scratch-in-python-ea0615b23918/)\n## [Kernel Regression from Scratch in Python](https://towardsdatascience.com/kernel-regression-from-scratch-in-python-ea0615b23918/)\n[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)\nEveryone knows Linear Regression, but do you know Kernel Regression?\n[Kunj Mehta](https://towardsdatascience.com/author/kunjmehta10/)\nAugust 20, 20206 min read\n  * [![](../images/009.png)](https://towardsdatascience.com/federated-learning-and-custom-aggregation-schemes/)\n## [Federated Learning and Custom Aggregation Schemes](https://towardsdatascience.com/federated-learning-and-custom-aggregation-schemes/)\n[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)\nA practical guide to designing and analyzing robust aggregation strategies\n[Salman Toor](https://towardsdatascience.com/author/salman.toor/)\nOctober 22, 202510 min read\n\n\n  * [YouTube](https://www.youtube.com/c/TowardsDataScience)\n  * [X](https://x.com/TDataScience)\n  * [LinkedIn](https://www.linkedin.com/company/towards-data-science/)\n  * [Threads](https://www.threads.net/@towardsdatascience)\n  * [Bluesky](https://bsky.app/profile/towardsdatascience.com)\n\n\n[](https://towardsdatascience.com/)\nYour home for data science and AI. The world's leading publication for data science, data analytics, data engineering, machine learning, and artificial intelligence professionals.\nSubscribe to Our Newsletter[Write For TDS](https://towardsdatascience.com/submissions/)•[About](https://towardsdatascience.com/about-towards-data-science-d691af11cc2f/)•[Advertise](https://contact.towardsdatascience.com/advertise-with-towards-data-science)•[Privacy Policy](https://towardsdatascience.com/privacy-policy/)•[Terms of Use](https://towardsdatascience.com/website-terms-of-use/)\n© Insight Media Group, LLC 2026•[The New Stack](https://thenewstack.io)•[roadmap.sh](https://roadmap.sh)•[Creator Network](https://insightmediagroup.io/creator-network)\n####  Recommended Articles \nClose\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607686/image?etag=1782161464448&width=500&height=500) How Relevance Models Foreshadowed Transformers for NLP ](https://towardsdatascience.com/how-relevance-models-foreshadowed-transformers-for-nlp/ \"How Relevance Models Foreshadowed Transformers for NLP\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607639/image?etag=1781250125848&width=500&height=500) Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1 ](https://towardsdatascience.com/javascript-fatigue-you-dont-need-js-to-build-chatgpt/ \"Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607930/image?etag=1782124566054&width=500&height=500) The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs ](https://towardsdatascience.com/subset-sum-problem-solved-in-linear-time-for-dense-enough-inputs/ \"The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/3660/image?etag=1780176246070&width=500&height=500) Does Your Company Have a Data Strategy? ](https://towardsdatascience.com/does-your-company-have-a-data-strategy-e8944dbec4ae/ \"Does Your Company Have a Data Strategy?\")\n\n\n",
  "metadata": {
    "title": "How GRPO Trains Small Language Models with Verifiable Rewards | Towards Data Science",
    "description": "The mechanics behind local reasoning experiments with Unsloth and why the reward function matters as much as the model.",
    "keywords": null,
    "author": "Benjamin Nweke",
    "og:locale": "en_US",
    "og:type": "article",
    "og:title": "How GRPO Trains Small Language Models with Verifiable Rewards",
    "og:description": "The mechanics behind local reasoning experiments with Unsloth and why the reward function matters as much as the model.",
    "og:url": "https://towardsdatascience.com/how-grpo-trains-small-language-models-with-verifiable-rewards/",
    "og:site_name": "Towards Data Science",
    "og:image": "https://assets.insightmediagroup.io/media/1789847127918_tmuoaq.webp",
    "og:image:width": "1672",
    "og:image:height": "941",
    "og:image:type": "image/webp",
    "twitter:card": "summary_large_image",
    "twitter:site": "@TDataScience",
    "twitter:creator": "@TDataScience",
    "twitter:label1": "Written by",
    "twitter:data1": "Benjamin Nweke",
    "twitter:label2": "Est. reading time",
    "twitter:data2": "10 min read",
    "article:published_time": "2026-09-23T12:30:01.909Z",
    "article:modified_time": "2026-09-23T12:30:01.909Z",
    "article:author": "https://towardsdatascience.com/author/benjaminnweke/"
  },
  "paywall": {
    "listed_paid": false,
    "detected": false,
    "marker": "",
    "public_only": false,
    "policy": "付费/会员内容只保留页面公开可见部分，不绕过付费墙"
  },
  "crawl": {
    "success": true,
    "status_code": 202,
    "error": ""
  },
  "code_blocks": [
    {
      "language": "txt",
      "file": "attachments/9d0c01073e9a/code/block_000.txt",
      "chars": 112
    },
    {
      "language": "txt",
      "file": "attachments/9d0c01073e9a/code/block_001.txt",
      "chars": 355
    },
    {
      "language": "txt",
      "file": "attachments/9d0c01073e9a/code/block_002.txt",
      "chars": 999
    }
  ],
  "images": [
    {
      "status": "http_404",
      "url": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607686/image?etag=1782161464448&width=500&height=500",
      "src": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607686/image?etag=1782161464448&width=500&height=500",
      "alt": "",
      "downloaded": false,
      "discovery": "saved_markdown",
      "retried_at": "2026-10-20T17:48:18Z"
    },
    {
      "status": "http_404",
      "url": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607639/image?etag=1781250125848&width=500&height=500",
      "src": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607639/image?etag=1781250125848&width=500&height=500",
      "alt": "",
      "downloaded": false,
      "discovery": "saved_markdown",
      "retried_at": "2026-10-20T17:48:18Z"
    },
    {
      "status": "http_404",
      "url": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607930/image?etag=1782124566054&width=500&height=500",
      "src": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607930/image?etag=1782124566054&width=500&height=500",
      "alt": "",
      "downloaded": false,
      "discovery": "saved_markdown",
      "retried_at": "2026-10-20T17:48:18Z"
    },
    {
      "status": "http_404",
      "url": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/3660/image?etag=1780176246070&width=500&height=500",
      "src": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/3660/image?etag=1780176246070&width=500&height=500",
      "alt": "",
      "downloaded": false,
      "discovery": "saved_markdown",
      "retried_at": "2026-10-20T17:48:18Z"
    }
  ],
  "audio": [],
  "videos": [
    {
      "url": "https://www.youtube.com/c/TowardsDataScience",
      "kind": "channel_reference",
      "status": "reference_only"
    }
  ],
  "links": [
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/latest/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/editors-pick/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/the-variable/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/shipai/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/submissions/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/category/artificial-intelligence/machine-learning/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/author/benjaminnweke/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/artificial-intelligence/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/fine-tuning/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/llm/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/machine-learning/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/reinforcement-learning/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/6-machine-learning-algorithms-to-know-when-learning-data-science-6e45ef139b99/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/author/andymcdonaldgeo/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/why-is-feature-scaling-important-in-machine-learning-discussing-6-feature-scaling-techniques-2773bda5be30/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/author/rukshanpramoditha/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/bayesian-machine-learning-and-julia-are-a-match-made-in-heaven-c3c498f2d221/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/author/sarem-seitz/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/can-unconditional-language-models-recover-arbitrary-sentences-a-paper-summary-98530f2316c7/"
    },
    {
      "type": "external",
      "href": "https://write.insightmediagroup.io"
    },
    {
      "type": "external",
      "href": "https://www.linkedin.com/company/towards-data-science/"
    },
    {
      "type": "external",
      "href": "https://x.com/TDataScience"
    },
    {
      "type": "external",
      "href": "https://arxiv.org/abs/2501.12948"
    },
    {
      "type": "external",
      "href": "https://roadmap.sh/machine-learning"
    },
    {
      "type": "external",
      "href": "https://arxiv.org/abs/2402.03300"
    },
    {
      "type": "external",
      "href": "https://huggingface.co/docs/trl/grpo_trainer"
    },
    {
      "type": "external",
      "href": "https://arxiv.org/abs/2106.09685"
    },
    {
      "type": "external",
      "href": "https://arxiv.org/abs/2305.14314"
    },
    {
      "type": "external",
      "href": "https://unsloth.ai/docs/get-started/reinforcement-learning-rl-guide/advanced-rl-documentation"
    },
    {
      "type": "external",
      "href": "https://huggingface.co/Qwen/Qwen2.5-1.5B-Instruct"
    },
    {
      "type": "external",
      "href": "https://unsloth.ai/docs/get-started/install"
    },
    {
      "type": "external",
      "href": "https://arxiv.org/abs/2503.20783"
    },
    {
      "type": "external",
      "href": "https://thatcsguy.substack.com/"
    },
    {
      "type": "external",
      "href": "http://www.linkedin.com/in/nwekebenjamin"
    },
    {
      "type": "external",
      "href": "https://www.facebook.com/sharer/sharer.php?title=How+GRPO+Trains+Small+Language+Models+with+Verifiable+Rewards&u=https%3A%2F%2Ftowardsdatascience.com%2Fhow-grpo-trains-small-language-models-with-verifiable-rewards%2F"
    },
    {
      "type": "external",
      "href": "https://www.linkedin.com/shareArticle?mini=true&title=How+GRPO+Trains+Small+Language+Models+with+Verifiable+Rewards&url=https%3A%2F%2Ftowardsdatascience.com%2Fhow-grpo-trains-small-language-models-with-verifiable-rewards%2F"
    },
    {
      "type": "external",
      "href": "https://x.com/share?text=How+GRPO+Trains+Small+Language+Models+with+Verifiable+Rewards&url=https%3A%2F%2Ftowardsdatascience.com%2Fhow-grpo-trains-small-language-models-with-verifiable-rewards%2F"
    },
    {
      "type": "external",
      "href": "https://www.youtube.com/c/TowardsDataScience"
    },
    {
      "type": "external",
      "href": "https://www.threads.net/@towardsdatascience"
    }
  ],
  "repair_version": 2,
  "repaired_at": "2026-10-20T17:27:00Z",
  "source_url": "https://towardsdatascience.com/how-grpo-trains-small-language-models-with-verifiable-rewards/",
  "delivery_status": "unverified",
  "discovery_status": "http_403",
  "missing_reason": "源页面未重新核验:http_403；已按保留正文补采图片",
  "repair_error": "",
  "actual_video_files": [],
  "expected_saved_body_images": 4,
  "image_discovery": "saved_markdown",
  "source_body_markdown": "![Revisit consent button](https://cdn-cookieyes.com/assets/images/revisit.svg)\nWe value your privacy\nWe use cookies to enhance your browsing experience, serve personalised ads or content, and analyse our traffic. By clicking \"Accept All\", you consent to our use of cookies.\nCustomise Reject All Accept All\nCustomise Consent Preferences ![](https://cdn-cookieyes.com/assets/images/close.svg)\nWe use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.\nThe cookies that are categorised as \"Necessary\" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... Show more\nNecessaryAlways Active\nNecessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.\n  * Cookie\nBCTempID\n  * Duration\n10 minutes\n  * Description\nNo description available.\n\n\n  * Cookie\n__cf_bm\n  * Duration\n1 hour\n  * Description\nThis cookie, set by Cloudflare, is used to support Cloudflare Bot Management. \n\n\n  * Cookie\nAWSALBCORS\n  * Duration\n7 days\n  * Description\nAmazon Web Services set this cookie for load balancing.\n\n\n  * Cookie\n_cfuvid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to track users across sessions to optimize user experience by maintaining session consistency and providing personalized services\n\n\n  * Cookie\nli_gc\n  * Duration\n6 months\n  * Description\nLinkedin set this cookie for storing visitor's consent regarding using cookies for non-essential purposes.\n\n\n  * Cookie\n__hssrc\n  * Duration\nsession\n  * Description\nThis cookie is set by Hubspot whenever it changes the session cookie. The __hssrc cookie set to 1 indicates that the user has restarted the browser, and if the cookie does not exist, it is assumed to be a new session.\n\n\n  * Cookie\n__hssc\n  * Duration\n1 hour\n  * Description\nHubSpot sets this cookie to keep track of sessions and to determine if HubSpot should increment the session number and timestamps in the __hstc cookie.\n\n\n  * Cookie\nwpEmojiSettingsSupports\n  * Duration\nsession\n  * Description\nWordPress sets this cookie when a user interacts with emojis on a WordPress site. It helps determine if the user's browser can display emojis properly.\n\n\n  * Cookie\nBCSessionID\n  * Duration\n1 year 1 month 4 days\n  * Description\nBlueconic sets this cookie as a unique identifier for the BlueConic profile.\n\n\n  * Cookie\n_octo\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nlogged_in\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\n__Secure-YEC\n  * Duration\npast\n  * Description\nYouTube sets this cookie to stores the user's video player preferences using embedded YouTube video\n\n\n  * Cookie\n__eoi\n  * Duration\n6 months\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTGCORS\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\nlogin-status-p\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTG\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\ncsrf_token\n  * Duration\nsession\n  * Description\nNo description available.\n\n\n  * Cookie\ntoken_v2\n  * Duration\n1 day\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nD\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nPHPSESSID\n  * Duration\nsession\n  * Description\nThis cookie is native to PHP applications. The cookie stores and identifies a user's unique session ID to manage user sessions on the website. The cookie is a session cookie and will be deleted when all the browser windows are closed.\n\n\n  * Cookie\nVISITOR_PRIVACY_METADATA\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to store the user's cookie consent state for the current domain. \n\n\n  * Cookie\ncookietest\n  * Duration\nsession\n  * Description\nThe cookietest cookie is typically used to determine whether the user's browser accepts cookies, essential for website functionality and user experience.\n\n\n  * Cookie\n__Host-airtable-session\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\n__Host-airtable-session.sig\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\nm\n  * Duration\n1 year 1 month 4 days\n  * Description\nStripe sets this cookie for fraud prevention purposes. It identifies the device used to access the website, allowing the website to be formatted accordingly.\n\n\n  * Cookie\nBIGipServer*\n  * Duration\nsession\n  * Description\nMarketo sets this cookie to collect information about the user's online activity and build a profile about their interests to provide advertisements relevant to the user. \n\n\n  * Cookie\n__cfruid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to identify trusted web traffic.\n\n\n  * Cookie\n_GRECAPTCHA\n  * Duration\n6 months\n  * Description\nGoogle Recaptcha service sets this cookie to identify bots to protect the website against malicious spam attacks.\n\n\n  * Cookie\n__Secure-YNID\n  * Duration\n6 months\n  * Description\nGoogle cookie used to protect user security and prevent fraud, especially during the login process.\n\n\n  * Cookie\ncookieyes-consent\n  * Duration\n1 year\n  * Description\nCookieYes sets this cookie to remember users' consent preferences so that their preferences are respected on subsequent visits to this site. It does not collect or store any personal information about the site visitors.\n\n\nFunctional\nFunctional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.\n  * Cookie\nlidc\n  * Duration\n1 day\n  * Description\nLinkedIn sets the lidc cookie to facilitate data center selection.\n\n\n  * Cookie\nbrw\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nbrwConsent\n  * Duration\n5 minutes\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nWMF-Uniq\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nloom_anon_comment\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nloom_referral_video\n  * Duration\nsession\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nVISITOR_INFO1_LIVE\n  * Duration\n6 months\n  * Description\nA cookie set by YouTube to measure bandwidth that determines whether the user gets the new or old player interface.\n\n\n  * Cookie\nyt-remote-connected-devices\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nytidb::LAST_RESULT_ENTRY_KEY\n  * Duration\nNever Expires\n  * Description\nThe cookie ytidb::LAST_RESULT_ENTRY_KEY is used by YouTube to store the last search result entry that was clicked by the user. This information is used to improve the user experience by providing more relevant search results in the future.\n\n\n  * Cookie\nyt-remote-device-id\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-name\n  * Duration\nsession\n  * Description\nThe yt-remote-session-name cookie is used by YouTube to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\nyt-remote-fast-check-period\n  * Duration\nsession\n  * Description\nThe yt-remote-fast-check-period cookie is used by YouTube to store the user's video player preferences for embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-app\n  * Duration\nsession\n  * Description\nThe yt-remote-session-app cookie is used by YouTube to store user preferences and information about the interface of the embedded YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-available\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-available cookie is used to store the user's preferences regarding whether casting is available on their YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-installed\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-installed cookie is used to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\ncp_session\n  * Duration\n3 months\n  * Description\nCodepen sets this cookie for Help systems found in the website.\n\n\n  * Cookie\nloid\n  * Duration\n1 year 1 month 4 days\n  * Description\nThis cookie is set by the Reddit. The cookie enables the sharing of content from the website onto the social media platform.\n\n\nAnalytics\nAnalytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.\n  * Cookie\n__hstc\n  * Duration\n6 months\n  * Description\nHubspot set this main cookie for tracking visitors. It contains the domain, initial timestamp (first visit), last timestamp (last visit), current timestamp (this visit), and session number (increments for each subsequent session).\n\n\n  * Cookie\nhubspotutk\n  * Duration\n6 months\n  * Description\nHubSpot sets this cookie to keep track of the visitors to the website. This cookie is passed to HubSpot on form submission and used when deduplicating contacts.\n\n\n  * Cookie\n_ga\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to calculate visitor, session and campaign data and track site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognise unique visitors.\n\n\n  * Cookie\n_ga_*\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to store and count page views.\n\n\n  * Cookie\n__Host-psifi.analyticsTrace\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n__Host-psifi.analyticsTraceV2\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n_gh_sess\n  * Duration\nsession\n  * Description\nGitHub sets this cookie for temporary application and framework state between pages like what step the user is on in a multiple step form.\n\n\n  * Cookie\nYSC\n  * Duration\nsession\n  * Description\nYSC cookie is set by Youtube and is used to track the views of embedded videos on Youtube pages.\n\n\n  * Cookie\najs_anonymous_id\n  * Duration\n1 year\n  * Description\nThis cookie is set by Segment to count the number of people who visit a certain site by tracking if they have visited before.\n\n\n  * Cookie\nvuid\n  * Duration\n1 year 1 month 4 days\n  * Description\nVimeo installs this cookie to collect tracking information by setting a unique ID to embed videos on the website. \n\n\nPerformance\nPerformance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors.\n  * Cookie\nAWSALB\n  * Duration\n7 days\n  * Description\nAWSALB is an application load balancer cookie set by Amazon Web Services to map the session to the target.\n\n\n  * Cookie\nacq\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nacq.sig\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nptc\n  * Duration\n2 years\n  * Description\nNo description available.\n\n\nAdvertisement\nAdvertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns.\n  * Cookie\nmuc_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to collect user behaviour and interaction data to optimize the website.\n\n\n  * Cookie\nguest_id_marketing\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\nguest_id_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\npersonalization_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to integrate and share features for social media and also store information about how the user uses the website, for tracking and targeting.\n\n\n  * Cookie\nguest_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor. It registers if a user is signed in to the Twitter platform and collects information about ad preferences.\n\n\n  * Cookie\nbcookie\n  * Duration\n1 year\n  * Description\nLinkedIn sets this cookie from LinkedIn share buttons and ad tags to recognize browser IDs.\n\n\n  * Cookie\n__Secure-ROLLOUT_TOKEN\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to manage feature rollout and experimentation. It helps Google control which new features or interface changes are shown to users as part of testing and staged rollouts, ensuring consistent experience for a given user during an experiment.\n\n\n  * Cookie\nyt.innertube::nextId\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nyt.innertube::requests\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nsession_tracker\n  * Duration\nsession\n  * Description\nThis cookie is set by the Reddit. This cookie is used to identify trusted web traffic. It also helps in adverstising on the website.\n\n\n  * Cookie\nedgebucket\n  * Duration\nsession\n  * Description\nReddit sets this cookie to save the information about a log-on Reddit user, for the purpose of advertisement recommendations and updating the content.\n\n\n  * Cookie\ndid\n  * Duration\n1 year\n  * Description\nArbor sets this cookie to show targeted ads to site visitors.This cookie expires after 2 months or 1 year.\n\n\nUncategorised\nOther uncategorised cookies are those that are being analysed and have not been classified into a category as yet.\nNo cookies to display.\nReject All Save My Preferences Accept All\nToggle Search[](https://towardsdatascience.com/)Toggle Mobile Navigation\n[](https://towardsdatascience.com/)\nPublish AI, ML & data-science insights to a global community of data professionals.\nSign in[Submit an Article](https://write.insightmediagroup.io)\n[Latest](https://towardsdatascience.com/latest/)[Editor's Picks](https://towardsdatascience.com/tag/editors-pick/)[Newsletter](https://towardsdatascience.com/tag/the-variable/)[ShipAI](https://towardsdatascience.com/shipai/)\n* * *\n[Write For TDS](https://towardsdatascience.com/submissions/)\n[LinkedIn](https://www.linkedin.com/company/towards-data-science/)[X](https://x.com/TDataScience)Toggle Search\n[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)\n# How GRPO Trains Small Language Models with Verifiable Rewards\nThe mechanics behind local reasoning experiments with Unsloth and why the reward function matters as much as the model.\n[Benjamin Nweke](https://towardsdatascience.com/author/benjaminnweke/)\nSeptember 23, 202610 min read\n![A blue processor on a laptop-shaped platform connects to several branching paths, with one orange path passing through an arch.](https://assets.insightmediagroup.io/media/1789847127918_tmuoaq.webp)\nImage by author (Generated with ChatGPT)\nConceptual illustration of GRPO reinforcement learning for small language models. Branching paths represent possible responses, while the highlighted orange route symbolizes an answer that passes verification and receives a positive reward.\nA language model can write \"let me double-check that\" and still get the multiplication wrong. It can even write \"wait, let me reconsider,\" and land on a different wrong answer. Neither sentence is evidence of thinking. If the goal is solving the problem, only the number at the end counts.\n[DeepSeek’s R1-Zero](https://arxiv.org/abs/2501.12948) brought considerable attention to reinforcement learning without a preliminary supervised fine-tuning stage. Its researchers reported behaviors such as revisiting an approach and spending more tokens on difficult problems. DeepSeek-R1, in contrast, used a broader training pipeline, including cold-start data, so we shouldn’t treat the two training processes as interchangeable. \nWhat interests me the most about Group Relative Policy Optimization, or GRPO as most of us know it, is how little feedback the basic setup needs. \nA model can generate several attempts at a question, receive a score for each, and use the differences to adjust its behavior. We can even check the final answer without writing out the solution we want it to imitate. Combined with techniques that reduce training memory, this makes smaller reasoning experiments more accessible.\nThat leaves two things worth understanding before choosing a model or a GPU: how those scores guide an update, and what happens when the scoring rule rewards the wrong thing.\nA simple arithmetic example helps explain both. Consider four possible responses to the same question and how a reward function would score each one.\n···\nLearn this step by step with the interactive [Machine Learning](https://roadmap.sh/machine-learning) roadmap.\n## A problem with an answer we can check\nConsider this question:\n> A shop has 6 boxes with 8 items in each box. It sells 6 items. How many items remain?\nThe answer is 42. A Python expression can verify it:\npython\n\n```\nboxes, items_per_box, sold = 6, 8, 6\nexpected_count = boxes * items_per_box - sold\n\nassert expected_count == 42\n```\n\nNow, that simple check gives us something valuable: an independent way to score the final answer. We do not need another language model to decide whether the response sounds convincing.\nIn a training dataset, the question goes to the model while the expected answer stays with the verifier. The model generates a response, the verifier scores it, and the training algorithm uses that score to adjust the model’s behavior.\nEasy.\nWe can therefore use question-and-answer pairs without providing worked solutions as supervised targets. This is the appeal of reinforcement learning with verifiable rewards: the feedback can come from checking an outcome.\nFor a real inventory system, ordinary arithmetic is still the sensible solution. The language model would be an expensive calculator with opinions. Here, the example makes the learning mechanism easy to inspect.\nThis also shows where our verifier falls short, because checking that the final integer is correct doesn’t tell us whether the reasoning behind it makes sense.\n## GRPO compares attempts at the same question\nGRPO was introduced in the [DeepSeekMath work](https://arxiv.org/abs/2402.03300) as an alternative to the memory requirements of conventional PPO-based training. \nCommon actor-critic implementations of PPO train a value estimator, often called a critic, alongside the policy. That estimator supplies a baseline for judging an action’s outcome.\nGRPO obtains its baseline from a group of responses sampled for the same prompt. Instead of asking a separate critic to estimate how well the model should do, it compares how well several attempts actually did.\nImagine the model produces these four answers:  \n| Attempt  | Final answer  | Correctness reward  |  \n| --- | --- | --- |  \n| 1  | 42  | 1  |  \n| 2  | 40  | 0  |  \n| 3  | 42  | 1  |  \n| 4  | 48  | 0  |  \nThe group’s average reward is 0.5. Attempts 1 and 3 performed better than that average; attempts 2 and 4 performed worse.\nThe original outcome-reward formulation standardizes that comparison:\n[Ai=ri−rˉσr+ϵ][ A_i = \\frac{r_i - \\bar{r}}{\\sigma_r + \\epsilon} ][Ai​=σr​+ϵri​−rˉ​]\nHere, (ri)(r_i)(ri​)is an attempt’s reward, (rˉ)(\\bar{r})(rˉ)is the group mean, and (σr)(\\sigma_r)(σr​)is the group’s reward standard deviation. The small (ϵ)(\\epsilon)(ϵ)provides numerical protection in the denominator. This quantity is called the _advantage_.\nFor these binary rewards, we can handle a group with no variation explicitly and divide by the standard deviation otherwise:\npython\n\n```\nfrom statistics import mean, pstdev\n\nrewards = [1.0, 0.0, 1.0, 0.0]\ngroup_mean = mean(rewards)\ngroup_std = pstdev(rewards)\n\n# Equal rewards give us nothing to rank within this group.\nif group_std == 0:\n    advantages = [0.0] * len(rewards)\nelse:\n    advantages = [(r - group_mean) / group_std for r in rewards]\n\nprint(advantages)\n# [1.0, -1.0, 1.0, -1.0]\n```\n\nThis example assumes a nonempty group of finite binary rewards. It uses the population standard deviation and omits epsilon in the nonzero branch, so it illustrates the comparison rather than reproducing a trainer’s normalization exactly. A library implementation may use a different estimator or normalization option, changing the numerical scale without changing the basic idea of comparing attempts within a group.\nThe optimizer uses the advantages to adjust the probabilities of the sampled responses, favoring higher-reward attempts relative to lower-reward ones. In outcome-based training, that signal applies across a response; it does not identify the exact arithmetic step responsible for success.\nThat gives us a way to compare the attempts, but honestly there’s still the question of how those scores change the model. \nActual training involves token probabilities and a [policy objective that controls how the model changes](https://huggingface.co/docs/trl/grpo_trainer). Clipping and, in some configurations, a penalty for drifting from a reference policy help regulate those updates. \nThe Python calculation above shows how we get the advantages; the optimizer handles what happens next.\nIf every answer in a group earns the same reward, whether all zero or all one, subtracting the mean leaves every attempt with zero advantage: there's no difference in reward to tell the model which attempt to favor. This makes task difficulty a practical consideration.\nIf the model never succeeds, sparse correctness rewards may provide little useful direction. If it already succeeds consistently, the task offers little room for improvement. The group has to contain informative differences often enough for learning to benefit.\n## The reward function defines success\nSuppose we reward a response whenever the string `42` appears in it. That would accept:\n> I first considered 42, but my final answer is 40.\nThe verifier would be wrong before training even started.\nFor this illustration, require a single final answer block, with no text after it. Then extract its integer value:\npython\n\n```\nimport re\n\n# Keep integer conversion bounded; 12 digits is ample for this toy task.\nFINAL_INTEGER = re.compile(\n    r\"<answer>\\s*([+-]?[0-9]{1,12})\\s*</answer>\\s*\\Z\"\n)\n\n\ndef extract_final_count(response: str) -> int | None:\n    # Don't let a response submit several answers and win on the last one.\n    if response.count(\"<answer>\") != 1 or response.count(\"</answer>\") != 1:\n        return None\n\n    match = FINAL_INTEGER.search(response)\n    if match is None:\n        return None\n\n    return int(match.group(1))\n\n\ndef correctness_reward(response: str, expected_count: int) -> float:\n    count = extract_final_count(response)\n    if count is None:\n        return 0.0\n\n    return float(count == expected_count)\n\n\nassert correctness_reward(\"48 - 6 = 42. <answer>42</answer>\", 42) == 1.0\nassert correctness_reward(\"I considered 42. <answer>40</answer>\", 42) == 0.0\nassert correctness_reward(\"<answer>40</answer><answer>42</answer>\", 42) == 0.0\nassert correctness_reward(\"<answer>0</answer>\", 0) == 1.0\n```\n\nThe parser accepts surrounding whitespace, signs, and leading zeros. It returns `None` for an invalid answer, which keeps a valid zero distinct from a parse failure. \nIt rejects duplicate answer blocks, trailing text, decimals, and comma-separated numbers. That suits this constructed integer task but would be too narrow for a general math answer checker.\nThe score is one or zero, but the decisions behind it are less tidy. Our parser rejects `42.0` even though it represents the same quantity. \nA different task might require a unit, or accept equivalent fractions. \nThose decisions belong in the verifier because they determine which responses training will favor.\nOur simple reward combines two things: getting the arithmetic right and obeying an output format. A model can improve its score just by learning the required tags, even if its arithmetic barely changes, which is why evaluation should track malformed responses separately.\nThe verifier deliberately gives no extra credit for longer answers or phrases such as “wait” and “let me reconsider.” Rewarding those features would encourage the model to use them without establishing that they improve problem-solving.\nGRPO itself does not require deterministic rules. [TRL supports reward models as well as custom reward functions](https://huggingface.co/docs/trl/grpo_trainer). \nFrom my experience, rules are attractive when the task allows them because they make the scoring process inspectable. For open-ended explanations, correctness is somewhat harder to compress into a reliable automatic check.\nI would settle those decisions before spending time on the training configuration. Otherwise, it becomes difficult to tell whether a rising reward means the model is solving more problems or simply getting better at satisfying the checker.\n···\n## Why the memory requirement becomes more manageable\nFor me, the practical question is how much of this can fit on a local machine. \nRemoving the learned critic reduces memory use, and local training becomes more manageable when we also limit which parameters get updated and store model weights more efficiently.\n[LoRA](https://arxiv.org/abs/2106.09685) represents weight updates using low-rank matrices, reducing the number of parameters that require gradients and optimizer state. \n[QLoRA](https://arxiv.org/abs/2305.14314) combines adapter training with a four-bit backbone and additional memory-saving techniques. Neither removes the cost of generating responses or processing them during training.\nUnsloth brings these ideas into practical workflows, including GRPO-based reinforcement learning. Its [reinforcement-learning documentation](https://unsloth.ai/docs/get-started/reinforcement-learning-rl-guide/advanced-rl-documentation) also covers integration with vLLM for rollout generation. \nThe pieces are complementary: GRPO is the learning algorithm, adapters define the trainable parameters, and the software stack determines how efficiently the operations run.\nA small model such as Qwen2.5-1.5B-Instruct illustrates the scale at which someone might begin exploring. Its [model card](https://huggingface.co/Qwen/Qwen2.5-1.5B-Instruct) lists approximately 1.54 billion parameters and an Apache 2.0 license. Because it is instruction-tuned, it already carries behavior learned before any new GRPO run. Any improvements would easily build on that starting point.\nI wouldn’t judge whether a model fits on my GPU by its parameter count alone. At four bits per parameter, 1.5 billion parameters would take up roughly 0.75 GB, but that only covers the weights in an idealized calculation. \nThe GPU also needs room for quantization metadata, components kept at higher precision, adapters, activations, generation caches, and temporary buffers.\nGRPO also samples several responses for each prompt. Longer responses and more concurrent generations increase the workload. \nTwo experiments using the same model can have very different memory requirements because their rollout settings differ.\nSo when you see a published VRAM figure, check which model and training settings it refers to, including the software version. A similarly sized model may need more memory on the same GPU, and hardware compatibility depends on the tools you use. The [Unsloth installation guide](https://unsloth.ai/docs/get-started/install) is a useful place to check whether your setup is supported.\n## Longer answers can be a misleading result\nReasoning is an attractive interpretation when responses become longer and contain self-corrections. But it is not the only possible interpretation.\n[Research examining R1-Zero-style training](https://arxiv.org/abs/2503.20783) found that some behaviors associated with an “aha moment” were already present in the starting models. \nThe same work identified biases in GRPO’s original formulation, including effects on response length, and proposed Dr. GRPO to address them.\nThis changes what we should look for in a training run. A model may be making more useful calculations, learning a preferred response style, or reacting to an optimization bias. A few impressive examples aren’t enough to distinguish those possibilities.\nIt also explains why two tutorials labeled “GRPO” may use different settings. \nLoss normalization, reward scaling, and reference-policy penalties are implementation choices that matter. A comparison should record them instead of assuming the algorithm’s name completely describes the experiment.\nFor a run that improves its reward, the first defensible observation is quite specific: under that task and inference budget, the model became more likely to produce answers the verifier accepts. \nWhether that improvement survives new questions is something we still have to test.\n## How to tell whether the model improved\nThe comparison I'd want to see is the original model and the trained version answering the same unseen questions, with the same instructions, sampling settings, and token budget, so we can judge whether training actually made a difference.\nFor the arithmetic example, measure accuracy across all test questions and track formatting failures separately, counting them as failures in the overall score. \nThat helps distinguish better arithmetic from better compliance with the answer format. Don't forget, response length matters too, because an improvement that requires twice as much output comes at a different cost.\nThe conclusion should stay close to what was tested. \nBetter accuracy on new inventory questions is useful evidence that the model improved at that task, but it doesn’t establish general reasoning ability. \nI’d be more convinced by the model getting more answers right than by explanations that make it sound like it’s thinking harder.\n···\n## Final thoughts and conclusion\nGRPO makes one part of language-model reinforcement learning simpler. It derives a learning signal by comparing responses to the same prompt, and avoiding a separately trained critic. \nAdapter training and quantization can reduce other parts of the memory burden, making smaller experiments more approachable.\nThe difficult judgment is deciding what those experiments should reward. \nA score should reflect the behavior you actually care about, while a held-out evaluation checks whether the model can do more than satisfy the scoring rule.\nFor arithmetic, the verifier can be a calculation. \nFor generated programs, it might be tests executed in an isolated environment. \nAnd then for an open-ended explanation, building a trustworthy check may be the largest part of the project.\nBefore choosing a model or a GPU, I would write down one question, one accepted answer, and one plausible response the verifier should reject. \nThat small exercise exposes assumptions a training configuration cannot fix.\nGRPO gives those judgments a way to influence the model. Whether the result is useful still depends on what we chose to reward, and what we checked afterward.\n···\n## Before you go!\nI write about how AI models work, where they fall short, and how to tell whether they’re actually getting better. If you’d like more of that, you can [subscribe to my newsletter](https://thatcsguy.substack.com/).\n**Connect With Me**\n  * [LinkedIn](http://www.linkedin.com/in/nwekebenjamin)\n  * [Substack](https://thatcsguy.substack.com/)\n\n\n## Register Now to Continue Reading\n### Unlock Towards Data Science with a Free Account\nAll articles on Towards Data Science are available to registered users. Create a free account today to access this article and thousands more.\nRegister for freeSign in to your account\n* * *\n![](https://assets.insightmediagroup.io/media/1787657271062_x78p7k.jpeg)\nWritten By\n## [Benjamin Nweke](https://towardsdatascience.com/author/benjaminnweke/)\nBenjamin Nweke is a Computer Science graduate and technical writer exploring AI, machine learning, and data science. He writes about building reliable AI systems, model evaluation, agentic architectures, and the practical challenges that appear when machine learning moves beyond experiments. His work focuses on making technically complex ideas clear, useful, and grounded in real implementation.\n[See all from Benjamin Nweke](https://towardsdatascience.com/author/benjaminnweke/)\n[Artificial Intelligence](https://towardsdatascience.com/tag/artificial-intelligence/)[Fine Tuning](https://towardsdatascience.com/tag/fine-tuning/)[Llm](https://towardsdatascience.com/tag/llm/)[Machine Learning](https://towardsdatascience.com/tag/machine-learning/)[Reinforcement Learning](https://towardsdatascience.com/tag/reinforcement-learning/)\nShare This Article\n  * [](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Ftowardsdatascience.com%2Fhow-grpo-trains-small-language-models-with-verifiable-rewards%2F&title=How%20GRPO%20Trains%20Small%20Language%20Models%20with%20Verifiable%20Rewards)\n  * [](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Ftowardsdatascience.com%2Fhow-grpo-trains-small-language-models-with-verifiable-rewards%2F&title=How%20GRPO%20Trains%20Small%20Language%20Models%20with%20Verifiable%20Rewards)\n  * [](https://x.com/share?url=https%3A%2F%2Ftowardsdatascience.com%2Fhow-grpo-trains-small-language-models-with-verifiable-rewards%2F&text=How%20GRPO%20Trains%20Small%20Language%20Models%20with%20Verifiable%20Rewards)\n\n\nTowards Data Science is a community publication. Submit your insights to reach our global audience and earn through the TDS Author Payment Program.\n[Write for TDS](https://towardsdatascience.com/submissions/)\n## Related Articles\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2022/07/1S83D2f3dDqSMELl3Byo7fw.jpeg)](https://towardsdatascience.com/6-machine-learning-algorithms-to-know-when-learning-data-science-6e45ef139b99/)\n## [6 Machine Learning Algorithms to Know About When Learning Data Science](https://towardsdatascience.com/6-machine-learning-algorithms-to-know-when-learning-data-science-6e45ef139b99/)\n[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)\nShort Explanations of 6 Popular Machine Learning Algorithms\n[Andy McDonald](https://towardsdatascience.com/author/andymcdonaldgeo/)\nJuly 25, 20229 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2023/08/1ap73KM7JcxuNTRp7PzXleA.jpeg)](https://towardsdatascience.com/why-is-feature-scaling-important-in-machine-learning-discussing-6-feature-scaling-techniques-2773bda5be30/)\n## [Why is Feature Scaling Important in Machine Learning? Discussing 6 Feature Scaling Techniques](https://towardsdatascience.com/why-is-feature-scaling-important-in-machine-learning-discussing-6-feature-scaling-techniques-2773bda5be30/)\n[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)\nStandardization, Normalization, Robust Scaling, Mean Normalization, Maximum Absolute Scaling and Vector Unit Length Scaling\n[Rukshan Pramoditha](https://towardsdatascience.com/author/rukshanpramoditha/)\nAugust 15, 202313 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2022/03/0EdK_aduhC-W1AaVp.jpg)](https://towardsdatascience.com/bayesian-machine-learning-and-julia-are-a-match-made-in-heaven-c3c498f2d221/)\n## [Bayesian Machine Learning and Julia are a match made in heaven](https://towardsdatascience.com/bayesian-machine-learning-and-julia-are-a-match-made-in-heaven-c3c498f2d221/)\n[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)\nTwo Julia libraries to make Bayesian Machine Learning a breeze\n[Sarem Seitz](https://towardsdatascience.com/author/sarem-seitz/)\nMarch 8, 20226 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2020/10/1Z7KNvbxZIACaITJ_BfNvow.png)](https://towardsdatascience.com/can-unconditional-language-models-recover-arbitrary-sentences-a-paper-summary-98530f2316c7/)\n## [Can Unconditional Language Models Recover Arbitrary Sentences? - A paper summary](https://towardsdatascience.com/can-unconditional-language-models-recover-arbitrary-sentences-a-paper-summary-98530f2316c7/)\n[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)\nSummary of an unconventional approach towards pre-trained language models to determine if they can function as general-purpose decoders.\n[Devansh Goenka](https://towardsdatascience.com/author/devanshgoenka97/)\nOctober 11, 20206 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2021/12/0gQz_DmIIOSVXxWXd.png)](https://towardsdatascience.com/transfer-learning-covid-19-from-chest-x-rays-classifier-66d6c483fb03/)\n## [Transfer Learning: COVID-19 from Chest X-Rays Classifier](https://towardsdatascience.com/transfer-learning-covid-19-from-chest-x-rays-classifier-66d6c483fb03/)\n[Deep Learning](https://towardsdatascience.com/category/artificial-intelligence/deep-learning/)\nA detailed overview on how to do transfer learning and some theory behind each step.\n[Alfonso Santacruz Garcia](https://towardsdatascience.com/author/ponchosg96/)\nDecember 17, 202111 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/1AbuVabwf4lkPk3U7NK09OA.jpeg)](https://towardsdatascience.com/spicing-up-ice-hockey-with-ai-player-tracking-with-computer-vision-ce9ceec9122a/)\n## [Spicing up Ice Hockey with AI: Player Tracking with Computer Vision](https://towardsdatascience.com/spicing-up-ice-hockey-with-ai-player-tracking-with-computer-vision-ce9ceec9122a/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nUsing PyTorch, computer vision techniques, and a CNN, I worked on a model that tracks players, teams, and basic performance statistics\n[Raul Vizcarra Chirinos](https://towardsdatascience.com/author/raul.vizcarrach/)\nJuly 9, 202433 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/05/0jvAOPCk_61SqJy05.jpg)](https://towardsdatascience.com/starting-ml-product-initiatives-on-the-right-foot-cf24cbe163b3/)\n## [Starting ML Product Initiatives on the Right Foot](https://towardsdatascience.com/starting-ml-product-initiatives-on-the-right-foot-cf24cbe163b3/)\n[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)\nTop 3 lessons learned: the problem, the size, and the data\n[Anna Via](https://towardsdatascience.com/author/annaviaba/)\nMay 2, 20249 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2020/08/0sPTpQQiQ0FRL56ci-scaled.jpg)](https://towardsdatascience.com/kernel-regression-from-scratch-in-python-ea0615b23918/)\n## [Kernel Regression from Scratch in Python](https://towardsdatascience.com/kernel-regression-from-scratch-in-python-ea0615b23918/)\n[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)\nEveryone knows Linear Regression, but do you know Kernel Regression?\n[Kunj Mehta](https://towardsdatascience.com/author/kunjmehta10/)\nAugust 20, 20206 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2025/10/Screenshot_2025-10-09_at_14.05.46-scaled-e1760955714214.png)](https://towardsdatascience.com/federated-learning-and-custom-aggregation-schemes/)\n## [Federated Learning and Custom Aggregation Schemes](https://towardsdatascience.com/federated-learning-and-custom-aggregation-schemes/)\n[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)\nA practical guide to designing and analyzing robust aggregation strategies\n[Salman Toor](https://towardsdatascience.com/author/salman.toor/)\nOctober 22, 202510 min read\n\n\n  * [YouTube](https://www.youtube.com/c/TowardsDataScience)\n  * [X](https://x.com/TDataScience)\n  * [LinkedIn](https://www.linkedin.com/company/towards-data-science/)\n  * [Threads](https://www.threads.net/@towardsdatascience)\n  * [Bluesky](https://bsky.app/profile/towardsdatascience.com)\n\n\n[](https://towardsdatascience.com/)\nYour home for data science and AI. The world's leading publication for data science, data analytics, data engineering, machine learning, and artificial intelligence professionals.\nSubscribe to Our Newsletter[Write For TDS](https://towardsdatascience.com/submissions/)•[About](https://towardsdatascience.com/about-towards-data-science-d691af11cc2f/)•[Advertise](https://contact.towardsdatascience.com/advertise-with-towards-data-science)•[Privacy Policy](https://towardsdatascience.com/privacy-policy/)•[Terms of Use](https://towardsdatascience.com/website-terms-of-use/)\n© Insight Media Group, LLC 2026•[The New Stack](https://thenewstack.io)•[roadmap.sh](https://roadmap.sh)•[Creator Network](https://insightmediagroup.io/creator-network)\n####  Recommended Articles \nClose\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607686/image?etag=1782161464448&width=500&height=500) How Relevance Models Foreshadowed Transformers for NLP ](https://towardsdatascience.com/how-relevance-models-foreshadowed-transformers-for-nlp/ \"How Relevance Models Foreshadowed Transformers for NLP\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607639/image?etag=1781250125848&width=500&height=500) Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1 ](https://towardsdatascience.com/javascript-fatigue-you-dont-need-js-to-build-chatgpt/ \"Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607930/image?etag=1782124566054&width=500&height=500) The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs ](https://towardsdatascience.com/subset-sum-problem-solved-in-linear-time-for-dense-enough-inputs/ \"The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/3660/image?etag=1780176246070&width=500&height=500) Does Your Company Have a Data Strategy? ](https://towardsdatascience.com/does-your-company-have-a-data-strategy-e8944dbec4ae/ \"Does Your Company Have a Data Strategy?\")\n\n\n",
  "body_base_path": "attachments/9d0c01073e9a/pages/",
  "body_markdown_path": "attachments/9d0c01073e9a/pages/archived-body.md",
  "local_html": "attachments/9d0c01073e9a/pages/archived-body.html",
  "body_source": "prior_capture"
}