Introduction: The High-Entropy Challenge in Sequence Prediction
Machine learning models for sequence prediction, such as those generating function names in source code, often struggle with a "high entropy" problem. A model might produce dozens of plausible candidates, each with a low individual probability. For instance, if a model predicts fetch_data_from_cache while the ground truth is get_cached_data, standard metrics mark it as a failure despite the model capturing the semantic essence of the operation.
In software engineering tools, this specificity leads to high false-alarm rates in anomaly detection. Developers do not always need a perfect character-for-character match; they need accurate, high-level abstractions. EPICURE addresses this by distilling probabilistic outputs into high-precision abstract patterns.
Methodology: From Concrete Predictions to Abstract Lattices
EPICURE is a model-agnostic post-processing wrapper that sifts through the top results (e.g., the top 100 results from a beam search) of any sequence generator.
1. Pattern Generation via Anti-Unification
The core of EPICURE is a join operation ($⊔$) based on anti-unification. By treating predictions as sequences of subtokens, it identifies commonalities. For example, joining the predictions [load, data, msgpack] and [load, file, msgpack] results in the pattern [load, ⋆, msgpack], where ⋆ is a wildcard representing zero or more arbitrary elements.
2. Lattice Construction and Probability Assignment
EPICURE iteratively applies this join operation to build a hierarchical lattice. The bottom nodes represent specific predictions, while higher nodes represent increasingly general patterns that subsume them. The probability of an abstract pattern is calculated as the sum of the probabilities of all concrete predictions it matches.
3. Distillation
Given a confidence threshold (e.g., $θ > 0.5$), EPICURE selects the most specific patterns that meet that threshold. This ensures the output is both highly likely to be correct and as descriptive as possible, representing a majority consensus of the model's probability mass.
Evaluation and Key Results
The authors evaluated EPICURE using the UniXcoder-base model on the CodeSearchNet corpus and a custom Python test set of 250,000 samples from GitHub repositories created after the model's training data cutoff to prevent memorization.
Performance Metrics
The method was compared against a standard baseline that filters the top prediction by a probability threshold.
- Naming Accuracy: At a 10% False Alarm Rate, EPICURE's patterns matched ground-truth names 61% more often than the best single-model prediction.
- RegexAcc and Complete Matches: EPICURE consistently outperformed the baseline across various error tolerances.
RegexAccmeasures how many subtokens of the ground truth are captured by the pattern, whileComplete Matchestracks exact hits.
Insights and Future Directions
EPICURE prioritizes precision over specificity. By allowing models to "admit" uncertainty through wildcards, it provides more reliable suggestions for high-precision scenarios like automated code review or anomaly detection. The lattice structure also offers interpretability; if a function named save_file is flagged against a distilled pattern of load⋆, the discrepancy is immediately clear to a developer.
Future work may involve moving beyond simple wildcards to more complex regular expressions or grammar-aware patterns, potentially extending the technique to other sequence tasks like machine translation or image captioning.
Summary updated