techlist.io

Tool Use

2 posts

Microsoft2026-01-284 min readCurated summary

Diagnosing instability in production-scale agent reinforcement learning

Hugging Face has integrated its Post-Training Toolkit into TRL, bringing production-ready diagnostics to reinforcement learning and agent post-training pipelines. The work identifies a late-phase instability specific to tool-using, on-policy agents: variance can grow in post-tool contexts even while loss, reward, entropy, and global KL remain stable. Targeted tail, distributional, and effective-sample-size diagnostics can expose this failure before it becomes divergence. ## Production Monitoring for Long-Running Agents - Modern agent training runs over long horizons, uses external tools, and adapts continuously. - Failures often develop gradually rather than appearing as a single catastrophic event. - Standard aggregate metrics can hide rare but increasingly severe updates. - The proposed monitoring approach: - Computes diagnostics in-stream. - Separates text-only and post-tool interactions. - Aggregates statistics across workers. - Uses lightweight rolling windows and percentile tracking at fixed intervals. ## Tool-Conditioned Variance Amplification - Tool calls expand the state space through external transitions, exposing the policy to contexts it may rarely encounter in the reference distribution. - Training states can be modeled as: `d(s) = (1−α)·d_text(s) + α·d_tool(s)` - As the proportion of tool-conditioned states, `α`, increases, more updates occur where the reference policy assigns low probability to sampled actions. - This causes importance-weighted updates to develop increasingly large tails. - The mechanism is distinct from global entropy collapse or optimizer instability, though those factors may interact with it. ## Minimal Reproduction and Tail Diagnostics - A small on-policy experiment with an instruction-tuned open-weight model reproduced the pattern. - The 95th percentile of absolute per-token log-ratios, `|r|`, was tracked separately for text-only and post-tool contexts. - Findings included: - Text-only tail magnitudes remained stable or declined. - Post-tool tails grew steadily under fixed-policy baselines. - Drift-aware training substantially reduced tail growth. - Constraining tool outputs also suppressed the effect. - Aggregate loss, reward, and entropy remained stable while the tail was expanding. ## Distributional Shift in the Right Tail - Empirical CDFs across early, middle, and late training showed a change in distribution shape rather than a simple threshold crossing. - In tool-conditioned contexts: - The right tail flattened and stretched. - More probability mass moved toward high-magnitude updates. - Drift-aware baselines muted or reversed the shift. - This supports a distributional explanation rather than an artifact of choosing a particular percentile. ## Importance Ratios and Effective Sample Size - For ratio-based on-policy objectives, gradient variance is related to: `Var[ĝ] ∝ E[(π_θ(a|s) / π_ref(a|s))²]` - When `π_ref(a|s)` is small in tool-conditioned states, a small number of updates can dominate the estimator. - Larger batches and improved baselines may reduce noise but do not fix poor support overlap. - Effective sample size (ESS) provides a supporting signal: - ESS declines as importance weights become concentrated. - It is sensitive to window size and batch structure. - Its trends align with post-tool tail growth, but absolute values should not be over-interpreted. ## Delayed Failure and Misdiagnosis - Instability appears first in tool-conditioned contexts and may remain invisible in global metrics for a long time. - By the time aggregate metrics change, substantial variance amplification may already have accumulated. - The problem is often incorrectly attributed solely to optimizer behavior or inadequate global variance reduction. - Such interventions may delay failure without addressing the underlying support mismatch. - The mechanism is less pronounced when tool outputs are tightly constrained, policies are effectively frozen after tool calls, or interaction diversity plateaus early. The practical recommendation is to add slice-aware, tail-focused diagnostics to production TRL pipelines. Monitoring post-tool log-ratio percentiles, distributional changes, and supporting ESS trends can provide an early warning system for instability that global loss, reward, entropy, and KL metrics miss.

Anthropic2025-03-203 min readCurated summary

The "think" tool for complex tool use

# The "Think" Tool for Claude Agents Anthropic found that giving Claude a dedicated "think" tool, a scratchpad it can write to mid-response, improves agentic tool use. The tool helps with following policies, making consistent decisions, and handling multi-step problems, and it requires little implementation effort. The post notes that extended thinking now covers most of these cases, so the dedicated tool is recommended mainly for specific scenarios. The benefits come from giving Claude room to reason about new information gathered from tool outputs, not from extended reasoning before it acts. ## How the "Think" Tool Differs from Extended Thinking - Extended thinking happens before Claude generates a response and plans its approach in advance. - The "think" tool happens during response generation, letting Claude pause after receiving tool results to check whether it has what it needs to continue. - The tool suits complex tool calls, long tool-call chains, policy-heavy environments, and sequential decisions where mistakes are costly. - Extended thinking suits simpler tool use, non-sequential calls, and tasks like coding, math, and physics that don't involve tools. - The tool is defined with a single `thought` string input. It doesn't obtain new information or change any state. It only logs the thought. ## Results on τ-Bench τ-bench simulates customer service conversations and measures pass^k, the probability that all k trials of a task succeed, which captures consistency. - **Airline domain (the hardest):** The "think" tool with an optimized prompt reached 0.570 pass^1, versus 0.370 for the baseline, a 54% relative improvement. The prompt included worked examples of how to reason about policies. The tool alone and extended thinking performed similarly, both better than baseline but well behind the combined approach. - **Retail domain (easier):** The "think" tool alone reached 0.812 pass^1, versus 0.783 for the baseline, with no extra prompting needed. - Gains held up across k=1 to k=5, which points to better handling of edge cases and more consistent policy adherence. ## Results on SWE-Bench - A "think" tool with a description tailored to software debugging was added to the SWE-bench setup for Claude 3.7 Sonnet, which contributed to a state-of-the-art score of 0.623. - The isolated effect was a 1.6% average improvement, statistically significant (Welch's t-test, p < .001). ## Implementation Guidance - **Use it for:** tool output analysis that may require backtracking, policy-heavy environments requiring compliance checks, and sequential decisions where each step depends on the last. - **Skip it for:** single or parallel tool calls, and simple instruction following where default behavior is already adequate. - **Prompting:** Domain-specific examples help the most on difficult tasks. Examples cover the expected level of detail, how to break instructions into steps, decision trees, and checks for missing information. - **Placement:** For long or complex guidance, put instructions in the system prompt rather than the tool description. - **Costs and risks:** The tool adds prompt length and output tokens. It doesn't change external behavior unless Claude calls it, so it's low-risk to add. The post concludes that the "think" tool is not a universal fix, but for the right workloads it offers meaningful reliability gains with minimal implementation work. The authors also note that the results generalize to Claude 3.5 Sonnet (New).