Object Aligner: A Configurable JSON Schema Similarity Score for Graphs, Applied to LLM Prompt Optimization
作者: Jan Drchal
分类: cs.CL, cs.AI, cs.LG
发布日期: 2026-07-02
备注: 28 pages, This is a submitted version of a manuscript under review at IEEE Access; it has not been peer reviewed
💡 一句话要点
提出Object Aligner以解决JSON相似性评分问题
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: JSON相似性评分 大型语言模型 信息提取 工具调用 知识图谱构建 引用对齐 图同构
📋 核心要点
- 现有方法在评估JSON输出时存在精确匹配不稳健、文本相似性忽略结构等挑战。
- 论文提出Object Aligner,通过递归对齐JSON树结构并引入引用对齐,提供确定性的相似性评分。
- 实验表明,Object Aligner在多个数据集上作为GEPA提示优化器的奖励机制表现良好,提升了模型的输出质量。
📝 摘要(中文)
大型语言模型(LLMs)常被要求生成符合固定JSON模式的输出,以支持信息提取、工具调用、代理规划和知识图谱构建。评估输出与参考标准的匹配程度至关重要,但却相当困难:精确匹配不够稳健,文本相似性忽略了结构,而LLM评估者则成本高昂且不透明。为此,本文提出了Object Aligner(OA),一个开源Python库,通过递归对齐JSON对象的树结构,使用匈牙利算法和序列对齐方法,提供确定性的评分。OA通过JSON Schema扩展进行配置,适应新任务时只需注释模式而无需编写代码。针对复杂结构数据,OA引入了引用对齐,推断金标准与候选标识符之间的双射关系,使得评分不受重标记影响。
🔬 方法详解
问题定义:本文旨在解决如何有效评估JSON对象之间的相似性,现有方法在处理复杂结构数据时表现不佳,尤其是图或超图结构的情况。
核心思路:Object Aligner通过递归对齐JSON树结构,结合引用对齐技术,推断金标准与候选标识符之间的双射关系,从而实现评分的稳定性和准确性。
技术框架:整体架构包括JSON对象的树结构对齐模块、引用对齐模块和评分模块。首先对JSON树进行对齐,然后推断标识符的双射关系,最后计算相似性评分。
关键创新:最重要的创新在于引入了引用对齐,解决了复杂数据结构下的相似性评分问题,使得评分不受标识符重标记的影响。
关键设计:OA通过JSON Schema扩展进行配置,允许用户通过注释模式来适应新任务,且在评分过程中使用了Weisfeiler-Leman颜色细化算法来近似图同构。
🖼️ 关键图片
📊 实验亮点
实验结果显示,Object Aligner在多个数据集上表现出色,作为GEPA提示优化器的奖励机制时,能够有效提升模型输出质量,且在评分过程中提供了排名修复建议,增强了模型的鲁棒性。
🎯 应用场景
Object Aligner的潜在应用领域包括信息提取、工具调用和知识图谱构建等。其灵活的配置方式使得在不同任务中快速适应成为可能,具有广泛的实际价值和影响力,尤其是在需要高效评估复杂数据结构的场景中。
📄 摘要(原文)
Large language models (LLMs) are often asked to produce JSON conforming to a fixed schema, powering information extraction, tool calling, agentic planning, and knowledge-graph construction. Measuring how closely an output matches a gold reference is essential yet surprisingly hard: exact match is brittle, text similarity ignores structure, and an LLM judge is expensive, opaque, and non-deterministic. We address this with Object Aligner (OA), an open-source Python library that scores two JSON objects deterministically by recursively aligning their trees (the Hungarian algorithm for unordered collections, sequence alignment for ordered ones) and awarding partial credit at the granularity the schema declares. The Object Aligner is configured entirely through a set of JSON Schema extensions, so adapting it to a new task involves annotating a schema rather than writing code. Complex structured data, however, are rarely flat trees: records may form graphs or hypergraphs keyed by arbitrary identifiers, breaking the assumptions of prior similarity metrics. Our central contribution, referential alignment, closes this gap by inferring a bijection between gold and candidate identifiers and scoring every reference through it, so the score is invariant to relabeling. Since recovering this bijection exactly is graph isomorphism, the Object Aligner approximates it with Weisfeiler-Leman color refinement. An order-sensitive sequence regime targets ranking and planning. Since the same alignment localizes every mismatch, the Object Aligner emits ranked repair suggestions at no extra cost. Used as a reward inside the GEPA prompt optimizer, Object Aligner helps or stays neutral across all datasets.