Inspectable Control for Structure-Preserving Software Regeneration
Controllable code editing that preserves selected program structure without regenerating the entire program.
- ITMO University, Saint Petersburg, Russian Federation
- AXXX, Moscow, Russian Federation
Published at Proceedings of the 34th ACM International Conference on the Foundations of Software Engineering
2026pp. 1406–1407Companion poster
Author camera-ready manuscript with the final author list and DOI. CC BY 4.0 author manuscript; the ACM DOI page remains the version of record.
Paper in 30 seconds
Problem
AI-assisted code modification often needs one bounded change while selected program structure remains fixed. Regenerating the entire program can disturb unrelated regions, and token-level constraints do not expose a coarse control surface.
Approach
The study encodes 64-token Python functions with a hierarchical VQ-VAE, locks selected coarse discrete codes, and uses masked discrete generation for localized code regeneration in the remaining latent positions.
Main result
Locking four top-level codes raises parse rate from 0.453 to 0.591 while unlocked positions still change at rate 0.936 and conditional samples remain 0.998 unique.
Why it matters
The results show a measurable stability–freedom trade-off for controllable code editing and partial program regeneration. They provide early evidence for an inspectable latent control layer, not proof of semantic equivalence or functional correctness.
Method
The method compresses a short Python function into two levels of discrete codes, freezes selected coarse positions, and regenerates the remaining positions before decoding back to code.
Encode
Compress a 64-token Python function into 16 top-level codes and 32 lower-level codes with a hierarchical VQ-VAE.
Lock
Choose coarse code positions that represent structure to preserve, such as a prefix covering the function-signature span.
Regenerate
Run masked discrete generation only over unlocked positions and decode the completed hierarchy back to source code.
Inspect
Measure parse rate, structural proxies, change in unlocked positions, and sample uniqueness before accepting a regeneration.
Key idea
Control is applied to a learned representation above tokens: coarse latent positions define explicit places where structure can be frozen while nearby implementation details remain editable.
Difference from nearby approaches
Prompt-level or token-level constraints operate on surface text. The proposed interface exposes coarse and fine discrete control points and measures the resulting stability–freedom trade-off.
What is new
The work introduces and evaluates an inspectable hierarchical latent control layer for bounded software-artifact regeneration.
Key results
| Setting | Parse rate | Skeleton | Signature | Unlocked change |
|---|---|---|---|---|
| Input (truncated) | 0.994 | 0.994 | 0.994 | — |
| Codec reconstruction | 0.857 | 0.848 | 0.493 | 0 |
| Unconditional generation | 0.453 | 0.08 | 0 | 0.995 |
| Conditional, prefix k=4 | 0.591 | 0.295 | 0.061 | 0.936 |
| Conditional, signature span | 0.6 | 0.302 | 0.063 | not reported |
Key result. Coarse latent locking improves syntactic stability without collapsing change in the editable region; the result demonstrates structural control, not guaranteed functional equivalence.
- Dataset
- 2,000 preprocessed Python functions from a CodeParrot Clean subset
- Sample size
- 2,000 preprocessed Python functions; conditional sample uniqueness is 0.998.
- Metrics
- Parse rate; Skeleton and signature preservation proxies; Unlocked-position change rate; Sample uniqueness and entropy
- Uncertainty
- The two-page study reports point estimates without confidence intervals or multi-seed statistical analysis.
- Conditions
- 64-token functions, argmax decoding, 16 top-level codes and 32 lower-level codes; full locking exactly recovers the codec reconstruction.
Comparison with nearby approaches
| Capability | Token-level control | Hierarchical latent control |
|---|---|---|
| Freeze coarse structure | Limited | Native coarse-code locking |
| Partial regeneration | Fragile surface constraints | Masked resampling of selected codes |
| Inspectable control points | No explicit intermediate layer | Coarse and fine discrete positions |
| Evidence in this paper | Not evaluated as a complete baseline | Syntactic stability and edit-freedom diagnostics |
The table describes interfaces and the study's measured evidence; it does not claim functional correctness or universal superiority.
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.
When to cite this paper
This paper may be relevant when discussing:
- controllable code editing and AI-assisted code modification
- localized code regeneration or partial program regeneration
- structure-preserving code generation under explicit constraints
- hierarchical discrete latent representations for source code
- masked discrete generation for source code
- latent control for software artifacts and controllable neural code generation
- localized program repair, bounded refactoring, or controlled software regeneration
Limitations
- The study is limited to short Python functions truncated to 64 tokens.
- Evaluation uses argmax decoding and syntactic or structural proxies rather than tests of functional equivalence.
- Exact signature preservation remains weak.
- Lower-level control is weaker than top-level control.
- Latent positions are not yet aligned to semantic regions such as AST spans, signatures, or control-flow structure.
- The results do not establish correctness for practical repair, refactoring, or repository-level changes.
Related research areas
The paper is most relevant to work that needs explicit control over what an AI-assisted code transformation may change and which parts of a program should remain stable.
Controllable and structure-preserving code generation
Localized program repair and bounded refactoring
Hierarchical discrete representations for source code
Masked generation over partially fixed latent states
Developer-facing inspection of AI-assisted modifications
Scope. The experiments use a hierarchical VQ-VAE and masked discrete generation, not an LLM. They evaluate short Python functions with syntactic and structural proxies rather than functional correctness, exact AST preservation, or repository-scale repair.
Resources & reproducibility
- Publisher
- ACM
- Code
- Not publicly released; no inactive Code button is shown.
- Installation
- A public installation recipe is not yet available; no inactive Code button is shown.
- Minimal run
- The published workflow is encode → lock selected top-level codes → regenerate unlocked positions → decode → inspect validity and change scope.
- Configurations
- Hierarchical VQ-VAE with 16 top-level and 32 lower-level positions; masked discrete generation under partial constraints.
- Release / commit
- No public release identifier is available.
- Checkpoints
- The publication page does not distribute model checkpoints.
- Expected result
- Prefix k=4 parse rate 0.591, unlocked change 0.936, and conditional sample uniqueness 0.998.
- Hardware
- Hardware requirements are not reported in the published two-page paper.
Data statement
- Source
- A preprocessed subset of CodeParrot Clean containing 2,000 Python functions.
- License
- No dataset files are redistributed by this site; reuse remains subject to the upstream CodeParrot dataset and source-code licenses.
- Preprocessing
- Python functions are tokenized and truncated or padded to 64 tokens before hierarchical encoding.
- Split
- The poster reports a 2,000-function evaluation set; an immutable train/validation split manifest is not included in the public paper.
- Format
- Python source functions, GPT-style token sequences, top-level code sequences of length 16, and lower-level sequences of length 32.
- Version / checksum
- A dataset checksum and immutable snapshot identifier are not reported in the two-page paper.
- Acquisition
- A public acquisition script is not released with the publication page.
- Use limits
- The sample is not representative of repository-scale software, multiple programming languages, or behaviorally verified repair tasks.
Versions
- Published versionACM FSE Companion, 2026
- Bibliographic recordDBLP
The published DOI is the primary bibliographic identifier. This page remains the single canonical project URL across versions.
Cite this paper
BibTeX is the recommended format. Every variant below is generated from the same publication record.
@inproceedings{Gavrilov2026InspectableControl,
title = {Inspectable Control for Structure-Preserving Software Regeneration},
author = {Gavrilov, Alexey and Gazzaev, Alan-Barsag and Mozikov, Mikhail and Makarov, Ilya and Muravyov, Sergey},
booktitle = {Proceedings of the 34th ACM International Conference on the Foundations of Software Engineering},
publisher = {ACM},
year = {2026},
pages = {1406--1407},
doi = {10.1145/3803437.3807386},
url = {https://doi.org/10.1145/3803437.3807386},
isbn = {979-8-4007-2636-1},
}
Gavrilov, A., Gazzaev, A.-B., Mozikov, M., Makarov, I., and Muravyov, S. (2026). Inspectable Control for Structure-Preserving Software Regeneration. In Proceedings of the 34th ACM International Conference on the Foundations of Software Engineering (pp. 1406–1407). ACM. https://doi.org/10.1145/3803437.3807386A. Gavrilov, A.-B. Gazzaev, M. Mozikov, I. Makarov, and S. Muravyov, “Inspectable Control for Structure-Preserving Software Regeneration,” in Proceedings of the 34th ACM International Conference on the Foundations of Software Engineering, 2026, pp. 1406–1407, doi: 10.1145/3803437.3807386.TY - CPAPER
TI - Inspectable Control for Structure-Preserving Software Regeneration
AU - Gavrilov, Alexey
AU - Gazzaev, Alan-Barsag
AU - Mozikov, Mikhail
AU - Makarov, Ilya
AU - Muravyov, Sergey
PY - 2026
DA - 2026-07-05
T2 - Proceedings of the 34th ACM International Conference on the Foundations of Software Engineering
SP - 1406
EP - 1407
PB - ACM
DO - 10.1145/3803437.3807386
UR - https://doi.org/10.1145/3803437.3807386
SN - 979-8-4007-2636-1
ER -
Citation files:CITATION.cffAPA textIEEE textRIS