基于小型语言模型的Shell输出模拟的模板间隙重构
Template Gap Reconstruction for Shell Output Simulation with Small Language Models
AI总结:
本研究提出模板间隙重构(TGR)方法,结合1870万条输出构建的模板库训练模型,在小型语言模型的Shell输出模拟中提升输出编辑相似度、减少生成令牌数,为小型Shell模拟器提供实用设计方案。
摘要:
小型语言模型为无需执行提交命令的Shell模拟提供了紧凑基础,但全输出解码要求它们同时预测重复的实用程序结构与每次执行时变化的内容。我们提出模板间隙重构(TGR),该方法提供可复用的输出文字,穿插哨兵以与自回归生成的间隙交织。模板选择器选择要重构的模板,空模板则保留全输出解码。我们从跨异构执行环境收集的1870万条输出构建模板库,并在排除于库构建之外的目标环境上,训练模板选择器及5个从不同小型语言模型检查点初始化的重构模型。评估显示,当最优模板覆盖模板的25%以上时,TGR较全输出解码(FOD)提升输出编辑相似度(O-ES),而在低覆盖率输出上表现相近;此外,TGR在较短间隙序列上优于FOD,O-ES值分别为0.964和0.812,在较长序列上则保持相近性能;TGR在所用分词器族上减少26.3%至38.3%的生成令牌数。这些结果支持将可复用输出结构作为小型Shell模拟器的实用设计选择,在保持模板选择与残差预测对响应质量核心作用的同时,提升响应保真度并缩短生成目标。
英文摘要:
Small language models offer a compact basis for shell simulation without executing submitted commands, but full-output decoding requires them to predict recurring utility structure alongside content that varies across executions. We introduce template gap reconstruction (TGR), which supplies reusable output literals interspersed with sentinels to be interleaved with autoregressively generated gaps. A template selector chooses which template to be reconstructed, with the empty template retaining full-output decoding. We construct a template bank from 18.7 million outputs collected across heterogeneous execution environments and train a template selector and five reconstruction models initialized from various small language model checkpoints on a target environment excluded from bank construction. Evaluation demonstrates that TGR improves output edit similarity (O-ES) over full-output decoding (FOD) when the optimal template covers more than 25\% of the template, while performing similarly for lower-coverage outputs. Additionally, TGR outperforms FOD for shorter gap sequences, with O-ES values of 0.964 and 0.812, respectively, while maintaining similar performance for longer sequences. TGR reduces the number of tokens generated by 26.3--38.3\% across used tokenizer families. These results support using a reusable output structure as a practical design choice for small shell simulators, improving response fidelity and shortening generation targets while keeping template selection and residual prediction central to response quality.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。