Deep Neural Networks (DNNs) are highly effective but notoriously brittle when encountering production data that deviates from the training distribution. This paper proposes InputReflector, a novel runtime approach to address "semantically-preserving deviations"—inputs that remain human-recognizable but cause model failure due to environmental noise like blur or lighting changes. By utilizing auxiliary Siamese and Quadruplet networks, InputReflector identifies deviated data and "reflects" it back to the nearest training sample, correcting mispredictions without retraining the base model. Experimental results across MNIST, Fashion-MNIST, and CIFAR-10 show an accuracy improvement from approximately 50% to over 84% on deviated datasets.
The Problem: The "Missing Middle" of Data Drift
Deep learning models typically assume that production data follows the same distribution as training data. However, real-world conditions often introduce noise—such as smudged lenses, varying brightness, or stylistic differences—that lead to performance degradation. Traditional remedies include data augmentation, which is computationally expensive and potentially detrimental to clean-data performance, or Out-of-Distribution (OOD) detection, which simply flags unknown inputs without providing a corrective path.
InputReflector targets the "missing middle": data that is deviated but still contains the necessary semantic information for correct classification.
Methodology: Distribution Analysis and Sample Reflection
The InputReflector framework operates as an auxiliary pipeline alongside a "black-box" deployed DNN. It consists of two primary components:
- Distribution Analyzer: This stage uses a Siamese Network trained with a modified triplet loss to categorize inputs into three zones: In-Distribution (ID), Out-of-Distribution (OOD), and Deviated. By employing two thresholds ($K_{in}$ and $K_{out}$), the system can specifically isolate deviated samples that require correction.
- Sample Reflector: When an input is flagged as "Deviated," a Quadruplet Network maps the input into a high-dimensional embedding space where similar images are tightly clustered. The system then performs a nearest-neighbor search within the original training set to find a "proxy" image. The label of this clean proxy is used as the final prediction.
Key Results and Performance
The authors evaluated InputReflector using MNIST, Fashion-MNIST, and CIFAR-10, simulating production deviations through transformations like blur, brightness, contrast, and zoom.
- Detection and Correction: The Distribution Analyzer achieved a 77.19% detection accuracy for deviated inputs. On these samples, where the original models averaged only 50.08% accuracy, InputReflector boosted performance to 84.63%.
- System Integrity: Crucially, InputReflector maintains 100% of the original model's performance on In-Distribution data, as the reflection mechanism only triggers for detected deviations. This avoids the "poisoning" effect sometimes seen with heavy data augmentation.
- Efficiency: The system introduces a deployment overhead of 2.86s, significantly outperforming existing "advice" systems like SelfChecker (34.33s), making it more viable for real-time production environments.
Conclusion
InputReflector demonstrates that "reflecting" deviated data is a robust and efficient alternative to retraining or simple OOD rejection. By separating the concerns of high-accuracy fitting (base model) and generalizability (auxiliary models), engineers can better handle the unpredictable nature of production environments. Future work will explore scaling nearest-neighbor searches using vector databases and extending the concept to non-visual domains like Natural Language Processing.
Summary updated