Planet Python
Follow
Armin Ronacher: Better Models: Worse Tools
Recent Anthropic models, specifically Opus 4.8 and Sonnet 5, are exhibiting an unusual issue with Pi's edit tool. These advanced models sometimes generate tool calls with additional, invented fields within the nested edits array. While the core edit operation is usually correct, these extraneous arguments cause Pi to reject the tool call due to schema mismatches. This problem is more prevalent in newer, state-of-the-art models compared to their older counterparts.Tool calls are essentially text-based signals interpreted by the API, not a magical process. Models are trained on specific formats and emit text that the system recognizes as a command to call a tool with particular arguments. The text describes an edit tool that expects a specific payload structure for file path and edits. Without constraints, models rely on learned conventions for generating these tool calls.The failure manifests as the models appending invented keys like "requireUnique" or "oldText2" to the edit objects. These fabricated fields, despite the actual text to be edited being correct, lead to validation errors. The problem appears context-dependent, often occurring in agentic histories with extensive dialogue rather than simple, single-turn prompts. It was noted that using strict tool invocation significantly reduced or eliminated the failure rate in testing.The author hypothesizes this regression is a training artifact, suggesting newer models are trained on environments similar to Claude Code's internal harness. This harness is notably forgiving, handling malformed tool calls by retrying or filtering unknown keys. This forgiving environment may inadvertently teach models that adding extraneous fields is acceptable if the core task is completed. Such training can create a strong prior for a specific tool schema, making models less adaptable to different or stricter schema definitions like Pi's.The "Slop Harness," referring to Claude Code's forgiving nature, includes features like handling leaked markup, repairing Unicode sequences, and accepting parameter aliases. It also silently discards unexpected keys and avoids strict mode, which has its own complexity limitations. The author expresses concern that tool schemas may not be neutral for Anthropic models, and that models might be implicitly penalized for deviating from a specific, undocumented, forgiving tool ecology. This contrasts with models like Codex, which seem to adapt better to various tool shapes. The issue highlights how reinforcement learning in specific environments can shape model behavior in unexpected ways.