提示装饰器:用于大语言模型中推理、格式化和控制的声明式可组合语法
Prompt Decorators: A Declarative and Composable Syntax for Reasoning, Formatting, and Control in LLMs
AI总结:
本文提出提示装饰器,一种声明式可组合语法,通过紧凑控制标记管理LLM推理、格式化和控制,形式化20个核心装饰器,实现可预测、可审计的行为组合,提升推理透明度并降低提示复杂性。
摘要:
大型语言模型(LLM)是推理、写作和决策支持工作流的核心,但用户缺乏对其推理方式和输出表达的一致控制。传统的提示工程依赖于冗长的自然语言指令,限制了可复现性、模块化和可解释性。本文介绍了提示装饰器(Prompt Decorators),一种声明式、可组合的语法,通过诸如+++Reasoning、+++Tone(style=formal)和+++Import(topic="Systems Thinking")等紧凑控制标记来管理LLM行为。每个装饰器修改一个行为维度,如推理风格、结构或语气,而不改变任务内容。该框架形式化了二十个核心装饰器,分为两个功能家族(认知与生成式、表达与系统式),每个家族进一步分解为管理推理、交互、表达和会话控制的子类别。它定义了统一的语法、作用域模型和确定性处理流水线,使行为组合可预测且可审计。通过将任务意图与执行行为解耦,提示装饰器为提示设计创建了可重用且可解释的接口。说明性用例展示了跨领域改进的推理透明度、降低的提示复杂性和标准化的模型行为。本文最后讨论了互操作性、行为一致性以及为可扩展AI系统开发声明式接口的意义。
英文摘要:
Large Language Models (LLMs) are central to reasoning, writing, and decision-support workflows, yet users lack consistent control over how they reason and express outputs. Conventional prompt engineering relies on verbose natural-language instructions, limiting reproducibility, modularity, and interpretability. This paper introduces Prompt Decorators, a declarative, composable syntax that governs LLM behavior through compact control tokens such as +++Reasoning, +++Tone(style=formal), and +++Import(topic="Systems Thinking"). Each decorator modifies a behavioral dimension, such as reasoning style, structure, or tone, without changing task content. The framework formalizes twenty core decorators organized into two functional families (Cognitive & Generative and Expressive & Systemic), each further decomposed into subcategories that govern reasoning, interaction, expression, and session-control. It defines a unified syntax, scoping model, and deterministic processing pipeline enabling predictable and auditable behavior composition. By decoupling task intent from execution behavior, Prompt Decorators create a reusable and interpretable interface for prompt design. Illustrative use cases demonstrate improved reasoning transparency, reduced prompt complexity, and standardized model behavior across domains. The paper concludes with implications for interoperability, behavioral consistency, and the development of declarative interfaces for scalable AI systems.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。