Object Aligner: A Configurable JSON Schema Similarity Score for Graphs, Applied to LLM Prompt Optimization

📄 arXiv: 2607.01972 📥 PDF

作者: Jan Drchal

分类: cs.CL, cs.AI, cs.LG

发布日期: 2026-07-05


💡 一句话要点

提出Object Aligner以解决JSON相似性评分问题

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: JSON相似性 大型语言模型 信息提取 知识图谱 图同构 机器学习 模型优化

📋 核心要点

  1. 现有方法在评估JSON输出时存在精确匹配不稳健、文本相似性忽略结构等挑战。
  2. 本文提出Object Aligner,通过递归对齐JSON树结构,提供可配置的相似性评分,适应性强。
  3. Object Aligner在GEPA提示优化器中作为奖励使用,帮助或保持中立于所有数据集,表现出色。

📝 摘要(中文)

大型语言模型(LLMs)常被要求生成符合固定JSON模式的输出,以支持信息提取、工具调用、智能规划和知识图谱构建。评估输出与参考标准的匹配程度至关重要,但却相当困难:精确匹配不够稳健,文本相似性忽略了结构,而使用LLM进行评估则成本高昂且不透明。为此,本文提出了Object Aligner(OA),一个开源Python库,通过递归对齐JSON对象的树结构来确定评分,采用匈牙利算法处理无序集合,序列对齐处理有序集合,并根据模式授予部分信用。Object Aligner通过JSON Schema扩展进行配置,适应新任务只需注释模式而非编写代码。针对复杂结构数据,本文的核心贡献是引用对齐,推断金标准与候选标识符之间的双射,并通过此评分,使得得分不受重标记影响。

🔬 方法详解

问题定义:本文旨在解决如何有效评估JSON对象之间的相似性,现有方法在处理复杂结构数据时存在局限性,尤其是图形或超图的情况。

核心思路:Object Aligner通过引用对齐推断金标准与候选标识符之间的双射,确保评分不受重标记影响,提供了一种新的相似性评分方法。

技术框架:整体架构包括JSON对象的树结构对齐,使用匈牙利算法和序列对齐技术,结合Weisfeiler-Leman颜色细化来近似图同构。

关键创新:最重要的创新在于引用对齐技术,使得评分方法能够处理复杂的图形结构,克服了传统相似性度量的局限性。

关键设计:Object Aligner的配置完全通过JSON Schema扩展进行,适应新任务时只需注释模式,避免了编写代码的复杂性。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

实验结果表明,Object Aligner在多个数据集上表现优异,作为GEPA提示优化器的奖励机制,能够有效提升模型性能,且在处理复杂结构时保持高效性和准确性。

🎯 应用场景

Object Aligner可广泛应用于需要生成和评估JSON输出的领域,如信息提取、工具调用和知识图谱构建。其灵活的配置方式使其能够适应多种任务,提升了模型在复杂数据结构下的表现,具有重要的实际价值和未来影响。

📄 摘要(原文)

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.