Bug localization in hardware description languages (HDLs) helps developers narrow the search space during RTL debugging. However, state-of-the-art HDL bug localization approaches remain constrained by their dependency on time-consuming simulation-based dynamic information, which limits their applicability in early debugging stages. Conversely, while conventional lint-style static analyzers are efficient, their reliance on predefined rules limits their ability to prioritize subtle RTL bug locations. To bridge this gap, we propose SimFree, a novel simulation-free HDL bug localization approach via deep static representation fusion. First, to achieve simulation-free localization, we design a specialized static feature set consisting of two distinct components: structural features and semantic features. The structural features incorporate metrics such as cyclomatic complexity to identify complex code patterns, while the semantic features capture source-code-level textual and syntactic information. Second, to enable low-latency inference, we process these heterogeneous static features with a lightweight deep static representation fusion engine. The engine adopts a dual-stream architecture, combining a customized lightweight TabNet encoder for structural features with a token-based semantic stream to learn bug-related patterns from complementary representations. An adaptive fusion mechanism then combines the two streams to produce the final suspiciousness ranking. Extensive experiments on the CirFix benchmark show that SimFree achieves Top-1 localization in 16 out of 32 bug scenarios, outperforming Carpel by five additional Top-1 hits. It also completes localization within seconds on the benchmark, achieving over 3,000× speedup compared with simulation-based baselines. These results show that SimFree provides an efficient static aid for early-stage RTL debugging, complementing simulation-based localization.
Fault localization in modern processor design code is a critical yet time-consuming step during processor verification. While recent advances in LLM-based techniques for module-level hardware design have shown promising results, automatically localizing bugs in large-scale, project-level processor designs remains challenging. In this paper, we present BluesFL, a novel block-level LLM-based fault localization framework for processor designs. Inspired by the way engineers debug processors, we first propose a dataflow-based code blockization approach to guide LLMs to focus on critical local code context. We further propose a Block-Level Instruction-Oriented Slicing (Blues) algorithm that enables LLMs to mimic human reasoning by analyzing instruction execution paths and processor states. We evaluate BluesFL on a real-world RISC-V processor core comprising 19K lines of SystemVerilog code. Experimental results demonstrate that BluesFL correctly localizes 24 bugs at Top-1, achieving 242.9
The rapid evolution of computing systems driven by emerging applications has elevated the importance of reliable hardware design to unprecedented levels. Ensuring design correctness demands comprehensive verification methodologies that have become essential components of the development lifecycle. Within this process, identifying the precise root cause of failures represents the most time-consuming aspect of hardware verification. Current debugging approaches remain fundamentally limited as they concentrate on symptom observation while over-looking the temporal propagation of bugs through sequential elements. This paper introduces a novel bug localization framework based on temporal sequence reconstruction, which systematically traces bug origins by building complete propagation paths from symptoms to root causes. Our method employs reverse tracing of bug effects through clock cycles by analyzing simulation patterns and design structure, transforming debugging from waveform inspection to guided diagnosis. Experimental evaluation shows our approach significantly outperforms conventional techniques, achieving 6.59% higher accuracy than basic spectrum-based bug localization methods and 6.98% improvement over state-of-the-art solutions while reducing debugging scope by approximately 15.88% through causal analysis.
Flaky tests, which non-deterministically pass or fail under the same code and environment conditions, pose a significant challenge in modern software development. Although machine learning based prediction methods have been proposed to identify flaky tests, they face severe class imbalance, where flaky tests typically constitute only 3–5% of real-world test suites. We propose DiffFlaky, a feature-level augmentation framework based on conditional denoising diffusion probabilistic models. Operating directly in the feature representation space rather than at the raw code level, DiffFlaky learns the underlying distribution of flaky test features from either expert-designed metrics or CodeBERTbased semantic embeddings. Through a conditional reverse denoising process, it generates diverse, distributionally consistent synthetic flaky samples in the feature space to balance the training set. The framework is designed as a plug-in module compatible with any feature-based flaky test predictor. Extensive experiments on the large-scale FlakeFlagger dataset demonstrate that DiffFlaky consistently outperforms existing augmentation methods, including resampling, SMOTE, GAN, and VAE. When integrated with three state-of-the-art predictors (FlakeFlagger, Flakify, and DeepFlaky), DiffFlaky achieves absolute F1-score improvements of 7%–14%, with gains in recall up to 17%. Notably, DiffFlaky identifies substantially more flaky tests than original methods, uncovering complex patterns missed by traditional techniques. Diffusion-based generative augmentation offers a principled and effective solution to the class imbalance problem in flaky test prediction. By learning and augmenting the underlying feature distribution of flaky tests, DiffFlaky generates diverse and high-quality synthetic samples that improve data balance and representation, thereby enhancing the effectiveness of downstream prediction models.
Recent advances in large language models (LLMs) have improved their abilities in knowledge utilization, data understanding, and reasoning, making LLM-assisted root cause analysis (RCA) a promising direction for AIOps. Among these approaches, retrieval-augmented generation (RAG)-based RCA methods enhance LLMs with contextual knowledge from historical incident reports and external knowledge sources, achieving strong performance in production environments. However, their broader adoption is limited by the lack of publicly available, high-quality postmortem corpora, since such data are often inaccessible because of privacy, copyright, and internal policy constraints. To address this limitation, we propose TRAC-RCA, a tool-augmented RCA framework centered on an open RAG corpus for microservice systems. We collect 27,262 incident tickets from public incident dashboards of multiple cloud vendors and open-source incident tickets repositories, and curate 15,918 high-quality postmortem entries through LLM-assisted processing and rigorous manual screening. For systems that lack historical incident reports but provide telemetry data, we further develop an LLM-based method that combines multivariate time-series anomaly detection with structured report generation to infer system-specific postmortems. In addition, we design a set of specialized tools to support LLM-based RCA reasoning. Extensive experiments on three benchmarks show that TRAC-RCA outperforms the baseline, with a maximum improvement of 55 percentage points using GPT-4o and an average gain of 9.4 percentage points on hard tasks across all LLMs. To facilitate future research, we publicly release the resulting postmortem corpus at https://github.com/grampus-whcz/TRAC-RCA.
Fault localization (FL) aims to identify suspicious statements in faulty programs that may lead to program failure. Coverage representation, which includes code coverage trace and test outcomes, has proven effective in FL and is widely adopted in deep learning-based fault localization (DLFL) methods. However, we find that the potential of coverage representation in deep learning-based fault localization (DLFL) methods is inadequately unleashed (i.e., in the case of using pure coverage representation) since DLFL has exhibited inferior performance compared to traditional non-deep learning-based fault localization (Non-DLFL). Thus, we conduct systematic analyses by the three key steps of the DLFL task process: data-model-strategy. These analyses reveal that existing methodologies fail to handle three key scale variations in DLFL: sample scale of data, feature scale of model, and task scale of strategy. To address these challenges, we propose Muser, a multi-scale-aware deep learning-based fault localization method based on the data-model-strategy framework to unleash the potential of coverage representation in DLFL. Specifically, Muser addresses the three scale variations through a hierarchical design: for the sample scale, Muser employs a sample-scale-aware data augmentation method that dynamically selects optimal methods based on the sample size to mitigate class imbalance; for the feature scale, Muser uses a proposed feature-scale-aware adaptive LSTM backbone with model sizing adjustments to handle varying feature dimensionality in coverage representations; for the task scale, Muser further employs task-scale-aware modeling strategies to enhance robustness across diverse fault localization scenarios, thereby systematically improving model adaptability and performance. We conduct large-scale experiments to evaluate Muser, and the results show that Muser significantly improves pure coverage-based DLFL performance, e.g., the data augmentation method and the backbone neural network outperform the state-of-the-art (SOTA) baselines (i.e., PRAM and RNN-FL) by 12.41% and 94.44% on average in Top-1 metrics, respectively.
Flaky tests present a major challenge in software testing, as they intermittently pass or fail without changes to the source code, leading to developer frustration and wasted resources. Current methods for detecting and classifying flaky tests often overlook the hierarchical dependencies among the root causes of flakiness in test code. Additionally, their tools fail to handle complex cases involving multiple flaky causes and lack the capability for fine-grained classification.To this end, we propose HiFlaky , a hierarchy-aware multi-label classification method for flaky tests that identifies multiple co-occurring root causes along different hierarchical paths, such as diagnosing a single test with both “Flaky/NOD/Network” and “Flaky/NOD/Concurrency/Async Wait”. HiFlaky leverages static semantic features from test code and hierarchy features, without dependency on dynamic execution features. To overcome the shortage of multi-root annotated data, we build a new dataset by expanding and labeling existing single-root datasets (IDoFT and FlakeFlagger) and 335 flaky tests from 145 Java projects on GitHub. Empirical evaluations demonstrate the effectiveness of HiFlaky in addressing both single and multi-root cause scenarios. In single-root cause scenarios, HiFlaky exhibits enhanced prediction accuracy compared to state-of-the-art methods, achieving a 30% increase in Precision and an F1 score of 79%. Furthermore, the fine-grained classification offered by HiFlaky provides useful insights that can facilitate root cause analysis, reduce debugging efforts, and contribute to improved software reliability. For complex multi-root cause scenarios, HiFlaky attains a Micro-F1 score of 0.812 and a Macro-F1 score of 0.414 across 29 categories.
Context: Flaky tests, which exhibit non-deterministic pass or fail behavior without code changes, pose a significant challenge to continuous integration. Existing detection approaches either rely on manually engineered features or deep semantic representations but fail to effectively integrate them. These approaches still suffer from limited representational quality and lack mechanisms to enhance feature space, leading to weakly discriminative representations. Objective: To overcome the limitations of existing approaches that rely on a single source of features and lack mechanisms to learn robust representations from limited labeled data, we propose DeepFlaky. It not only fuses the interpretability of expert features with the contextual richness of deep semantic representations but also introduces contrastive learning to explicitly structure the feature space, thereby learning more discriminative and generalizable representations for flaky test prediction. Method: DeepFlaky extracts expert features and semantic representations from test code using CodeBERT. A contrastive learning module optimizes hybrid representations by aggregating positive samples and separating negative ones. The enhanced representation is finally fed into five classifiers for prediction. Results: Experiments on a widely-used public dataset demonstrate that DeepFlaky outperforms state-of-the-art baseline approaches. It achieves Precision, Recall, and F1-Scores of 93%, 93%, and 93%, with XGBoost performed the best in terms of the evaluation metrics. Ablation studies confirm the individual contributions of expert features, semantic features, and contrastive learning. Overlap analysis shows that DeepFlaky identifies 67 to 282 additional unique flaky tests missed by prior models, including 41 flaky tests not detected by any of the baseline models. Furthermore, DeepFlaky exhibits relatively better generalization in cross-project scenarios compared to other methods. Conclusion: DeepFlaky demonstrates the complementarity between expert features and semantic features, as well as the effectiveness of contrastive learning in enhancing the quality of code representation. It offers a robust and generalized solution that can effectively capture complex flaky patterns.
Coincidental correctness (CC) arises when a test case executes faulty entities in a program without triggering a failure. This phenomenon injects noise into coverage information and impairs the accuracy of fault localization (FL). To address this, we propose FusionCC: an approach that applies multiscale coverage features and handcrafted features to fuse complementary feature representations for CC test cases detection. Specifically, FusionCC first refines original coverage data by filtering out noisy irrelevant elements, then extracts multiscale features from the refined matrix, and finally fuses the coverage and handcrafted features for robust detection. To evaluate the effectiveness of FusionCC, we conduct large-scale experiments on 277 faulty versions of nine representative benchmarks. The experimental results show that FusionCC significantly improves the performance of CC detection and FL.
Fixing bugs in hardware design code has become a challenging task due to the increasing complexity of modern circuit designs. As a result, automated program repair (APR) techniques have been proposed to synthesize patches for bugs in hardware designs and have achieved promising results. However, existing techniques are still limited in synthesizing expressions for complex bugs. In this work, we explore the possibility of addressing complex bugs by proposing SRepair, a novel symbolic regression-based repair technique. The key novelty of SRepair lies in three aspects: 1) we propose a novel expression modification encoding (EME) that enables fine-grained adjustments to buggy expressions; 2) we introduce expression synthesis-based templates that allow for flexible and expressive repairs; and 3) we develop a novel symbolic regression network (SNR)-based synthesis algorithm that effectively synthesizes complex expressions. Experimental results on the four peer-reviewed datasets demonstrate that SRepair correctly fixes 56 bugs out of 112 bugs, which achieves 43.6% and 194.7% improvement over the previous state-of-the-art RTL-Repair (39 bugs) and CirFix (19 bugs). To evaluate the generalizability of SRepair, we further construct an augmented dataset of 282 bugs by mutating hardware designs. SRepair shows its better generalizability by correctly fixing 127 bugs, reaching 217.5% improvement over the best approach.
Effective bug localization in hardware description language (HDL) programs is a cornerstone of modern design verification. However, its efficacy is fundamentally challenged by the intrinsic nature of hardware execution: massive parallelism and deep temporal statefulness. These properties lead to current dynamic representations with two critical flaws. First, they lack discriminative ability, as the concurrent and cumulative nature of hardware execution causes binary coverage spectra to quickly saturate, masking the unique behavioral signatures of different execution profiles. Second, their contextual awareness is inherently weak, as they are polluted by noise from ambiguous passing profiles that are behaviorally similar to failing ones, and from a vast number of concurrently executing but causally irrelevant statements. To overcome these challenges, we propose DyReL, a novel Dynamic Representation Learning method that learns a highfidelity, orthogonally-regularized representation from raw execution traces. DyReL initiates its workflow by constructing a discriminative representation that replaces binary coverage with statement execution frequency, thereby capturing the nuanced operational intensity of the design and counteracting the masking effect. Subsequently, it refines this representation via a novel orthogonal contextual regularization algorithm. This algorithm systematically addresses the two orthogonal sources of noise: it filters ambiguous instances by modeling their contextual hardness and prunes irrelevant statements using program slicing. Rigorous evaluation on a diverse HDL benchmark demonstrates that DyReL significantly outperforms evaluated state-of-the-art baselines. Empirical evaluations demonstrate that DyReL improves the Mean First Rank (MFR) by over 15% relative to the strongest baseline. These results demonstrate that learning frequency-aware and context-regularized dynamic representations provides an effective foundation for hardware code bug localization.
Context: Fault localization (FL) aims to identify faulty lines of code within large software systems. Traditional FL methods often rely on test coverage and handcrafted metrics, limiting their performance due to sensitivity to test quality and system complexity. While learning-based methods improve adaptability, they struggle with modeling fine-grained semantics and generalizing across diverse codebases. Objective: We propose a scalable, test-free neural architecture that models both local and global code context to improve fault localization accuracy. Method: We present TransMambaFL, a novel test-free fault localization method that hierarchically models both local and global code semantics. It utilizes line-level embeddings derived from pre-trained large language models (LLMs). At the intra-group level, a hybrid Transformer-Mamba encoder captures both local syntactic patterns and long-range dependencies. At the inter-group level, a file-level Transformer aggregates contextual representations, which are then fused back into line-level embeddings through a learnable context integration mechanism. Results: Experiments on multiple real-world FL datasets show that TransMambaFL outperforms state-of-the-art LLM-based methods, achieving Top-1 accuracy improvements of 2.3-29.0% and Top-3 accuracy improvements of 21.5-43.8%, demonstrating strong effectiveness and scalability. Conclusion: By combining LLM-based semantics with Transformer precision and Mamba scalability, Trans-MambaFL delivers accurate, scalable, and test-free fault localization suitable for real-world debugging tasks.
As deep learning (DL) systems are increasingly deployed in safety-critical domains, e.g., intelligent planning and autonomous driving, localizing faults that occur in such systems becomes indispensable. Inevitably, DL systems also suffer from faults like traditional software. Although single fault localization for DL programs has been studied, the multiple-fault localization for DL programs remains underexplored. We notice that mutation analysis is a powerful technique for locating multiple faults since it can simulate the faulty behaviors of a DL program by generating multiple mutants simultaneously. Thus, we propose MuMuFL: Statistical Mutation-based Multiple Fault Localization approach to locate the multiple faulty statements residing in a faulty DL program. The insight of MuMuFL is that the different behaviors of mutants provide valuable information for pinpointing the faulty statements of a DL fault. MuMuFL defines and leverages DL mutation operators on a DL program to simulate the faulty DL behavior. Then, MuMuFL evaluates the difference in the accuracy between the original DL model and the mutated DL model to quantify the suspiciousness of each statement being faulty. Finally, the large-scale experiments show that MuMuFL effectively localizes DL faults, e.g., localizing 36% of multiple-fault DL programs, whereas the best-performing baseline can only localize 14% of them.
Flaky tests undermine continuous integration feedback because their outcomes can change without code changes. Flaky-test prediction is especially useful before a project has accumulated enough local flakiness history to train a reliable project-specific model. This paper studies cross-project flaky-test prediction as a deployment-oriented setting, where knowledge learned from existing projects is applied to a target project whose tests follow a different distribution. We propose CoDA-FTP, a conservative domain-adaptation approach for this setting. CoDA-FTP builds fused expert and semantic test representations, selects source projects that are close to the target project, and adapts only the selected source representations toward the target feature distribution before prediction. This select-then-align design aims to reduce negative transfer from distant projects while avoiding over-expansion of flaky warnings. On 21,413 tests from 23 Java projects under leave-one-project-out evaluation, CoDA-FTP achieves 70% precision, 44% recall, 54% F1, and 92% AUC. Compared with traditional feature-based and neural baselines, the improvement mainly comes from reducing false positives while preserving useful recall. These results show that conservative selected-source adaptation is a practical design principle for cross-project flaky-test prediction.
Learning-based dynamic fault localization techniques play a crucial role in the field of software engineering. These techniques dynamically execute test cases to meticulously extract useful knowledge from the execution information in the program, with the aim of identifying fault locations by leveraging machine learning, deep learning, and large language models. Currently, there is already a flourishing body of research that is intensely focused on learning-based dynamic fault localization. Research literature can be categorized into two main aspects for learning-based dynamic fault localization: data-based enhancements (i.e., the datasets) and model-based enhancements (i.e., the suspiciousness algorithms). Thus, we conduct an extensive literature review on learning-based dynamic fault localization from the aspects of the data task and the model task. Among them, each task is divided into multiple sub-tasks in a systematic manner to comprehensively discuss the details. In addition, we analyze and summarize the datasets and metrics that have been widely used to evaluate the effectiveness of the proposed techniques in recent years, so that researchers can have an intuitive perception of them. We also discuss the present challenges and the directions for future research.
Flow-electrode capacitive deionization (FCDI) is a novel ammonia removal technology that aligns with circular economy principles and sustainable development goals, offering the notable benefits of continuous operation and high efficiency. However, traditional carbon-based materials as FCDI flow electrodes face limitations, including poor conductivity, high cost, potential toxicity, and a tendency to disperse. Herein, a novel N/O-codoped carbon aerogel (CA) was prepared using a simple agar sol-gel method, with NaCl as the template and NH4Cl as the blowing agent. The nitrogen adsorption/desorption isotherm revealed the high specific surface area of CA, while electrochemical impedance tests confirmed its good conductivity. Compared to the commercial activated carbon (AC), the rich N and O doping in CA created a synergistic effect, resulting in improved electrical conductivity, super water solubility (dispersibility), and particle light weight. It shows higher NH4+ removal efficiency (97.42 +/- 0.84 %), adsorption rate (3.80 mu g/cm(2)min), and lower energy consumption (0.98 kWh/kg-N) in FCDI deammoniation. In addition, CA electrodes showed high NH4+ selectivity in binary/ternary salt solutions, coexisting high concentration NaCl solutions, and real wastewater, holding potential practical application value. Furthermore, upon 50 h of continuous operation, the NH4+ removal efficiency and charge utilization efficiency of the CA electrode were maintained at similar to 95.58 % and similar to 75.01 %, respectively, outperforming most NH4+ adsorption materials. This study confirmed the potential commercial value of CA electrodes for ammonia recovery in FCDI applications.
The software development process is characterized by an iterative cycle of continuous functionality implementation and debugging, essential for the enhancement of software quality and adaptability to changing requirements. This process incorporates two isolatedly studied tasks: Code Search (CS), which retrieves reference code from a code corpus to aid in code implementation, and Fault Localization (FL), which identifies code entities responsible for bugs within the software project to boost software debugging. The basic observation of this study is that these two tasks exhibit similarities since they both address search problems. Notably, CS techniques have demonstrated greater effectiveness than FL ones, possibly because of the precise semantic details of the required code offered by natural language queries, which are not readily accessible to FL methods. Drawing inspiration from this, we hypothesize that a fault localizer could achieve greater proficiency if semantic information about the buggy methods were made available. Based on this idea, we propose \(\mathtt{CosFL}\), an FL approach that decomposes the FL task into two steps: query generation, which describes the functionality of the problematic code in natural language, and fault retrieval, which uses CS to find program elements semantically related to the query, allowing for finishing the FL task from a CS perspective. Specifically, to depict the buggy functionalities and generate high-quality queries, \(\mathtt{CosFL}\) extensively harnesses the code analysis, semantic comprehension, text generation, and decision-making capabilities of LLMs. Moreover, to enhance the accuracy of CS, \(\mathtt{CosFL}\) captures varying levels of context information and employs a multi-granularity code search strategy, which facilitates a more precise identification of buggy methods from a holistic view. The evaluation on 835 real bugs from 23 Java projects shows that \(\mathtt{CosFL}\) successfully localizes 324 bugs within Top-1, which significantly outperforms the state-of-the-art approaches by 26.6%-57.3%. The ablation study and sensitivity analysis further validate the importance of different components and the robustness of \(\mathtt{CosFL}\) across different backend models.
Test cases are indispensable for conducting effective fault localization (FL). However, test cases in practice are severely class imbalanced, i.e. the number of failing test cases (i.e. minority class) is much less than that of passing ones (i.e. majority class). The severe class imbalance between failing and passing test cases have hindered the FL effectiveness. To address this issue, we propose PCD-DAug: a Principal Context-aware Diffusion guided Data Augmentation approach that generate synthesized failing test cases for improving FL. PCD-DAug first combines program slicing with principal component analysis to construct a principal context that shows how a set of statements influences the faulty output via statistical program dependencies. Then, PCD-DAug devises a conditional diffusion model to learn from principle contexts for generating synthesized failing test cases and acquiring a class balanced dataset for FL. We conducted large-scale experiments on six state-of-the-art FL approaches and compare PCD-DAug with six data augmentation baselines. The results show that PCD-DAug significantly improves FL effectiveness, e.g. achieving average improvements of 383.83 224.19 respectively.
Test Case Prioritization (TCP) is a critical technique for improving efficiency in CI/CD pipelines. While applying Large Language Models (LLMs) to this task is a promising direction due to their advanced code comprehension, naively using them as monolithic tools fails to address key engineering challenges of scale, tool-integration, and structured reasoning. To address these shortcomings, we propose AgentTCP, a novel collaborative multi-agent framework for change-aware test case prioritization. Our framework decomposes the TCP task into a structured, three-stage workflow managed by specialized, LLM-driven agents: 1) a Code Change Analyst assesses the intent and risk of new commits; 2) a Test Coverage Strategist correlates changes with test cases by interacting with coverage data via tool-integration; 3) a Risk-aware Prioritizer synthesizes all information to generate a final, ranked list with reasoning. By delegating distinct responsibilities, AgentTCP mitigates the context and reasoning issues of monolithic models and produces verifiable intermediate results, enhancing overall trustworthiness. Experimental results on the widely used Defects4J benchmark demonstrate that AgentTCP surpasses the monolithic-LLM baseline by 11.75 points in terms of the APFD metric, highlighting its superior effectiveness in prioritizing fault-revealing test cases.
The growing prominence of deep code models in automating software engineering tasks is undeniable. However, their deployment encounters significant challenges in on-the-fly performance enhancement , which refers to dynamically improving the performance of deep code models during real-time execution. Conventional techniques, such as retraining or fine-tuning, are effective in controlled pre-deployment scenarios but fall short when adapting to on-the-fly adjustments post-deployment. CodeDenoise, a notable on-the-fly performance enhancement technology, leverages uncertainty-based methods to identify misclassified inputs and applies an input modification strategy to rectify classification errors. While effective for classification tasks, this approach is inapplicable to generative tasks due to two key challenges: ❶ Uncertainty-based methods are unsuitable for identifying challenging inputs , especially in generative tasks with diverse and open-ended outputs. Challenging inputs refers to a class of inputs where, due to the inherent complexity of the task or insufficient context in the input samples, the model struggles to generate high-quality outputs. ❷ Input modification strategies cannot be applied to generative tasks, as modifying the input can unpredictably affect the entire sequence of generated outputs. These limitations highlight the need for novel techniques that can enhance the generation quality of deep code models in real-time. To bridge this gap, we propose CodEn , a framework designed to enhance the generation quality of deployed deep code models through model collaboration and real-time output repair. CodEn employs an ensemble learning approach, integrating multiple generic output quality assessment metrics to identify challenging inputs . By combining these diverse metrics, CodEn overcomes the limitations of uncertainty-based methods, making it effective across various generative tasks. Additionally, we introduce an elaborate on-the-fly repair method for the outputs of challenging inputs , leveraging a large language model (LLM) and a novel dual-prompt strategy. This strategy utilizes both generation and selection-based prompts to provide potential fixes and employs an adaptive mechanism to select the optimal output. Our experiments, conducted on 12 deep code models across three pre-trained code models, three popular code-related generation tasks, and four datasets, demonstrate the effectiveness of CodEn . For example, in the assertion generation task, CodEn enhances the SAM (Semantic Accuracy Match) of baseline models with improvements ranging from 12.14% to 21.65%. In the bug fixing task, CodEn achieves exact match gains ranging from 17.51% to 30.64% on TFix dataset. For the code summarization task, CodEn significantly boosts performance across key metrics: BLEU scores improved by 5.72% \(\sim\) 11.79%, ROUGE-L by 4.41% \(\sim\) 7.70%, METEOR by 7.51% \(\sim\) 12.29%, and CIDEr by 8.09% \(\sim\) 15.80%. Besides, we conduct experiments of CodEn on different open-source LLMs and demonstrate that CodEn can still achieve significant improvements.