FSE Companion '26 Proceedings of the 34th ACM International Conference on the Foundations of Software Engineering FSE Companion '26 ACM 10.1145/3803437.3807386 Gavrilov2026InspectableControl conference paper Inspectable Control for Structure-Preserving Software Regeneration 面向结构保持软件再生成的可检查控制方法 https://orcid.org/0009-0006-3147-5430 Gavrilov Alexey Alexey Gavrilov https://orcid.org/0009-0000-0334-312X Gazzaev Alan-Barsag Alan-Barsag Gazzaev https://orcid.org/0000-0003-0594-867X Mozikov Mikhail Mikhail Mozikov https://orcid.org/0000-0002-3308-8825 Makarov Ilya Ilya Makarov https://orcid.org/0000-0002-4251-1744 Muravyov Sergey Sergey Muravyov https://ror.org/04txgxn49 ITMO University, Saint Petersburg, Russian Federation https://en.itmo.ru/ AXXX, Moscow, Russian Federation https://axxx.tech/ 05 07 2026 979-8-4007-2636-1 1406 1407 Abstract

Software-engineering workflows such as constrained repair, staged refinement, and structure-preserving modification require control over what changes and what remains fixed. Token-level generation is a weak control surface for these operations because it constrains local surface text rather than the coarse structural invariants that software engineering often aims to preserve. We study hierarchical discrete latents as an inspectable intermediate representation for software artifacts: a hierarchical VQ-VAE compresses a 64-token Python function into coarse and fine discrete codes, and masked discrete generation regenerates only selected positions under partial constraints. On 2,000 preprocessed Python functions, locking four top-level codes improves parse rate from 0.453 to 0.591 while preserving substantial change in unlocked positions (edit freedom, 0.936) and near-maximal sample uniqueness (diversity, 0.998). Under fixed coarse context, lower-level refinement is weaker but remains monotonic, supporting a coarse-to-fine reading of the hierarchy. Overall, these results provide early evidence for a practical control layer that supports bounded, structure-preserving software-artifact regeneration above the token level.

Keywords software artifact control hierarchical discrete latents structure-preserving regeneration partial code regeneration masked discrete generation software engineering Automatic programming Software maintenance tools 2026-07-05 Proceedings of the 34th ACM International Conference on the Foundations of Software Engineering FSE Companion '26 record-scope Author-maintained full-text JATS generated from the author-provided camera-ready TeX; not publisher XML. record-provenance Bibliographic front matter and structured reference identities come from the validated publication record; body, figures, tables, formulas, acknowledgements, and verbatim mixed-citation text come from the author-provided camera-ready TeX converted with LaTeXML 0.8.8. Reference identifiers are copied, never inferred from citation text. canonical-html https://aogavrilov.com/publications/inspectable-control/ author-posted-pdf-version Author camera-ready manuscript with the final author list and DOI author-posted-pdf-rights CC BY 4.0 author manuscript; the ACM DOI page remains the version of record. author-posted-pdf-license https://creativecommons.org/licenses/by/4.0/ record-last-modified 2026-07-31 full-text-jats-url https://aogavrilov.com/publications/inspectable-control/full-text/article.jats.xml source-archive-sha256 b692889bd19a4fab5257a1fad2a67d86c827b790aa97c563fe4dca3b7bfc8fbe source-fragment-sha256 b0f2ed7a4dfb2815573acf2c19eb5a13b6611a0c2ee44a4ad6cc78c010a77dd7 source-block-index https://aogavrilov.com/publications/inspectable-control/full-text/sections.json source-block-count 18 citation-context-index https://aogavrilov.com/publications/inspectable-control/full-text/citations.json structured-reference-policy validated-publication-record-copy-only citation-identifier-inference false
Problem Setting and Method

Many software-engineering tasks are better described as controlled modification than as free-form generation: a developer wants to preserve a high-level plan, regenerate only a bounded region, and inspect where change propagates (4; 5). Surface-token interfaces make that awkward because the directly manipulable object is text.

We therefore study hierarchical discrete latents as an inspectable control layer for software artifacts. Our system combines a hierarchical VQ-VAE with masked discrete regeneration (1; 2; 3). Each 64-token Python function is encoded into 16 top-level codes and 32 lower-level codes. Control is exposed through lock-and-regenerate: selected latent positions are frozen, the rest are regenerated, and the decoder reconstructs the final function. Developers therefore do not edit embeddings directly; they choose which latent positions remain fixed. We intentionally study a narrow setting—short Python functions, argmax decoding, and structural proxies—to isolate controllability before broader evaluations.

Contributions.

(1) We introduce an inspectable hierarchical latent control layer for code. (2) We show that freezing coarse latent structure improves parse rate while preserving substantial freedom in editable regions. (3) We demonstrate a controllability–freedom trade-off that enables bounded, structure-preserving regeneration above the token level.

Encode to discrete codes, lock selected coarse positions, regenerate only editable positions, then inspect structural stability and scope of change.

A two-stage diagram showing a hierarchical codec, a masked generator over discrete codes, and software-engineering diagnostics such as structural control and error attribution.
Experimental Setting and Main Results

We evaluate on 2,000 Python functions from a preprocessed CodeParrot Clean subset. All diagnostics use argmax decoding. Parse is the fraction of outputs accepted by the Python parser; Skeleton measures coarse program-form preservation; Signature tracks the function-interface region; Unlocked change is the fraction of editable positions that change; and Diversity is sample uniqueness under repeated regeneration. Pipeline checks confirm exact recovery under full locking and perfect preservation of locked positions.

Table 1 shows the main top-level result. Partial latent locking improves parse rate over unconditional generation while preserving non-trivial freedom in editable regions. Locking four prefix codes raises parse from 0.453 to 0.591; locking the latent span aligned to the function signature reaches 0.600. Unlocked change remains 0.936 and conditional diversity remains 0.998. Exact signature preservation stays low, which suggests that the earliest top-level codes capture coarse structural regularities more strongly than exact lexical interfaces.

Top-level controlled regeneration. “Sig.-span” locks the code prefix covering the function-signature token span.

Setting Parse Skeleton Signature
Codec reconstruction 0.857 0.848 0.493
Unconditional generation 0.453 0.080 0.000
Conditional, prefix 0.591 0.295 0.061
Conditional, sig.-span 0.600 0.302 0.063

A prefix sweep shows a clean controllability–freedom trade-off. At , the conditional model matches the unconditional baseline (parse 0.460; unlocked change 0.995). At , parse rate rises to 0.675 while 86.7% of unlocked positions still change. At , the process reduces to codec reconstruction (parse 0.857; unlocked change 0.0). Lower-level diffusion under fixed top-level context is weaker but remains monotonic under locking, supporting a coarse-to-fine reading: the top level is the stronger structural control point, while the lower level supports bounded implementation refinement.

Why operate above tokens?

Capability Token-level Latent control
Freeze coarse structure limited native
Partial regeneration fragile native
Inspectable control points no yes
Structured drift diagnosis weak direct
Implications and Limits

The main implication is practical: hierarchical discrete latents can act as an inspectable control layer above tokens. They expose explicit control points that improve structural stability during regeneration while preserving freedom in editable regions, which is closer to bounded modification than to unconstrained code generation. This is the main benefit beyond parse rate alone: exact preservation of locked positions, bounded scope of change, and diagnostics that make the control surface inspectable.

The current evidence is intentionally narrow. We do not yet evaluate downstream correctness, refactoring utility, or optimized wall-clock latency; nor do we claim semantic equivalence. The present poster therefore establishes structural controllability rather than full functional preservation. Future work should evaluate larger-scale settings and broader software-engineering tasks such as bounded repair and structure-preserving refactoring, while also assessing practical properties such as downstream correctness and latency.

Acknowledgements

This research is financially supported by the Foundation for National Technology Initiative’s Projects Support as a part of the roadmap implementation for the development of the high-tech field of Artificial Intelligence for the period up to 2030 (agreement 70-2021-00187).

References Ali Razavi Aaron van den Oord Oriol Vinyals Generating Diverse High-Fidelity Images with VQ-VAE-2 Advances in Neural Information Processing Systems 2019 1906.00446 https://arxiv.org/abs/1906.00446 Ali Razavi, Aaron van den Oord, and Oriol Vinyals. 2019. Generating Diverse High-Fidelity Images with VQ-VAE-2. In Advances in Neural Information Processing Systems. Jacob Austin Daniel D. Johnson Jonathan Ho Daniel Tarlow Rianne van den Berg Structured Denoising Diffusion Models in Discrete State-Spaces Advances in Neural Information Processing Systems 2021 2107.03006 https://arxiv.org/abs/2107.03006 Jacob Austin, Daniel D. Johnson, Jonathan Ho, Daniel Tarlow, and Rianne van den Berg. 2021. Structured Denoising Diffusion Models in Discrete State-Spaces. In Advances in Neural Information Processing Systems. Subham Sekhar Sahoo Marianne Arriola Yair Schiff Aaron Gokaslan Edgar Marroquin Justin T Chiu Alexander Rush Volodymyr Kuleshov Simple and Effective Masked Diffusion Language Models Advances in Neural Information Processing Systems 2024 2406.07524 https://arxiv.org/abs/2406.07524 Subham Sekhar Sahoo, Marianne Arriola, Aaron Gokaslan, Edgar Mariano Marroquin, Alexander M. Rush, Yair Schiff, Justin T. Chiu, and Volodymyr Kuleshov. 2024. Simple and Effective Masked Diffusion Language Models. In Advances in Neural Information Processing Systems. Shraddha Barke Michael B. James Nadia Polikarpova Grounded Copilot: How Programmers Interact with Code-Generating Models Proceedings of the ACM on Programming Languages 2023 10.1145/3586030 2206.15000 https://doi.org/10.1145/3586030 Shraddha Barke, Michael B. James, and Nadia Polikarpova. 2023. Grounded Copilot: How Programmers Interact with Code-Generating Models. Proceedings of the ACM on Human-Computer Interaction 7, CSCW1 (2023), Article 78. Fengji Zhang Bei Chen Yue Zhang Jacky Keung Jin Liu Daoguang Zan Yi Mao Jian-Guang Lou Weizhu Chen RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generation Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing 2023 10.18653/v1/2023.emnlp-main.151 2303.12570 https://doi.org/10.18653/v1/2023.emnlp-main.151 Kechi Zhang, Jia Li, Ge Li, Xianjie Shi, and Zhi Jin. 2023. RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generation. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing.