Some neural classifiers now end in a hard logic layer. This layer takes the network's raw label scores and rewrites them so that the final output always satisfies a set of rules, such as "a golden retriever is a dog" or "if not indoor then not furniture." To handle rules that contain negation without circular reasoning, these layers use stratified negation. The rules are sorted into ordered layers (strata), and a negated fact may only be used once it has been fully settled in a lower layer. This guarantees one well-defined answer. It also means that a change to a low-stratum label is pushed deterministically upward through every rule that depends on it.
This note asks what that determinism does under a backdoor attack. In such an attack, the model behaves normally on ordinary inputs but switches to attacker-chosen outputs whenever a hidden trigger pattern is present. Our claim is that the stratification is not a fixed implementation detail. It is a security-relevant design choice. The same rule set can usually be compiled into several different stratified programs. Under an attacker who can corrupt only one label, those programs differ in how many final labels flip. A defender can therefore choose the stratification that limits how far a planted backdoor can spread, and the size of the logic layer's correction supplies a second, free detection signal.
Core Claim and Threat Model
The system we study is CCN(h) from Multi-Label Classification Neural Networks with Hard Logical Constraints (also here; Multi-Label Classification Neural Networks with Hard Logical Constraints). It places a constraint layer, computed with GPU matrix operations, on top of a backbone $h$. It handles negated rule bodies by stratifying them and trains with a Max Constraint Loss that sends supervision through the rule hierarchy. That paper evaluates only on clean data, across 20 hierarchical and 16 logically constrained multi-label datasets. Its own limitations are the starting point here: when a lower stratum is wrong, higher strata inherit the error with no soft recovery.
The threat model is single-source label poisoning. Multi-label datasets are often annotated per label by different pipelines, such as different curators, weak labelers or ontologies. We assume the attacker controls one such source, labeled $a$. The attacker adds a trigger to a small fraction of training inputs and sets $a$ to a target value on those inputs. The attacker cannot edit the other labels.
This is a real restriction. The attacker's poisoned examples are generally incoherent with the rules. So the attack's final effect depends on two things: whether the Max Constraint Loss learns to push the trigger's influence into the other labels, and whether, at test time, the layer amplifies a single flipped atom (one true-or-false label variable) into many flipped outputs.
We define the reach of atom $a$ under a stratified program $P$ as
$$R_P(a) = \mathbb{E}_{x}\big[\,\#\{b \neq a : \mathrm{CL}_P(h(x))_b \neq \mathrm{CL}_P(h(x)[a \mapsto \neg a])_b\}\,\big],$$
where $\mathrm{CL}_P$ is the constraint layer compiled from $P$, $h(x)$ is the backbone's thresholded raw prediction on input $x$, and $h(x)[a \mapsto \neg a]$ is that prediction with only $a$ flipped. Reach counts how many other final labels change when one raw label flips.
The central hypothesis is that $R_P(a)$ varies substantially across the valid stratifications of the same rule set. Picking $P$ to minimize the worst-case reach over the atoms an attacker plausibly controls should cut the attack's collateral damage, the number of extra labels it flips beyond the target. It should do so without changing clean accuracy, because all valid programs agree on inputs whose raw predictions already satisfy the rules.
The idea draws on the logic literature, which treats stratum order as a priority policy. Compiling Circumscriptive Theories into Logic Programs shows that assigning strata is a choice of which defaults override which, and that choice is exactly what the defender gets to make here.
Research Program
The first component is a compiler that, given the constraint sets of the CCN benchmarks, enumerates or samples the valid stratified programs. Different programs arise from choosing which literal in each rule acts as the head, and from how ties between strata are broken. For each program, the compiler computes $R_P(a)$ exactly on held-out data.
The second component is a reach-minimizing selection procedure. Exhaustive search is used where the candidate set is small. Where it is large, a greedy procedure places atoms that are low-trust or poisoning-prone in high strata, so that they depend on others rather than feed them. A secondary objective measures how far clean-data behavior moves; we expect it to move by zero, and we check this.
The third component is an attack study. It crosses the attacker-controlled atom's position (low stratum versus high stratum), the trigger type (a patch trigger on image datasets, and on text datasets a token trigger in the style of Rethinking Stealthiness of Backdoor Attack against NLP Models), and the training loss (the Max Constraint Loss versus plain binary cross-entropy).
The fourth component is a detector based on correction magnitude: how many labels the constraint layer had to change relative to the backbone's raw output. We test it against a naive attacker. We also test it against an adaptive attacker who knows the rules and adds a regularizer that makes the backbone's triggered raw output coherent. This forces the attacker to spread the trigger into many backbone outputs, which should in turn make it easier for spare-capacity defenses to find, per Fine-Pruning.
Two adjacent works set boundaries. Learning with Logical Constraints but without Shortcut Satisfaction shows that constrained training drifts toward satisfying "P implies Q" by simply making P false. We test whether a trigger can deliberately induce that collapse, for example by suppressing a premise atom. We also test whether the collapse interacts with reach, since a suppressed premise has zero reach. That paper supplies a soft-constraint comparison but no attack analysis. BackdoorAgent documents how corruption spreads from one stage of an agent's workflow to the next. We study the same propagation question in a setting where propagation is exactly computable, which that empirical agent study cannot offer.
Baselines
The naive reference is the backbone alone, with no constraint layer, poisoned identically. It sets the attack success rate and collateral damage without any logic, and it tells us whether hard constraints make backdoors worse or better at all.
The strongest existing system is CCN(h) with the stratification its authors' procedure produces by default. It is the natural competitor because it is the model deployers would actually use. It achieved top performance on 17 of 20 hierarchical benchmarks according to Multi-Label Classification Neural Networks with Hard Logical Constraints. The file gives no per-dataset numbers, and no reported result was found on Lacuna for any backdoor attack on these benchmarks, so we establish that baseline ourselves.
The key ablation isolates our ingredient. It uses the same backbone, the same Max Constraint Loss, the same poisoned data and the same seeds, and varies only the stratification: default, random valid, and reach-minimized. Beating the default means a statistically clear reduction in collateral damage on triggered inputs across the attacker-controlled atoms, with clean-data scores unchanged within seed variance.
A soft-constraint baseline uses the dual-variable method of Learning with Logical Constraints but without Shortcut Satisfaction in place of the hard layer. That paper reports 98.8% accuracy against 89% for DL2 on its semi-supervised MNIST setup and outperforms baselines on CIFAR-100 superclass constraints. We run it on the CIFAR-100 superclass task with the same architectures and the same tuning budget.
For detection, the baseline is STRIP from STRIP, which reports 0% false acceptance and 0% false rejection in most CIFAR10 and GTSRB cases and about 1.32 times the inference latency. We apply it to the backbone. Fine-Pruning is applied as the weight-level defense. Each detector must beat STRIP's area under the ROC curve (the standard curve of true- versus false-positive rate) on our multi-label triggered inputs to count as an improvement.
Why not just…?
Why not just drop the hard layer and use soft constraint losses? Soft losses leave the backbone free to output any label combination, so a single poisoned label never mechanically cascades. That could look safer. But soft losses give up guaranteed coherence and are prone to shortcut satisfaction, which an attacker may be able to trigger on purpose. This is a genuine threat to the proposal's premise. The soft-constraint baseline measures it directly: if soft losses match reach-minimized CCN on collateral damage and attack success at equal clean accuracy, the practical case for choosing a stratification weakens, and we would report that.
Why not just run STRIP or Fine-Pruning on the backbone and ignore the logic? These methods were built for single-label, input-agnostic triggers. STRIP's low-entropy signature assumes one dominant output, which is unclear when only one of many labels is targeted. In our setting they are complementary, not competing: reach minimization limits damage even when detection fails. Our experiments stack the two and report whether each helps on its own.
Why not just flag any input whose raw predictions violate the rules? This is exactly the correction-magnitude detector. It is cheap and probably strong against naive attackers, so it is a core baseline, not something the proposal needs to beat. Its weakness is the adaptive attacker who makes triggered raw outputs coherent. Against that attacker, detection by rule violation fails by construction. Whether reach minimization still helps then depends on whether coherence forces the trigger into more backbone neurons, which the Fine-Pruning experiments test.
Proposed Experiments
We use the 20 hierarchical and 16 logically constrained multi-label datasets from the CCN paper, the CIFAR-100 superclass task with VGG16, ResNet50 and DenseNet100, and a CIFAR10 or GTSRB subset for comparability with STRIP. Poisoning rates are swept from very low upward.
The metrics are attack success on the target atom, collateral damage (mean labels flipped on triggered inputs), the benchmark's own clean metric, the rate of constraint violations in raw outputs, and detection ROC area.
The decisive checks are as follows. The first asks whether reach varies across valid stratifications by enough to matter. If the spread is negligible on real rule sets, the proposal fails early. The second asks whether reach measured on clean data predicts collateral damage under attack. The third asks whether reach minimization keeps clean predictions identical, as theory predicts. The fourth asks whether the adaptive coherent attacker is pushed into a regime where Fine-Pruning or STRIP recovers the trigger.
References
- Multi-Label Classification Neural Networks with Hard Logical Constraints
- Compiling Circumscriptive Theories into Logic Programs: Preliminary Report
- BackdoorAgent: A Unified Framework for Backdoor Attacks on LLM-based Agents
- Fine-Pruning: Defending Against Backdooring Attacks on Deep Neural Networks
- Learning with Logical Constraints but without Shortcut Satisfaction
- STRIP: a defence against trojan attacks on deep neural networks