跳到正文
arXiv cs.AI· Adiel Ashrov, Tom Yaacov, Guy Katz·· 3 小时前AI 评分34

基于场景编程如何辅助 LLM 开发可组合的响应式代码

From Domain Knowledge to Composable Reactive Code: LLM-Assisted Development with Scenario-Based Programming

AI 导读

一项研究将场景编程(SBP)同时用作向大语言模型传递领域知识的结构化媒介和生成扩展代码的目标范式。研究以 Taki 卡牌游戏为实验,LLM 生成的 SBP 策略全部无运行时错误或死锁,对固定随机基线胜率 64.9%,对生成的 Python 策略 head-to-head 胜率为 51.2%–52.3%;更丰富的 SBP 领域知识使 Python 策略胜率从 59.4% 提升至 62.5%。

正文 · 原文

View PDF HTML (experimental)

Abstract:Reactive systems must continuously respond to events and coordinate interacting behaviors, making code generation challenging: reliability depends not only on individual components but on how they compose at runtime. We investigate Scenario-Based Programming (SBP) in two complementary roles: as a structured medium for communicating domain knowledge to a Large Language Model (LLM), and as the target paradigm for generated extensions. We implement the Taki card game in SBP and ask an LLM to generate Python players using progressively richer SBP-cast domain knowledge. Separately, we ask the LLM to generate strategy scenarios that compose directly with the existing implementation. In controlled simulations, all generated strategies that we evaluated complete their runs without observed runtime errors, deadlocks, or draws. The generated SBP strategy also composes with an additional hand-authored scenario without observed execution failures. Richer SBP-cast domain knowledge is associated with stronger generated Python strategies: their win rate against a fixed random SBP baseline increases from 59.4% to 62.5%. The directly generated SBP strategy wins 64.9% against the same baseline and 51.2%--52.3% head-to-head against the generated Python strategies. These results suggest that SBP can serve both as a medium for communicating domain knowledge and as a composable target for reactive-system extensions.
Comments: Accepted to MODELSWARD 2027
Subjects: Software Engineering (cs.SE); Artificial Intelligence (cs.AI)
Cite as: arXiv:2611.37342 [cs.SE]
  (or arXiv:2611.37342v1 [cs.SE] for this version)
  https://doi.org/10.48550/arXiv.2611.37342

arXiv-issued DOI via DataCite (pending registration)

Submission history

From: Adiel Ashrov [view email]
[v1] Fri, 27 Nov 2026 12:15:20 UTC (2,923 KB)

来源:arXiv cs.AI · arxiv.org