Structured generation for LLM tool use highlights the value of compact DSL intermediate representations (IRs) that can be emitted directly and parsed deterministically. This paper introduces axial grammar: linear token sequences that recover multi-dimensional structure from the placement of rank-specific separator tokens. A single left-to-right pass assigns each token a coordinate in an n-dimensional grid, enabling deterministic parsing without parentheses or clause-heavy surface syntax. This grammar is instantiated in Memelang, a compact query language intended as an LLM-emittable IR whose fixed coordinate roles map directly to table/column/value slots. Memelang supports coordinate-stable relative references, parse-time variable binding, and implicit context carry-forward to reduce repetition in LLM-produced queries. It also encodes grouping, aggregation, and ordering via inline tags on value terms, allowing grouped execution plans to be derived in one streaming pass over the coordinate-indexed representation. Provided are a reference lexer/parser and a compiler that emits parameterized PostgreSQL SQL (optionally using pgvector operators).


翻译:面向LLM工具使用的结构化生成凸显了紧凑领域特定语言中间表示的价值,此类表示可直接生成并确定性解析。本文提出轴向语法:一种通过放置秩特定分隔符标记来恢复多维结构的线性标记序列。单次从左至右扫描即可为每个标记分配n维网格中的坐标,从而实现无需括号或复杂子句表层语法的确定性解析。该语法在Memelang中实例化,这是一种紧凑的查询语言,专为作为LLM可发射的中间表示而设计,其固定坐标角色直接映射到表/列/值槽位。Memelang支持坐标稳定的相对引用、解析时变量绑定以及隐式上下文传递机制,以减少LLM生成查询中的重复表达。它通过在值项上使用内联标签实现对分组、聚合和排序的编码,使得分组执行计划可在对坐标索引表示的单次流式遍历中推导得出。本文提供了参考词法分析器/解析器以及可生成参数化PostgreSQL SQL(可选使用pgvector运算符)的编译器实现。

0
下载
关闭预览

相关内容

【AAAI2024】使用大型语言模型的生成式多模态知识检索
专知会员服务
58+阅读 · 2024年1月19日
【ICML2023】SEGA:结构熵引导的图对比学习锚视图
专知会员服务
23+阅读 · 2023年5月10日
【NeurIPS2019】图变换网络:Graph Transformer Network
语义分割中的深度学习方法全解:从FCN、SegNet到DeepLab
炼数成金订阅号
26+阅读 · 2017年7月10日
国家自然科学基金
8+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
6+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
VIP会员
相关资讯
相关基金
国家自然科学基金
8+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
6+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员