acceptodds
Published as a conference paper at NeurIPS 2026

Cost-Aware Learning

Clara Mohri, Amir Globerson, Haim Kaplan, Tomer Koren, Yishay Mansour

Abstract

We consider the problem of Cost-Aware Learning, where sampling different components of a finite-sum objective incurs different costs. The objective is to reach a target error while minimizing the total cost. We propose Cost-Aware SGD, which uses a distribution based on gradient norms and costs to sample components. We provide a thorough analysis of this algorithm, including cost-improvement bounds over baselines, a characterization of distribution proxy sub-optimality, and a lower bound. We apply our theoretical insights to reinforcement learning with language models, where the computational cost of sequence-level policy gradients varies with length. We find that the advantage magnitude serves as a high-fidelity proxy for gradient norms, and use this to introduce Cost-Aware GRPO. Empirical results on 1.5B, 4B, and 8B LLMs demonstrate that this algorithm significantly reduces the tokens used in policy optimization while matching or exceeding baseline accuracy.

Keywords:
Sydney, Main Track

Reviews

Among:
Shape:
123456this paper, Bottom 17%
Figure 1. Mean review rating of the reviewed papers at NeurIPS 2026. This paper averages 4.00 over 3 reviews, above 17% of the others.
Reviewer_yQ41OpenReview ↗
Rating
4
Clarity
3
Confidence
3
Originality
3
Quality
3
Significance
3
Read review
Summary

This paper studies a cost-aware version of finite-sum stochastic optimization. The problem is to minimize f(x)=1N∑i=1Nfi(x)f(x) = \frac{1}{N}\sum_{i=1}^N f_i(x),where each component fif_i has a different evaluation cost cic_i. Querying the gradient of a long or expensive component may therefore be much more costly than querying the gradient of a short or cheap component. The goal is not only to minimize the number of stochastic-gradient steps, but rather to minimize the total computational cost required to find a point xx such that E[f(x)−f(x⋆)]≤ε.\mathbb{E}\bigl[f(x) - f(x^\star)\bigr] \leq \varepsilon . In this setting, the authors analyze stochastic-gradient methods that sample component ii according to a distribution pip_i. For convex and strongly convex objectives, they derive an optimal cost-aware sampling distribution of the form pi⋆∝Gici,p_i^\star \propto \frac{G_i}{\sqrt{c_i}}, where GiG_i is the Lipschitz constant of component fif_i/ The paper compares this rule with uniform sampling and variance-based sampling, studies the effect of using proxy distributions, and proves a lower bound showing that the proposed dependence on the costs is essentially unavoidable.

The second part of the paper applies these ideas to policy optimization for language models, specifically GRPO. In this setting, each sample corresponds to a prompt-response pair, and its cost is related to the total token length of the prompt and the generated response. Since computing the true gradient norm of each sample would be expensive, the authors use the magnitude of the advantage, AiA_i, as a proxy for GiG_i This leads to a Cost-Aware GRPO algorithm that samples examples according to a distribution proportional to ∣Ai∣ci,\frac{|A_i|}{\sqrt{c_i}}, with importance weighting to correct for the sampling bias. Experiments on mathematical reasoning benchmarks with several Qwen models suggest that this approach can substantially reduce the number of policy-optimization tokens while matching or sometimes improving the accuracy of standard GRPO. The paper also includes ablations on noisy proxies, alternative objectives, and smoothed sampling variants.

Strengths and weaknesses

Strengths

S1- The paper addresses a practically important issue. In LLM post-training, computational cost is not uniform across samples: long responses are much more expensive than short ones. Standard SGD theory usually counts iterations and ignores this heterogeneity. The paper’s formulation is therefore well motivated and relevant to modern RLHF/RLVR-style training.

S2- The link to GRPO is interesting. The observation that ∣Ai∣|A_i| can serve as a proxy for the importance of a sample is natural, and the empirical correlation plots suggest that this proxy is meaningful in the tested settings. This makes the method simple and potentially easy to implement in existing GRPO pipelines.

S3- The experiments are promising. The paper reports improvements across several settings: Qwen2.5-Math-1.5B, Qwen3-4B, and Qwen3-8B. The reported reductions in policy-optimization tokens are substantial, while the final accuracy is preserved or slightly improved. The ablations on noisy proxies and on CISPO also strengthen the empirical story

Weaknesses

W1- The main theoretical analysis is for convex or strongly convex finite-sum optimization, while the main application is GRPO training for language models, which is highly non-convex, non-stationary, and involves on-policy data generation. The paper acknowledges this gap, but the connection between the theory and the GRPO algorithm remains somewhat informal.

W2- A natural question is whether ∣Ai∣|A_i| is the best proxy for the sample importance GiG_i. In policy-gradient methods, the norm of the sample gradient is closer to ∣Ai∣ ∥∇θlog⁡πθ(yi∣xi)∥,|A_i|\,\|\nabla_\theta \log \pi_\theta(y_i\mid x_i)\|, rather than ∣Ai∣|A_i| alone. This quantity would provide a more faithful proxy for GiG_i, since it accounts not only for the advantage magnitude but also for the sensitivity of the policy to the sampled response. Of course, computing per-sample gradient norms may be expensive and could reduce the practical benefit of the method. Still, it would be useful for the paper to discuss this alternative proxy, or to empirically compare AiA_i with ∣Ai∣∥∇θlog⁡πθ(yi∣xi)∥|A_i|\|\nabla_\theta \log \pi_\theta(y_i\mid x_i)\| on a small-scale setting.

W3- The evaluation focuses mainly on math reasoning benchmarks, especially AIME, AMC, MATH, and GSM8K. This is a reasonable setting for GRPO, but it leaves open whether the method generalizes to broader RLHF/RLVR tasks. Since the paper presents Cost-Aware GRPO as a general approach, broader experiments would strengthen the claim.

Questions

Q1- The theoretical analysis is developed for convex or strongly convex finite-sum optimization, while the main application is GRPO for language models, which is non-convex, non-stationary, and on-policy. Do the authors see a possible path to extending the analysis to this more realistic setting?

Q2- The paper uses |A_i| as a proxy for GiG_i. However, in policy-gradient methods, the norm of the sample gradient is more directly related to ∣Ai∣,∣∇θlog⁡πθ(yi∣xi)∣.|A_i|,|\nabla_\theta \log \pi_\theta(y_i\mid x_i)|. Did the authors consider using this quantity, or an approximation of it, as a proxy for GiG_i? If not, could they explain why ∣Ai∣|A_i| alone is sufficient in practice?

Q3- The empirical evaluation focuses mainly on mathematical reasoning benchmarks such as AIME, AMC, MATH, and GSM8K. Do the authors expect Cost-Aware GRPO to generalize to broader RLHF/RLVR tasks, such as instruction following, coding, preference optimization, or safety alignment? Additional experiments beyond math reasoning would help support the generality of the method.

Limitations

yes

Paper formatting concerns

No formatting concern

Final justification

The rebuttal and subsequent discussion addressed some of my initial concerns, in particular through the additional TACO experiment and the clarification regarding the use of the advantage magnitude as a proxy for the per-sample gradient norm. These additions strengthen the empirical case and provide useful evidence that the method may extend beyond mathematical reasoning.

However, my main concern remains only partially resolved. The theoretical analysis is developed in a substantially simpler optimization setting, and the connection to the non-convex, non-stationary GRPO setting remains heuristic. The authors provide useful arguments for why the same sampling principle may remain relevant, but they do not establish a convincing theoretical bridge to the actual algorithmic setting. As a result, I still view the theoretical contribution as somewhat disconnected from the empirical contribution of the paper.

Overall, I find this submission interesting and practically promising, but with a noticeable gap between the theory and the main application. The rebuttal improved my view of the empirical contribution but did not fully resolve my central theoretical concern. I therefore maintain my score of 4.

1 comment

Thank you to the reviewer for the thorough and constructive comments.


W1 — Connection between the convex theory and the GRPO setting

While our analysis is focused on the convex setting, Appendix F provides insight into how and why we believe the theory extends to the more realistic, non-convex, setting. Crucially, the term to minimize remains S(p)C(p)S(p)C(p) regardless of the setting, which is why we hypothesize that cost-aware learning is empirically effective in the context of GRPO. Thus, although our analysis begins in the convex setting, these insights suggest why it translates to non-convex settings in practice. We will emphasize these findings in the main text of the final manuscript.


W2 — Alternative proxy

The reviewer is correct that a better proxy than ∣Ai∣|A_i| may exist, and that the true gradient magnitude would be even better. The reviewer's suggestion ∣Ai∣⋅∥∇log⁡π∥|A_i| \cdot \lVert \nabla \log \pi \rVert makes explicit that the proxy ∣Ai∣|A_i| for GiG_i omits the term ∥∇log⁡π∥\lVert \nabla \log \pi \rVert. However, that term is precisely the gradient-norm computation whose cost we aim to avoid. Computing it prior to sampling would defeat the purpose of cost-aware learning. ∣Ai∣|A_i| is sufficient in practice because it is an extremely cheap proxy in our setting and because of its strong sub-optimality metrics.

Regardless, this comment is addressed in the paper in two ways:

  1. We report sub-optimality metrics (Theorem 4.2) showing the cost-biased χ2\chi^2-divergence between ∣Ai∣|A_i| and the true gradient norm is low across all experiments, implying that our experiments incur cost close to the cost one would incur using the oracle-optimal sampling distribution.
  2. Fig. 2 is an oracle setting in which we use the true gradient norm on a synthetic task. The figure shows the desirable properties of using the exact gradient norm in order to maximally reduce cost.

Due to time constraints, we cannot perform a full LLM training run using the suggested proxy within the rebuttal window, but we will do this for the 1.5B model in the final manuscript to show the comparison. This would be purely for research purposes; we would not suggest it as a practical method.


W3 — Generalization beyond math reasoning

We see no reason cost-aware learning should not extend beyond math reasoning. To this end, we present new results for the rebuttal, where we trained the 1.5B model on the TACO dataset. This is an interesting setting because (1) it is a different task (code generation) and (2) the rewards are not 0/1 (reward is the fraction of test cases passed). Thus it tests the generality of cost-aware learning in two different ways.

We see strong indications that cost-aware learning generalizes to other tasks:

  • Low sub-optimality under a new reward signal. The χ2\chi^2 sub-optimality of using ∣Ai∣|A_i| as a proxy averages 0.06 throughout training, indicating low sub-optimality in a different task and a different reward signal.
  • Consistent efficiency gains. We report the reduction in resources to reach the baseline's peak reward below, using training reward as a proxy for held-out accuracy (due to time constraints). We will complete these with mean@32 evaluations on the held-out TACO test set in the final manuscript.

Percent reductions vs. baseline to reach the baseline's peak reward:

MetricCA-GRPO (p∗p^*)CA-GRPO (α=0.01\alpha=0.01)
Policy-optimization FLOPs21.9%13.4%
End-to-end FLOPs21.3%12.6%
Training steps15.2%10.1%

Overall, cost-aware learning appears similarly effective in reducing FLOPs to reach peak reward on this new task. Due to this result, we conclude there exists empirical evidence that cost-aware learning would generalize to other tasks and reward structures.


In light of the above, we kindly request that the reviewer consider raising their score.

Reviewer_T5ReOpenReview ↗
Rating
4
Clarity
3
Confidence
2
Originality
3
Quality
3
Significance
3
Read review
Summary

This paper addresses the problem of optimal (effective) importance sampling for SGD in a cost-aware setting. This setting assumes that, for each component of the loss function (or, equivalently, each sample in machine learning context), there is known computational cost c of gradient g, and this cost varies among samples. The goal is to optimize the cost-efficiency of the optimization process. Authors theoretically derive that sampling probability proportional to |g|/\sqrt{c} minimizes the variance of the gradient estimation and optimizes the guaranteed convergence rate. This result is a direct generalization of the classical importance sampling approach for SGD with (implicitly assumed) uniform sample costs.

In the second part of the paper, authors apply the proposed cost-aware importance sampling for learning reasoning LLMs via GRPO, where the cost is proportional to the length of the text. Empirical results show reasonable improvement in terms of convergence rate.

Strengths and weaknesses

Strengths:

  • A novel optimization setting
  • A reasonable in-demand task
  • Theoretical guarantees and a transparent application

Weaknesses:

  • Theoretical analysis is an incremental development of widely-known results
  • Empirical improvements are rather limited (up to 50% of saved computations).
Questions

No questions

Limitations

No

Paper formatting concerns

No

Reviewer_oLPiOpenReview ↗
Rating
4
Clarity
3
Confidence
4
Originality
3
Quality
3
Significance
2
Read review
Summary

After generating rollouts in GRPO, this paper subsamples the rollouts (preferring those with large advantage magnitude and short length, via p_i ∝ |A_i|/√c_i with importance reweighting) so that fewer tokens enter the policy-gradient step, aiming to improve training efficiency. The choice is backed by a cost-aware SGD analysis (optimal sampling ∝ G_i/√c_i, with |A_i| used as a proxy for the gradient norm). Experiments on Qwen2.5-Math-1.5B and Qwen3-4B/8B (DAPO; AIME/AMC/MATH500/GSM8K) report reaching matched accuracy with substantially fewer policy-optimization tokens.

Strengths and weaknesses

Strengths

  • Thorough and well-rounded experiments. The evaluation spans three model scales (1.5B/4B/8B) and four benchmarks (AIME/AMC/MATH500/GSM8K), and is complemented by ablations on proxy noise, hyperparameter choices, the smoothed sampling variant, and generalization to a different objective (CISPO). The empirical study is more complete than is typical for a method paper of this scope.

  • Sound and self-contained theory. The cost-aware SGD analysis is not just a heuristic: it provides expected-total-cost upper bounds (convex and strongly convex), explicit cost-improvement ratios over uniform and pure variance-reduction baselines, a χ²-divergence characterization of proxy sub-optimality, and a matching information-theoretic lower bound. The proxy is also validated empirically (near-1 Pearson correlation, near-0 cost-biased χ²-divergence between |A_i| and the true gradient norm).

  • Some novelty, though moderate. Casting sampling as a cost-vs-information tradeoff and deriving ∝ G_i/√c_i is a clean reframing, and the practical insight that the advantage magnitude |A_i| serves as a near-free proxy for the gradient norm in GRPO is the most original and useful contribution. That said, the underlying machinery (importance sampling for variance reduction, gradient-norm-proportional sampling) is classical, so the novelty is incremental rather than fundamental — the main step is extending known tools to the heterogeneous-cost setting and connecting them to LLM RL.

Weaknesses

  • No end-to-end efficiency evidence; the expensive stage (rollout generation) is excluded from the metric. The paper's headline savings ("up to 51% fewer tokens") are measured solely as tokens used in policy optimization (a backward-pass FLOPs proxy). But all rollouts are still fully generated — generation is not reduced at all — and in RL training for LLMs rollout/inference is often the dominant cost. The paper reports no wall-clock time, no throughput, and no end-to-end FLOPs comparison between Cost-Aware GRPO and the baselines (only absolute per-run durations are disclosed). As a result, the central "efficiency" claim is established only on one component of the pipeline, and the practically relevant question — how much faster is training overall — is left unanswered.

  • The sampler is structurally biased toward short responses, and the debiasing only holds in the mean. Since c_i is the token count and p_i ∝ |A_i|/√c_i, shorter responses are systematically more likely to be selected into the gradient step. The importance weight 1/p_i is constructed to cancel this bias in expectation (Eq. 22 is an unbiased estimator of the full GRPO objective, and sampling is with replacement, so the construction is correct). However, the cancellation holds only for the mean gradient: long responses are sampled rarely but with large 1/p_i weights, so their signal arrives in high-variance bursts. This interacts badly with two mechanisms the paper does use — PPO-style clipping and the "re-center importance weights around 1" step (App. G.2), both of which can cap or mute those rare large contributions — leaving a plausible residual shortening pressure on the policy. Crucially, no output-length drift over training is reported, which is exactly where this effect would surface.

  • Higher gradient variance by construction, with no diagnostic. The authors' own analysis notes the variance-optimal sampler is p ∝ G_i, whereas the cost-aware sampler p ∝ G_i/√c_i deliberately trades variance for cost. The paper provides no gradient-variance or training-stability diagnostic to confirm this trade is benign, relying solely on end-task accuracy.

  • The re-centering normalization is under-specified. App. G.2 claims re-centering the importance weights "simply multiplies the objective by a constant." This is true only if the normalizer is the population mean weight (θ-independent, since p is computed from the frozen π_old). If instead it is the per-mini-batch empirical mean, the estimator becomes self-normalized importance sampling, which is biased (consistent only as batch size → ∞). The paper does not state which is used.

Questions

see weakness

Limitations

see weakness

Paper formatting concerns

no

Final justification

According to the response, I decided to raise my score to 4 as the end to end Flops is of advantages to baseline, which answer my core question of the paper

1 comment

Thank you to the reviewer for the thorough and constructive comments.


W1 — "No end-to-end efficiency evidence; the expensive stage (rollout generation) is excluded from the metric."

Wall-clock time

We report below the cumulative wall-clock time of training steps here and are happy to update the paper with this information as well.

We did not focus on wall-clock time in the paper mainly because wall-clock time is not always a stable metric across nodes, and depends on various hyperparameters that could change based on implementation.

End-to-end FLOPs comparison

While the focus of this paper is on policy-optimization FLOPs, we agree with the reviewer that end-to-end FLOPs are relevant given that generation is a computational burden of RL for LLMs. We provide a high-level description here and plan to update the final manuscript with detailed plots.

We compute FLOPs for each training step as follows. Generation FLOPs are estimated as

    2P × (L_prompt + L_resp) × B × M

where:

  • P — number of parameters
  • L_prompt — mean prompt length of the batch
  • L_resp — mean response length of the batch
  • B — batch size
  • M — number of rollouts per prompt

This reflects the cost of a single autoregressive forward pass per generated token. Training FLOPs are estimated as 6PT, where T is the number of tokens trained on in the backward pass, using the standard 6× factor to account for both forward and backward passes. Cumulative FLOPs are summed over all steps.

Summary of reductions to reach the baseline's peak accuracy

In the following table, we report reductions in terms of wall-clock time, end-to-end FLOPs, and training steps achieved by running cost-aware learning over the baseline. We will add this information in plot format in the final manuscript. We find cost-aware sampling to be highly favorable across metrics.

SettingWall-clockEnd-to-end FLOPsTraining steps
1.5B GRPO27%28%29%
1.5B ZVF (α=0.01\alpha = 0.01)10%11%9%
4B GRPO29%32%35%
8B GRPO¹28%24%25%

¹ Relaxed peak accuracy as in Fig. 1.


W2 — "The sampler is structurally biased toward short responses."

The sampler is only biased toward shorter responses if they also have high advantage magnitude. If they do not, shorter responses would not be sampled as much. We respond by reporting 1) average generated response lengths, and 2) average response length trained on per step. Below, we report the average response length generated by the model at baseline peak accuracy.

Average generated response length in tokens (cost-aware vs. baseline):

SettingCost-awareBaselineNote
1.5B GRPO913888CA longer at baseline's peak accuracy
1.5B ZVF~920–944~920–944Nearly identical across methods
4B GRPO31083179CA slightly shorter
8B GRPO29323117CA slightly shorter

Average response length selected per step

Next, we examined the average number of tokens trained on per step to understand whether cost-aware sampling is structurally biased toward shorter responses. We found that cost-aware sampling selects slightly longer responses on average: for example, on the 8B run, the average tokens trained on per step is 14% more than the baseline (the largest difference we observed). This indicates that cost-aware sampling makes the tradeoff between cost and advantage magnitude by slightly favoring high advantage magnitude — explained in part by cost appearing in the denominator of the sampling distribution with a square-root factor. Despite spending slightly more FLOPs per backward pass, it remains the more FLOP-efficient choice overall.

We will update the final manuscript with plots presenting the above information.

Stress test: doubling the response budget

To test whether longer response budgets amplify the effect the reviewer describes, we present results from an additional experiment with the 8B model, where we double the maximum response length during generation. We also report resource consumption reductions achieved by cost-aware sampling for completeness.

MetricResult
Avg. generated response length (CA vs. baseline)5% shorter
Avg. tokens in backward pass per step (CA vs. baseline)12% more
Total training FLOPs reduction30%
Wall-clock reduction29%
Training-step reduction31%
Baseline peak accuracy (mean@32, AIME)68.90%
Cost-aware peak accuracy (mean@32, AIME)68.93%

Based on these findings, the sampler is selecting slightly longer responses on average. Meanwhile, at peak accuracy, the average generated response length is marginally shorter when the model was trained with cost-aware sampling as compared to the baseline. Thus, we conclude that, in practice, cost-aware sampling does not bias toward shorter responses during sampling and that generated response length differences are negligible.

On the two mechanisms

Regarding the point that this "interacts badly with two mechanisms the paper does use":

  1. We do not apply clipping to the importance weights pertaining to sequence-level inclusion (see G.3 for the detailed expression).
  2. The importance weights are re-centered around 1 at the population level.

W3 — "Higher gradient variance by construction, with no diagnostic."

We agree that a more comprehensive picture of training stability and gradient variance strengthens the paper. To this end, we provide analysis on saved checkpoints for the 1.5B and 8B runs. We compute the gradient variance of one training step under (a) uniform sampling, (b) cost-aware sampling, and (c) oracle variance-reduction sampling (pi∝Gip_i \propto G_i, the variance-optimal distribution the reviewer notes). We report ratios of gradient variance (mean and standard deviation) across all checkpoints below.

Ratio1.5B GRPO1.5B ZVF8B
Uniform ÷ cost-aware3.4436 ± 1.2633.5066 ± 1.36804.6933 ± 1.3736
Cost-aware ÷ oracle variance-reduction1.1374 ± 0.03471.1980 ± 0.17901.0252 ± 0.0105

Cost-aware sampling yields a significant reduction in gradient variance over uniform sampling (more than 3.4×). Relative to the oracle variance-reduction sampler, additional variance reduction would be 1.03×–1.14×. This shows the variance-for-cost trade-off is close to the variance-optimal sampler despite also reducing cost.

“Training-stability diagnostic”

In order to provide training stability diagnostics, we also describe training reward and entropy (we cannot share plots in the rebuttal). Training reward curves are very stable (in the sense of no spikes, but still increasing throughout) for the cost-aware method, tracking the baseline but slightly above due to improved performance. Response entropy is also stable throughout. We will add these plots to the final manuscript for all runs to improve transparency on the influence of cost-aware sampling on training dynamics and stability. Overall, we find cost-aware training to be a stable training procedure.


W4 — "The re-centering normalization is under-specified."

To reiterate for completeness: re-centering normalization is done at the population level, using weights computed from the frozen πold\pi_\text{old}, which makes the normalizer θ-independent. It therefore multiplies the objective by a constant and the estimator remains unbiased. We will specify this thoroughly in the final manuscript.


Summary

WeaknessWhat we provide
W1End-to-end FLOPs and wall-clock time at all scales.
W2Evidence that the sampler does not, in practice, bias toward shorter responses (generated response length analysis + tokens-per-step analysis + doubled-budget stress test).
W3Gradient variance diagnostics.
W4Clarification of the population-level, θ-independent re-centering.

In light of the above, we kindly request that the reviewer consider raising their score.

Comments on the paper

1 comment
Meta-review

The authors study cost-aware stochastic optimization with applications in LLM post training. The theoretical contributions are sound, and the experiments are comprehensive. That said, theoretical results and proofs are rather standard. I am not too concerned about the theory to practice gap. Overall, the paper makes important contributions both in theory and practice.

If accepted, please incorporate reviewers' feedback in the final version.

A minor comment: I think Figure 1's argument (2) is a stretch, unless the authors show confidence bounds over multiple runs and the different being shown is statistically meaningful. The performance of GRPO goes up and down after ~250M tokens, meaning that it is probably not improving. it is just showing random fluctuations. We cannot reject the possibility that the location of the peak performance of GRPO would be very different if the experiments were run many many more times. The difference between GRPO at ~250M vs ~420M in the plot is not significant enough to care about anyways..

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Related papers

Loading the map…

Discussion (0)

Sign in to comment.