Latest Findings · ASI Lab

Keeping the Most Important Data, Not the Most: A Smarter Fix for Imbalanced Defect Prediction

Software defect prediction, or SDP for short, must spot the few buggy modules buried inside a huge pile of clean ones, so most data is boring and only a little is interesting. A team from CityU and Zhengzhou University built AIIUS, a method that keeps the clean modules that actually shape how the model draws its dividing line between good and bad code. Across 18 real projects and 5 classifiers it lifted Balance by 9.50%, AUC by 3.43%, and MCC by 17.02% over strong competitors.

Shuo Feng, Rongping Li, Jacky Keung, Xiao Yu, Yucheng Shi, Mingliang Xu
Agentic Software Intelligence Research Lab · Department of Computer Science, City University of Hong Kong
Journal of Systems and Software · 2027

Software defect prediction, or SDP for short, must spot the few buggy modules buried inside a huge pile of clean ones, so most data is boring and only a little is interesting. A team from CityU and Zhengzhou University built AIIUS, a method that keeps the clean modules that actually shape how the model draws its dividing line between good and bad code. Across 18 real projects and 5 classifiers it lifted Balance by 9.50%, AUC by 3.43%, and MCC by 17.02% over strong competitors.

Flowchart of the AIIUS method showing K means clustering of non defective instances, a surrogate model running PGD attacks, Adversarial Influence scoring from the target classifier's prediction change, and influence guided undersampling to build a balanced dataset.
The AIIUS workflow: clean (non defective) modules are first grouped by K means into representative candidates, a stand in surrogate model runs PGD adversarial perturbations on those representatives, and the target classifier's prediction change is squared into an Adversarial Influence score (I). The most influential candidates are then retained and merged with the defective modules to form a balanced dataset.

Why it matters

Software defect prediction suffers from a lopsided reality: an ordinary codebase is mostly clean, so only a handful of modules actually carry defects. When a machine learning model trains on that skew, it learns to call almost everything clean, which looks accurate but quietly lets real bugs slip through to production. Older fixes either randomly throw away clean data, which wastes useful signals, or invent synthetic buggy samples that add noise. AIIUS takes a smarter route: it scores every clean module by how much nudging it shifts the model's prediction, treating the ones near the decision boundary as the most valuable to keep.

The method borrows an idea from adversarial machine learning, where small crafted changes test how fragile a model is, and turns it into a positive, constructive tool. Instead of attacking models, AIIUS uses a lightweight stand in model to generate those small nudges and measures the target classifier's reaction, defined as the squared change in predicted defect probability. The bigger the reaction, the more that clean module matters for telling bugs apart from healthy code. It then clusters the clean instances first, chooses representatives, ranks them by their influence scores, and keeps only the most influential ones until the classes are balanced. The result is a training set that preserves the shape of the data while keeping the pieces that really define the boundary.

The payoff goes beyond one benchmark. On 18 public datasets drawn from four authoritative repositories and tested with five common classifiers, AIIUS delivered consistent, often statistically significant gains over six competing resampling methods on the metrics that matter most for imbalanced data. It also proved robust to design choices: a moderate clustering ratio gave the best mix of performance and stability, and a simple neural network stand in was enough, so the method does not depend on heavy machinery. Because it only needs the model's probability outputs and not its internals, it works even when the classifier is a closed black box, which matches how real systems are often deployed.

Key findings

Three headline wins, one clear idea

What it means for practitioners

For teams that already run defect prediction pipelines, AIIUS drops in as a data level preprocessing step ahead of training, so it works with nearly any classifier and does not require changing your model. Its main practical advantage is that it keeps the clean modules that actually sculpt the decision boundary rather than discarding clean data at random, which frequently improves balanced measures such as MCC and Balance that reward finding real bugs without crying wolf. Because it only needs the model's predicted probabilities for the original and slightly nudged instances, it also suits setups where the model is served as a closed endpoint, allowing boundary aware selection without access to internal weights.

There is a cost to weigh: AIIUS trains a stand in network and runs iterative perturbation generation plus parameter tuning, so it is heavier than simple random undersampling. The workflow places clustering first to shrink the candidate pool and keep this overhead manageable, and the published results argue the accuracy and stability gains justify the added compute. The method also appears applicable beyond defect prediction, to any tabular imbalance problem with numerical features and a queryable classifier, such as fault diagnosis, risk scoring, smart contract vulnerability detection, or IoT malware detection, and the authors sketch how a federated or privacy preserving version could work when raw data cannot be shared.

Related reading

Get the paper & cite it

Download full PDF ↓ View at DOI

Official citation: Shuo Feng, Rongping Li, Jacky Keung, Xiao Yu, Yucheng Shi, Mingliang Xu (2027). Decision-boundary aware undersampling via Adversarial Influence for imbalanced software defect prediction.. Journal of Systems and Software. DOI: 10.1016/j.jss.2026.113105.

defect prediction imbalance undersampling adversarial influence software quality