Large language models (LLMs) can modify JSON documents through natural language commands, but current approaches regenerate entire structures for each edit, resulting in computational inefficiency. We present JSON Whisperer, a framework that enables LLMs to generate RFC 6902 diff patches-expressing only the necessary modifications-rather than complete documents. We identify two key challenges in patch-based editing: (1) LLMs often miss related updates when generating isolated patches, and (2) array manipulations require tracking index shifts across operations, which LLMs handle poorly. To address these issues, we introduce EASE (Explicitly Addressed Sequence Encoding), which transforms arrays into dictionaries with stable keys, eliminating index arithmetic complexities. Our evaluation shows that patch generation with EASE reduces token usage by 31% while maintaining edit quality within 5% of full regeneration with particular gains for complex instructions and list manipulations. The dataset is available at: https://github.com/emnlp2025/JSON-Whisperer/
翻译:大型语言模型(LLMs)能够通过自然语言指令修改JSON文档,但现有方法在每次编辑时都会重新生成整个结构,导致计算效率低下。本文提出JSON Whisperer框架,使LLMs能够生成RFC 6902差异补丁(仅表达必要的修改内容)而非完整文档。我们识别出基于补丁的编辑面临两大关键挑战:(1)LLMs在生成独立补丁时经常遗漏相关更新;(2)数组操作需要跨操作跟踪索引偏移,而LLMs对此处理能力较差。为解决这些问题,我们引入EASE(显式寻址序列编码)技术,将数组转换为具有稳定键的字典,从而消除索引运算的复杂性。评估结果表明:采用EASE的补丁生成方法在保持编辑质量(与完整再生成相比差异在5%以内)的同时,将令牌使用量降低31%,在复杂指令和列表操作场景中提升尤为显著。数据集已发布于:https://github.com/emnlp2025/JSON-Whisperer/