Abstract
Programmatic Weak Supervision (PWS) allows for rapid data labeling using heuristic Labeling Functions (LFs), but these functions are often noisy and difficult to debug manually. We present RuleCleaner, a framework that automatically repairs noisy LFs using a small set of ground-truth labels. RuleCleaner translates LFs into interpretable decision trees and employs a two-stage optimization process: a global Mixed-Integer Linear Programming (MILP) step to identify necessary label changes, followed by an entropy-based local refinement to update rule predicates. Our evaluation across 11 real-world datasets demonstrates that RuleCleaner significantly improves labeling accuracy, outperforms Large Language Models (LLMs) in specialized domains, and operates orders of magnitude faster than direct LLM labeling.
Introduction
The bottleneck in modern machine learning is no longer the model architecture, but the availability of high-quality labeled data. Programmatic Weak Supervision (PWS) has emerged as a powerful paradigm to address this, enabling users to write Labeling Functions (LFs)—simple rules or heuristics—to label large datasets programmatically. However, LFs are inherently imperfect. They can be overly broad, conflict with one another, or contain logic errors that lead to systematic misclassifications. Debugging a large collection of LFs is a labor-intensive process that requires deep domain expertise.
RuleCleaner addresses this challenge by leveraging a tiny "gold standard" dataset (typically 20–150 examples) to automatically refine and "clean" existing LFs. By treating LFs as interpretable rules rather than black-box code, RuleCleaner can surgically adjust their logic to align with ground truth while preserving their original intent.
The RuleCleaner Framework
RuleCleaner operates through a structured pipeline that transforms noisy heuristics into precise, refined rules.
The process consists of three main phases:
- LF-to-Rule Translation: Arbitrary Python-based LFs are converted into interpretable decision tree structures. This representation allows the system to treat the labeling logic as a series of branching predicates, making it amenable to mathematical optimization.
- Global Optimization via MILP: RuleCleaner employs Mixed-Integer Linear Programming (MILP) to determine the optimal set of label changes. The objective is to satisfy three key criteria: evidence (ensuring enough LFs vote on each point), datapoint accuracy (ensuring majority votes are correct), and rule accuracy (maintaining a performance threshold for each rule). To avoid overfitting the small labeled set, the MILP is constrained to minimize the total number of modifications to the original rules.
- Local Refinement (EntropyPathRepair): After the MILP identifies which rule outputs need to change, the EntropyPathRepair algorithm determines how to modify the tree structure. Using an entropy-based heuristic, it introduces new predicates to the decision tree to override incorrect outputs in specific contexts.
Experimental Evaluation
The researchers evaluated RuleCleaner on 11 diverse datasets, including sentiment analysis (Amazon, IMDB, Yelp), news classification (AGnews, FNews), and specialized biomedical tasks (ChemProt). LFs were sourced from automated generation tools (Witan) and Large Language Models (GPT-4o).
Key Insights
- Minimal Change Principle: RuleCleaner succeeds by making surgical adjustments. Instead of discarding human or LLM-generated logic, it builds upon it, fixing only the specific "blind spots" identified by the labeled data.
- Interpretable Refinement: Unlike neural network fine-tuning, RuleCleaner outputs modified Python functions. This transparency allows developers to inspect the refined rules—for instance, seeing how the system learned that "one star" indicates a negative sentiment even if "star" is generally positive.
- Efficiency and Domain Expertise: While LLMs are capable labelers, they are often too slow and expensive for large-scale tasks. RuleCleaner demonstrates that using an LLM to generate initial rules, which are then refined algorithmically, is a far more efficient strategy. Furthermore, on the specialized ChemProt dataset, RuleCleaner + Snorkel achieved 37.9% accuracy, significantly outperforming GPT-4o's 27.4%, highlighting the value of refined heuristics in niche domains.
Conclusion
RuleCleaner provides a robust, efficient, and interpretable solution for the "noisy LF" problem in programmatic weak supervision. By combining the strengths of global optimization and local tree refinement, it enables developers to achieve high labeling accuracy with minimal manual effort. Future work will explore extending this framework to more complex information extraction tasks beyond simple classification.
Summary updated