TL;DR
Researchers have developed Halal-NeSyNet, a neuro-symbolic model that audits food ingredient lists for Halal compliance by respecting "clause scope." By combining deep learning with rule-based symbolic logic, the system prevents "false-Halal" errors where a qualifier like "plant-based" in one part of a label incorrectly clears a suspicious additive in another.
What Problem Does This Paper Address?
Verifying if packaged food is Halal is a high-stakes auditing task. Many common additives, like emulsifier E471, are "Mushbooh" (doubtful) because they can be derived from either animal or plant sources. They are only considered Halal if a specific qualifier (e.g., "vegetable origin") appears in the same ingredient clause.
Standard NLP models often suffer from cross-clause modifier confounding. For example, in the list "bakery shortening (plant-based), emulsifier: E471", a typical "bag-of-words" model sees both "plant-based" and "E471" and might incorrectly label the product Halal. In reality, the "plant-based" qualifier only applies to the shortening, leaving the E471's origin unknown and the product doubtful. This failure can lead to "false-Halal" leaks, potentially contaminating entire certified warehouses.
Methods
The authors propose Halal-NeSyNet, a dual-stream architecture that fuses neural text processing with symbolic rules:
- Text Stream: A pre-trained DistilBERT encoder processes the raw ingredient text.
- Symbolic Stream: A rule engine parses the text into a 16-dimensional vector. This engine is "clause-aware"—it only links qualifiers to additives within the same grammatical clause.
- Cross-Attention & Gated Fusion: The symbolic features act as "queries" that attend over the text tokens. A sigmoid gate then intelligently blends the neural and symbolic representations before final classification.
- Asymmetric Risk Loss: Recognizing that a "false-Halal" error is much worse than a "false-quarantine" (which only causes a delay), the model is trained with a custom loss function that heavily penalizes unsafe predictions.
Datasets
- Main Benchmark: A new dataset of 3,199 items. This includes 277 real-world records from Open Food Facts and 2,922 template-generated items designed to systematically test clause-swapping.
- Counterfactual Suite: A specialized 540-item suite (180 triplets) where only the placement of qualifiers changes. This serves as a "stress test" for clause-scope sensitivity.
Key Insights and Ideas
- Symbolic Logic is the Heavy Lifter: A major finding was that the symbolic features themselves account for most of the performance gain. Even a simple gradient boosting model (XGBoost) using these features outperformed vanilla deep learning models.
- The Power of Hybridization: While symbolic features are powerful, the full Halal-NeSyNet architecture showed the best stability and lowest variance across different data splits, suggesting the neural component helps the model generalize better to varied phrasing.
- Fidelity vs. Certification: The authors clarify that their model measures fidelity to a specific rule policy, not religious truth. Because the labels and features come from the same rule engine, the high accuracy proves the model has "learned" to follow the rules perfectly, even when the text is messy.
Key Results
- High Accuracy: Halal-NeSyNet achieved 97.04% accuracy, significantly higher than text-only baselines (~86%).
- Counterfactual Mastery: On the modifier-swap stress test, the model reached 99.67% consistency, whereas standard models failed nearly every time (6-26% consistency).
- Warehouse Triage: In a simulated "three-lane" receiving dock, the system could automatically clear ~49% of cargo with less than 1% contamination in the green lane.
Limitations and Future Work
- Synthetic Data: Over 90% of the benchmark is template-generated. Future work needs to validate performance on a larger set of unconstrained, real-world packaging labels.
- OCR Noise: The study used clean text for features. In a real warehouse, the symbolic parser would have to deal with noisy text from optical character recognition (OCR).
- Scope & Language: The current system is limited to English. Expanding the rule base to handle multilingual declarations is a logical next step.
- Human-in-the-loop: The authors suggest that while the model is great for triage, final authority should remain with accredited certification bodies.
Summary updated