---
title: "Template Gap Reconstruction for Shell Output Simulation with Small Language Models"
source: "arXiv AI/CL/LG（论文）"
source_tier: "t2"
url: "https://arxiv.org/abs/2611.06731v1"
permalink: "https://feed.astralor.com/items/itm_6e832ea3d2ef76084bb4ed57"
published: "2026-11-04T16:17:28.000Z"
score: 60
channel: "ai"
tags: ["RAG","Template Gap Reconstruction","Shell Output Simulation","Small Language Models","Small","TGR","Evaluation"]
---

# Template Gap Reconstruction for Shell Output Simulation with Small Language Models

## At a glance

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 e…

## Key points

- 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 e…
- 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.

## Full text

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.

---

Verify against the original before citing; curated by Astral Feed: https://feed.astralor.com/items/itm_6e832ea3d2ef76084bb4ed57
