Paper deep dive
RepairFormer: Automated Repair of Structured Inputs Using Transformers
Ovi Paul, Tom J King, Ali Shokri
Intelligence
Status: not_run | Model: - | Prompt: - | Confidence: 0%
Entities (0)
Relation Signals (0)
No relation signals yet.
Cypher Suggestions (0)
No Cypher suggestions yet.
Abstract
Abstract:Structured input files such as JSON, DOT, OBJ, INI, S-expression, and TinyC are widely used in software systems, but small corruptions can cause parsers to reject otherwise useful data. Repairing such inputs is important because malformed configuration, program, and data files can interrupt testing, analysis, deployment, and downstream automation even when most of the original content remains intact. Existing repair techniques can produce structurally valid inputs, but they often rely on deletion or repeated search, which may lose original content and result in semantic incorrectness. This paper presents RepairFormer, a transformer-based framework for structured input repair. The approach formulates repair as a supervised sequence generation task and uses format tags, oracle validation, and boundary-localized repair to generate valid outputs while preserving content. The boundary workflow focuses generation on the detected fault region, reducing the input size, and supporting repair of longer files. In evaluation, RepairFormer achieves a 88% in repair and 94% in recovery, showing strongest content preservation when repairs are successful. Additional experiments on our benchmark shows RepairFormer repairs 97.57% and recovers 94.29% with 5x faster runtime compared to state of the art.
Tags
Links
- Source: https://arxiv.org/abs/2608.05060v1
- Canonical: https://arxiv.org/abs/2608.05060v1
PDF not stored locally. Use the link above to view on the source site.
Full Text
24,105 characters extracted from source content.
Expand or collapse full text
RepairFormer: Automated Repair of Structured Inputs Using Transformers Ovi Paul opaul@uh.edu University of Houston Houston, Texas, USA Tom J King tjking2@uh.edu University of Houston Houston, Texas, USA Ali Shokri ashokri@uh.edu University of Houston Houston, Texas, USA Abstract Structured input files such as JSON, DOT, OBJ, INI, S-expression, and TinyC are widely used in software systems, but small corrup- tions can cause parsers to reject otherwise useful data. Repairing such inputs is important because malformed configuration, pro- gram, and data files can interrupt testing, analysis, deployment, and downstream automation even when most of the original con- tent remains intact. Existing repair techniques can produce struc- turally valid inputs, but they often rely on deletion or repeated search, which may lose original content and result in semantic incor- rectness. This paper presents RepairFormer, a transformer-based framework for structured input repair. The approach formulates re- pair as a supervised sequence generation task and uses format tags, oracle validation, and boundary-localized repair to generate valid outputs while preserving content. The boundary workflow focuses generation on the detected fault region, reducing the input size, and supporting repair of longer files. In evaluation, RepairFormer achieves a 88% in repair and 94% in recovery, showing strongest content preservation when repairs are successful. Additional exper- iments on our benchmark shows RepairFormer repairs 97.57% and recovers 94.29% with 5x faster runtime compared to state of the art. CCS Concepts • Software and its engineering→Software maintenance tools. ACM Reference Format: Ovi Paul, Tom J King, and Ali Shokri. 2018. RepairFormer: Automated Repair of Structured Inputs Using Transformers. In Proceedings of Make sure to enter the correct conference title from your rights confirmation email (Conference acronym ’X). ACM, New York, NY, USA, 5 pages. https://doi. org/X.X 1 Introduction Modern software systems rely on structured input formats such as JSON, XML, DOT, OBJ, INI, S-expression, and TinyC to repre- sent configuration data, program structures, and domain specific information[4,8]. These files are often manually edited or generated by external tools, which makes them vulnerable to corruption. Even small syntax errors, such as missing delimiters, misplaced tokens, or incomplete structures, can cause a parser to reject the entire Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from permissions@acm.org. Conference acronym ’X, Woodstock, NY © 2018 Copyright held by the owner/author(s). Publication rights licensed to ACM. ACM ISBN 978-1-4503-X-X/2018/06 https://doi.org/X.X file[5]. Such invalid inputs are common in real-world repositories (e.g., GitHub) [4], causing useful information to become inaccessi- ble even when most of the file remains correct. Repairing such files manually can be slow and error-prone, especially for large files or when the error location is unclear. Prior input repair techniques address this problem through parser guided search. For example, ddmax[4] repairs inputs by removing fragments until the remaining file is accepted by the parser. More recently,휖REPAIR[8] extends search-based repair by considering insertions, deletions, and replacements. But these approaches rely on many repeated oracle executions and iterative search steps to explore candidate repairs. This work investigates a different direction. We formulate struc- tured input repair as a sequence generation task using transformer- based model [2,11]. Instead of only searching over edit operations, the model learns repair patterns from corrupted and valid input pairs. The goal is not only to produce a parser valid file, but also to preserve as much of the original information as possible. To improve scalability for long inputs, we also put a boundary local- ized workflow that guides the model toward the suspected faulty region before generation. RepairFormer can support the recovery of malformed configuration and other structured input files before downstream processing [4,5,7]. This paper makes the following contributions: • We present RepairFormer, a transformer-based tool that repairs structured inputs corrupted through a variety of transformations, including deletions, insertions, and byte flips, while maximizing content preservation and reducing the cost of search-based repair. • We analyze format-wise behavior, mutation types, runtime, and model choices to identify when learned repair is most effective. Tool Availability: The source code of RepairFormer is publicly available through its GitHub repository 1 . 2 Motivating Example Consider the following corrupted JSON input: "id": 17, "status" "active" The input is invalid because the colon after"status"is missing. A deletion-based repair method may produce a valid file by removing the corrupted field: "id": 17 This output is syntactically valid, but it loses the status information. While the state of the art tools either produce the above output or 1 https://github.com/pass-uh/RepairFormer.git arXiv:2608.05060v1 [cs.SE] 5 Aug 2026 Conference acronym ’X, June 03–05, 2018, Woodstock, NYOvi Paul, Tom J King, and Ali Shokri Collect StructuredFiles MutateFiles OracleStatus Check BoundaryDetection LocalBoundaryWindow Extraction PretrainedModelLoading InputandTarget Tokenization LoRA-based Fine Tuning Localizethe errorregion Inferenceon LocalWindow Generatecandi daterepair Re-construct the repaired file Train/Test Dataset Invalid Input File Ranked List of Repaired Input Files Iteration over the error regions Phase 1: Data Preparation Phase 2 Model Training Phase 3: Input Repair Figure 1: Overview of the RepairFormer Table 1: Valid structured data collected. FormatFilesSize range DOT115423–19856 bytes INI10549–19835 bytes JSON9019–19647 bytes OBJ88838–19994 bytes S-expression77310–16281 bytes TinyC10002–636 bytes randomly generate characters to repair the file, a generative repair model can instead preserve the field by inserting the missing colon: "id": 17, "status": "active" This example shows the importance of preserving the useful content by an input repair tool while also satisfying the syntax correctness of a structured input. 3 An Overview of RepairFormer RepairFormer treats input repair as a supervised sequence gen- eration task in which, given an invalid structured input, the tool generates a repaired version that satisfies both the format (i.e., syn- tactic) and the intended structural and semantic constraints of the input. Figure 1 provides an overview of the tool. We first create a dataset of training data from< 푏푢푔푦,푟푒푝푎푖푟푒푑>input pairs (Section 3.1), followed by training the model (Section 3.2). To better pinpoint the buggy part of the input during the repair process, Re- pairFormer localizes that part within the input file and fixes the issue (Section 3.3). 3.1 Dataset Preparation The dataset is constructed from valid structured files collected from GitHub. We used a script that searches GitHub by file extension and size range, downloads candidate files, removes duplicates us- ing SHA256 hashes, and validates each file with an oracle. Invalid samples are automatically synthesized through controlled muta- tions, including single character corruption, double character cor- ruption, and truncation. Table 1 provides distribution information of the created dataset. A format tag, such asjson,ini,dot,obj, s-expression, ortinyc, is prepended to each input so that the model can support multiple formats. Each mutated file is verified by the corresponding oracle to ensure invalidity, while the original file is kept as the repair target. The mutation strategy was adopted from 휖REPAIR[8], which was extended from the approach introduced in DDMax[4]. Each valid and invalid pair is converted into a JSONL record:푥= format: invalid_text, 푦= valid_text, where 푥is the model input and푦is the target repair. The conversion script loads each mutation pair, assigns it to the proper train or test split, and writes train, validation, and test JSONL files. The validation set is formed by randomly selecting 10% of the training data. 3.2 Model Training The model is initialized fromSalesforce/codet5-base[12], which is a variant of T5 model [10]. This variant was trained on large cor- pus of program data, so this is suitable for working with structured input data. The input and target fields are loaded from JSONL files, tokenized with the CodeT5 tokenizer, and passed to a sequence generation trainer. The model is trained to minimize validation loss, and early stopping is used to prevent unnecessary training after convergence. The training configuration supports model fine tun- ing and low rank adaptation(LoRA)-based [3] parameter efficient fine tuning. When LoRA is enabled, low rank adapters are applied to the attention projection modules, which reduces the number of trainable parameters while keeping the base model fixed. To narrow down the repair process to the actual buggy compo- nent, we utilize the boundary localization module from휖REPAIR [8]. To that end, instead of passing the entire invalid file to the model, RepairFormer identifies a suspected error boundary and extracts a smaller, localized window around it. The boundary can be estimated using oracle-based boundary detection, mutation metadata, or the first-byte difference between the valid and invalid files. The oracle-based localization follows the RepairFormer : Automated Repair of Structured Inputs Using TransformersConference acronym ’X, June 03–05, 2018, Woodstock, NY boundary search paradigm introduced in휖REPAIR [8], where parser feedback is leveraged to distinguish among correct, incomplete, and incorrect prefixes. A binary search is then executed to locate the largest prefix that is not explicitly evaluated as incorrect, and this index is designated as the repair boundary. After localization, a local context window surrounding the bound- ary is extracted. Let푠 푖 denote the original valid file string and ̃ 푠 푖 represent its mutated, invalid counterpart. We define the slicing notation푠 푖,푎:푏 as the substring of푠 푖 from byte index푎to푏. Here,푥 푖 represent the localized input extracted from the푖th invalid file. The extracted window from the invalid file is marked with a<BOUNDARY> token at the pinpointed fault location: 푥 푖 = format: ̃ 푠 BOUNDARY 푖,푎:푏 . Similarly,푦 푖 represent the corresponding target sequence ex- tracted from the original valid file. The target for sequence genera- tion is the corresponding sequence window from the original valid file: 푦 푖 = 푠 푖,푎 ′ :푏 ′ , where푎 ′ and푏 ′ represent the adjusted alignment boundaries in the clean document. The window size is selected under the model token budget so that the localized prompt remains within the context limit. This workflow has two main benefits. First, it reduces the ef- fective input length for long files. Second, it makes the repair task more explicit by directing the model to the suspected faulty region. 3.3 Input Repair During the repair process, RepairFormer takes an input file and first invokes the parser as an oracle to determine whether the file is invalid. If the file is deemed invalid, the tool locates the suspected error region, extracts a local window around that region, and inserts the<BOUNDARY>marker into the input before passing it to the repair model. The trained model then generates a repair candidate for that local window. Model inference refers to the generation of this repair candidate, rather than the localization or extraction of the local window. The generated candidate is reconstructed into the original file and validated again using the oracle. A repair is accepted when the reconstructed file becomes valid. Invalid candidates are rejected unless they advance the error boundary. The process repeats until the file is repaired or the maximum number of iterations is reached. 4 Evaluation We evaluate RepairFormer on invalid structured inputs spanning multiple formats and mutation types. The evaluation focuses on the tool’s ability to transform invalid inputs into parser-accepted valid files while preserving the original content of unaffected regions. As discussed later, we compare RepairFormer against state-of-the-art repair tools and report both format- and mutation-specific results. We further analyze runtime performance and the number of repair iterations required to characterize the computational cost of the repair process. 4.1 Evaluation Metrics In our experiments, the repaired output is evaluated using three primary metrics: repair, recovery, and runtime. A file is counted as repaired when the original input is invalid and the selected Table 2: Performance comparison across two benchmarks. Method 휖Repair Benchmark RepairFormer Benchmark Rep. Rec. Tot. Time Rep. Rec. Tot. Time 휖 REPAIR [8]97% 92% 89.24% 3.87s 87.91% 94.03% 82.66% 48.55s ANTLR [9]49% 90%44.1% 0.31s 27.14% 89.23% 24.22% 12.43s DDMax [4]98% 81% 79.38% 2.71s 36.18% 86.27% 31.21% 137.20s RepairFormer 88% 94% 82.92% 7.16s 97.57% 94.29% 92% 9.71s model output becomes valid under the oracle. Repair measures the percentage of invalid files that are successfully transformed into oracle-valid outputs:Repaired= Valid Input Files Originaly Invalid Input Files ×100. Data preservation is measured using normalized Levenshtein dis- tance [6] between the repaired output and the original valid target: DataLoss(푠, ˆ 푠)= 푑 lev (푠, ˆ 푠) max(1,|푠|) ×100.Here,푠is the original valid file, ˆ 푠is the repaired output, and푑 lev is the Levenshtein edit distance. Lower data loss means the repaired output preserves more of the original file content. Recovery is reported as the complement of data loss: Recovered(푠, ˆ 푠)=100− DataLoss(푠, ˆ 푠).Finally, runtime measures the computational cost of repair. We report the total time required to process a file, including boundary localization, repair generation, candidate validation, oracle checking, splicing, and output writing. To identify the primary bottlenecks, we also report generation and oracle-validation times separately. 4.2 Results Table 2 compares RepairFormer with휖REPAIR, ANTLR, and DDMax on two benchmarks, with bold values indicating the best scores. On the external휖REPAIR benchmark, RepairFormer achieves 88% repair, 94% recovery, and an overall score of 82.92%. It outperforms ANTLR in repair and recovery. Although DDMax achieves higher repair at 98%, RepairFormer improves recovery from 81% to 94% and the overall score by 3.54%, showing that it preserves more content than deletion based repair. The higher performance on the RepairFormer benchmark likely reflects closer alignment with its training distribution. The휖REPAIR benchmark contains different Lisp structures and mostly single mu- tations, while the RepairFormer benchmark contains more double mutations and truncations. This domain shift makes휖REPAIR an important external generalization test. On the RepairFormer benchmark, RepairFormer improves re- pair over휖REPAIR from 87.91% to 97.57% and recovery from 94.03% to 94.29%, while reducing runtime from 48.55 to 9.71 seconds, ap- proximately 5×faster. The longer runtimes of휖REPAIR and DDMax are caused by failed cases reaching the four minute timeout. The difference is influenced by the more balanced mutation distribution of the RepairFormer benchmark compared with the predominantly single mutations in휖REPAIR. Overall, RepairFormer is more effec- tive and efficient on larger inputs. Table 3 shows that performance varies by format and mutation type. DOT and C achieve repair above 92% for single and double mutations, while successful repairs for INI, JSON, and OBJ generally recover more than 91% of the original content. Conference acronym ’X, June 03–05, 2018, Woodstock, NYOvi Paul, Tom J King, and Ali Shokri Table 3: Format and mutation wise metrics. FormatCaseRepair Recovery Runtime CSingle C97.50%95.18%0.98 s CDouble C92.00%91.47%1.63 s CTruncated C99.00%76.78%0.81 s DOTSingle DOT95.30%99.69%10.47 s DOTDouble DOT96.00%99.70%15.69 s INISingle INI93.40%99.48%11.13 s INIDouble INI49.00%99.81%10.17 s JSONSingle JSON94.44%99.65%11.61 s JSONDouble JSON91.92%99.46%18.69 s S-EXPRESSION Single S-EXPRESSION61.70%80.99%1.97 s S-EXPRESSION Double S-EXPRESSION65.00%60.60%2.31 s OBJSingle OBJ94.60%99.53%12.38 s OBJDouble OBJ88.00%99.57%16.81 s OBJTruncated OBJ79.00%91.22%14.56 s 0-50 51-100 101-150151-200201-250251-300301-350351-400401-450451-500 0 1,000 2,000 3,000 4,000 Input Token Length Number of files 0 5 10 0.94s 1.96s 3.61s 4.06s 5.31s 6.88s 8.34s 9.28s 10.63s 12.81s Avg. runtime (s) CountRuntime Figure 2: Input token length distribution with average run- time. Bars show the number of files in each token range, and the red line shows the average total runtime in seconds. Double mutations generally increase runtime because they re- quire more complex corrections or additional attempts, while trun- cation reduces recovery because missing content may not be recon- structed. S expression is the most difficult format, particularly under double mutation. The performance decreases mainly for truncated inputs and highly nested S expression files. Figure 2 shows that runtime increases with input token length rather than file size. Short localized windows use fewer tokens and run faster, while inputs near the token limit require approximately 9.71 seconds. Reducing the token budget may lower runtime but can remove useful repair context. 5 Related Work Several techniques have been proposed for debugging and repairing invalid program inputs. These approaches can be broadly catego- rized as parser-based recovery methods and automated input repair techniques. Parser generators such as ANTLR [9] provide built-in error re- covery for malformed inputs [8]. However, they require a formal grammar specification and are typically limited to local syntax er- rors, making them less suitable for complex structural corruptions or formats without readily available grammars. DDMax [4] repairs corrupted structured inputs by identifying the largest parser-accepted subset of the input. While it is grammar- independent and supports multiple formats, it primarily repairs inputs through deletion, which can reduce content preservation. Its reliance on repeated parser executions can also increase runtime. 휖 REPAIR [8] is a format-independent repair technique that uses parser feedback to search for edits that transform invalid inputs into valid ones. It supports insertions, deletions, and replacements with- out requiring a grammar specification, but still relies on iterative search and repeated oracle executions. In contrast, RepairFormer uses localized error context and a learned repair model to generate repairs directly. 6 Limitations While RepairFormer can effectively repair invalid input files, it has several limitations. First, the model is constrained by a maximum token length. Therefore, longer files may require more precise boundary localization or larger models. Second, repair outcomes depend on oracle-based validation, meaning that different parsers may accept different repairs for the same input. Third, if an error occurs near the edge of the extracted local context window, the model may fail to generate a correct repair. Finally, local repairs may be insufficient when producing a valid fix requires information from distant parts of the input. 7 Conclusion This paper presented RepairFormer, a transformer-based frame- work for repairing corrupted structured inputs. The approach for- mulates input repair as a sequence generation task and uses format tags, oracle validation, and boundary-localized repair to generate valid outputs while preserving original content. Compared with deletion-based repair methods, the proposed method focuses on reconstructing missing or corrupted syntax instead of removing large input fragments. The evaluation shows that our approach achieves 88% repair and 94% recovery, indicating strong content preservation. It performs well on C, DOT, INI, JSON, and OBJ, while S expression remains more challenging. On our benchmark, RepairFormer improves repair by about 10% over state of the art methods while running 5x faster. Overall, the results suggest that transformer-based input repair is a promising direction for producing content-preserving repairs across multiple structured formats. Acknowledgments ChatGPT [1] was used to assist with the generation of limited text and code during the preparation of this work. All generated content was reviewed, validated, and revised by the authors. The authors are solely responsible for the research ideas, methodology, implementation, experiments, analysis, and conclusions presented in this paper. RepairFormer : Automated Repair of Structured Inputs Using TransformersConference acronym ’X, June 03–05, 2018, Woodstock, NY References [1]Josh Achiam, Steven Adler, Sandhini Agarwal, Lama Ahmad, Ilge Akkaya, Floren- cia Leoni Aleman, Diogo Almeida, Janko Altenschmidt, Sam Altman, Shyamal Anadkat, et al.2023. Gpt-4 technical report. arXiv preprint arXiv:2303.08774 (2023). [2]Zimin Chen, Steve Kommrusch, Michele Tufano, Louis-Noël Pouchet, Denys Poshyvanyk, and Martin Monperrus. 2021. SequenceR: Sequence-to-Sequence Learning for End-to-End Program Repair. IEEE Transactions on Software Engi- neering 47, 9 (2021), 1943–1959. doi:10.1109/TSE.2019.2940179 [3]Edward J Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Liang Wang, Weizhu Chen, et al.2022. Lora: Low-rank adaptation of large language models. Iclr 1, 2 (2022), 3. [4]Lukas Kirschner, Ezekiel Soremekun, and Andreas Zeller. 2020. Debugging inputs. In Proceedings of the ACM/IEEE 42nd International Conference on Software Engineering. 75–86. [5]Flip Korn, Barna Saha, Divesh Srivastava, and Shanshan Ying. 2013. On repairing structural problems in semi-structured data. Proc. VLDB Endow. 6, 9 (July 2013), 601–612. doi:10.14778/2536360.2536361 [6]Vladimir I Levenshtein et al.1966. Binary codes capable of correcting deletions, insertions, and reversals. In Soviet physics doklady, Vol. 10. Soviet Union, 707–710. [7]Xu Liu, Peng Zhang, Anubhavnidhi Abhashkumar, Jiawei Chen, and Weirong Jiang. 2024. Automatic Configuration Repair (HotNets ’24). Association for Com- puting Machinery, New York, NY, USA, 213–220. doi:10.1145/3696348.3696895 [8] Zijian Luo, Lukas Kirschner, Ezekiel Soremekun, and Rahul Gopinath. 2025. Auto- matic Data Repair without Format Specifications. In 2025 IEEE 36th International Symposium on Software Reliability Engineering (ISSRE). IEEE, 418–429. [9] Terence Parr and Kathleen Fisher. 2011. L (*) the foundation of the ANTLR parser generator. ACM Sigplan Notices 46, 6 (2011), 425–436. [10] Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. 2020. Exploring the limits of transfer learning with a unified text-to-text transformer. Journal of machine learning research 21, 140 (2020), 1–67. [11] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. Advances in neural information processing systems 30 (2017). [12]Yue Wang, Weishi Wang, Shafiq Joty, and Steven CH Hoi. 2021. Codet5: Identifier- aware unified pre-trained encoder-decoder models for code understanding and generation. In Proceedings of the 2021 conference on empirical methods in natural language processing. 8696–8708.