Manuscript Offprint

arXiv:2611.01612

Halal-NeSyNet: Clause-Scoped Neuro-Symbolic Cross-Attention for Automated Food Ingredient Auditing and Risk-Aware Halal Logistics Triage

Mochamad Rizal Fauzan, Naila Nursyifa, Irgi Surya

Mochamad Rizal Fauzan

National Taipei University of Technology

Taipei, Taiwan

t114998415@ntut.edu.tw

Nai'la Nursyifa

Logistics Engineering

Universitas Pendidikan Indonesia

Bandung, Indonesia

nailanrsy@upi.edu

Irgi Surya

National Taipei University of Technology

Taipei, Taiwan

t115999404@ntut.edu.tw

Abstract—Verifying that a packaged food is Halal requires reading ingredient declarations and E-number additives before goods enter certified warehouses. Dual-origin additives such as E471, E422, E441 and E920 are Mushbooh (doubtful) unless a botanical, microbial or certified-Halal qualifier appears in the same ingredient clause, so a plant-based qualifier on one clause must not clear an unqualified additive in another. We call a failure to respect this scope cross-clause modifier confounding and build a benchmark of 3,199 items (277 Open Food Facts records and 2,922 template-generated clause-swap items, labelled by an explicit 50-code rule base rather than by a certification authority) with a 540-item counterfactual suite. We propose HALAL-NESyNET, which couples a DistilBERT encoder with a 16-dimensional rule-derived symbolic vector through cross-attention and gated fusion, trained with an asymmetric false-Halal risk loss. Over five seeds, text-only TF-IDF baselines reach 86.25–86.71 % accuracy with 13.42–21.73 % false-Halal leakage and 6.33–26.00 % counterfactual triad consistency, whereas HALAL-NESyNET reaches 97.04±0.34 % and 99.67±0.50 %. Gradient boosting given the same symbolic vector reaches 96.25±1.24 % (+0.59 points from HALAL-NESyNET, 95 % CI [-1.11, +2.28]), so most of the gain comes from clause-scoped symbolic features and not from the network, and the risk loss did not help. Holding out whole template families, text-only models fall to 61.91–78.35 %, HALAL-NESyNET to 90.87±11.76 % and logistic regression with the symbolic vector to 91.11±2.88 %, with far more spread for HALAL-NESyNET. A three-lane receiving simulation auto-clears 49.33 % of cargo at 0.76 % green-lane contamination. Because labels and features come from one rule engine and 91.3 % of the items are templated, the results measure fidelity to a rule policy, not religious certification.

Index Terms—Halal supply chain, Halal logistics, food additives, neuro-symbolic learning, cross-attention, counterfactual evaluation, warehouse triage.

I. INTRODUCTION

HALAL integrity of a food product is not decided once at the factory: it has to be preserved at every node where goods are stored, consolidated and cleared [1]–[4]. We organise the discussion around three pillars: certification by accredited bodies [5]–[7], traceability of ingredients and batches [8]–[11], and quality assurance, which includes the segregation that prevents cross-contamination between Halal and Haram cargo [12], [13] and whose adoption by service providers has been reported to be low [14]. Warehouse management systems, sensors and ledgers record what is known about a product [10], [15]; they do not decide what an ingredient declaration means.

Checking the declared ingredients against Halal rules is a document-based task, and undeclared ingredients and processing aids are a documented source of doubt [16]. Declarations are semi-structured: in our benchmark the median product has 9 comma- or semicolon-delimited clauses (at most 38), mixing culinary terms, chemical names and E-numbers listed in the Codex general standard for food additives [17]. Some substances are unconditionally prohibited (e.g. pork fat, carmine E120) or permitted, but a large class of emulsifiers, humectants and enzymes can be manufactured from botanical, microbial or animal feedstock [5], [16], [18]; examples are mono- and diglycerides of fatty acids (E471, re-evaluated as a food additive by EFSA [19], [20]), glycerol (E422), gelatine (E441) and L-cysteine (E920). When the declaration does not state an acceptable origin for such an additive, the product is Mushbooh (doubtful) and is held for document verification before intake. The qualifier is scoped: in “bakery shortening (certified plant-based palm oil), emulsifier: E471” the plant-based qualifier belongs to the shortening, not to the emulsifier.

Automated screening of Halal status from packaging has been studied as label recognition with optical character recognition [21]–[23], detection in packaging images [24], classification of ingredient lists [25], [26] and knowledge-graph completion for cosmetics [27]. To our reading of the abstracts, none of these studies evaluates whether a model respects the scope of an origin qualifier, that is, whether moving a qualifier from one clause to another changes the prediction as it should (Section II). A bag-of-words classifier discards clause boundaries by construction; a pre-trained transformer [28], [29] sees word order but is neither told where a clause ends nor what an E-number means. The cost of an error is also asymmetric [30]: a false-Halal decision (a Non-Halal or Mushbooh item predicted Halal) can contaminate a certified storage zone, whereas a false-quarantine decision only delays a shipment.

This paper makes four contributions. (i) A clause-scoped labelling pipeline, a 3,199-item benchmark and a 540-item (180-triplet) counterfactual modifier-swap suite (Section III); labels come from our rule base, not from a certification authority, and 91.3 % of the items are template-generated. (ii)

HALAL-NESyNET, a dual-stream network in which a bank of four queries derived from a 16-dimensional rule-based symbolic vector attends over DistilBERT token states, followed by gated fusion (Section IV). (iii) A five-seed evaluation against strong baselines that receive the same symbolic vector, with seed-paired differences, and a leave-one-template-family-out evaluation on ten held-out generator families (Section V); it shows that the symbolic features, not the neural architecture, carry most of the gain, and that an asymmetric risk loss designed to penalise false-Halal decisions did not help. (iv) A three-lane receiving-dock triage simulation that compares all models, including the ontology-augmented baselines, at a fixed confidence threshold. We make no claim of priority; related work is discussed in Section II. Because the labels and the symbolic features are produced by the same rule engine, high accuracy here measures fidelity to a documented rule policy and not Halal certification; Section VI lists the resulting limits.

References (74)