When a language model treats "my aunt is a nurse" differently from "my uncle is a nurse", current tools can tell you that a violation happened. They cannot tell you which documented choice in building the training data produced it: a particular data source, a filtering rule, or a labeling pass. Regulators and auditors increasingly ask exactly that question. Requirement traceability, the engineering practice of keeping checkable links between what a system must do and what was actually built, offers the right shape of answer. Today, though, it stops at documentation. Its links run from legal clauses to form fields, never to the model's observed behavior or back to the data.
This note proposes executable backward traces for fairness requirements. Each fairness requirement is compiled into a behavioral test, a set of paired inputs that differ only in a demographic mention. When the test fails, the failure is attributed through the logged data pipeline to the specific source or filtering stage responsible. The attribution then counts as a valid trace link only if an intervention confirms it: removing or reweighting that stage and retraining must reduce the violation, while a matched random intervention must not. The output is a trace from a statutory or policy clause, through a failing test, to a named and hashed curation decision. Every link in that chain can be checked by running something. The same schema works across classification, sentiment, and question answering.
Core Claim
The forward direction of this chain, linking requirement text to the right tests, is close to solved by structured prompting. Classifier or prompt, which compares a fine-tuned sentence-embedding linker with a structured GPT-4o prompt for mapping software requirements to HIPAA and GDPR provisions, reports that the prompt reaches 84% recall where the fine-tuned linker collapses to 15%. We therefore reuse that technique rather than compete with it.
The open problem is the backward direction, from an observed fairness failure to a curation decision, with a guarantee that the link reflects cause rather than surface similarity. Our claim is that stage-level attribution can recover the responsible pipeline stage far more reliably than keyword search or embedding similarity. Stage-level attribution here means sample influence scores summed over the documented stages of the data pipeline. We also claim that requiring an intervention to confirm each link separates real traces from spurious ones, which purely descriptive documentation cannot do.
How This Differs From the Closest Work
Two systems come closest, and each covers half of the problem.
FG-Trac logs sample-level lifecycle events, scores each sample's contribution with checkpointed influence tracking (TracInCP), and anchors the logs in tamper-evident Merkle trees. It was tested only on CIFAR-10 and fMRI graph models. It has no notion of a requirement or a fairness criterion, and it never checks whether its influence scores identify causes. We reuse its logging and influence machinery as the method. We move it to text pipelines, aggregate it to the level of curation stages, tie it to requirement-derived tests, and validate it by intervention.
TechOps maps EU AI Act clauses to data, model, and application documentation templates kept under version control. Its links, however, end at static text that nothing executes. We keep its data-tier fields as the landing points of backward traces, so a trace ends at a specific documented field such as "source B, deduplication filter v2". It does not end at free prose.
Three further lines of work constrain the design.
On the fairness side, MT-NLP generates the paired-input tests we need. It builds them from knowledge-graph lookups, embedding analogies, and adjective insertion, and it found 2,874 violations across five systems. It treats both model and data as black boxes, which is precisely where our backward trace begins. BiasGuard shows that explicit, written fairness specifications improve detection: it reports 81.00% accuracy on implicit toxicity against 54.25% for GPT-4o. This motivates writing requirements as explicit rules that can be compiled into tests.
On the requirements side, Torre et al. built a 96-entry traceability matrix for GDPR. They found it hard to populate by hand and found that it did not record why choices were made. A trace that ends at a hashed curation decision supplies part of that rationale automatically.
On the data side, Fell et al. showed that unrecorded preprocessing choices alone can drop reimplemented accuracy from 92% to 54.7%. This is the strongest evidence that data-stage decisions, not architecture, often carry the effect we want to trace.
Research Program
The system has three layers.
Forward layer. This layer takes a corpus of fairness requirements and links each to a test generator using a RICE-style structured prompt (role, instruction, context, examples). The corpus is drawn from non-discrimination language in the AI Act and GDPR, organizational policy statements, and BiasGuard-style specifications. Each test generator is parameterized by a demographic dimension and a perturbation operator in the style of MT-NLP. The output is a set of paired inputs $(x, x')$ for each requirement.
Logging layer. This layer is FG-Trac-style instrumentation adapted to text. Every training example carries a hashed record of its source, each filter or relabeling stage it passed, and its split assignment. These stage identifiers are exactly the fields in a TechOps data documentation entry.
Backward layer. For a trained model $f$, define the violation gap of a test pair as $g(x,x') = |f(x) - f(x')|$. For a training example $z$ with loss $\ell$, saved checkpoints $\theta_t$, and learning rates $\eta_t$, we compute a TracInCP influence of $z$ on the gaps of failing pairs. We then aggregate over a documented pipeline stage $S$:
$$A(S) = \frac{1}{|S|} \sum_{z \in S} \sum_{(x,x') \in F} \sum_t \eta_t \, \nabla_\theta \ell(z;\theta_t) \cdot \nabla_\theta g(x,x';\theta_t)$$
Here $F$ is the set of failing pairs. The score measures how much training on stage $S$ pushed the model toward the observed gap, averaged per example so that large sources are not favored by size alone. Because FG-Trac reports 2.5x to 2.9x training slowdowns from gradient caching on complex networks, we restrict gradients to the final transformer layers and classifier head, and we measure the cost.
A candidate link from requirement to failing test to stage $S$ is accepted only if an intervention passes. Removing $S$, or the top-attributed examples within it, and retraining must reduce the violation rate by a preset margin more than removing an equal number of random examples.
Task coverage. To test whether one trace schema serves different NLP tasks without per-task redesign, we instantiate the pipeline on three task types:
- implicit toxicity classification trained on ToxiGen;
- sentiment classification on the IMDB perturbation setting from MT-NLP;
- multiple-choice question answering evaluated on BBQ's ambiguous contexts.
This mirrors the domain-agnostic abstraction argument of the Annotation Librarian. The same stage identifiers, test interface, and attribution score are reused, and only the test generators differ.
Baselines
Naive reference: record but do not trace. The pipeline is documented with TechOps-style templates and violations are reported by MT-NLP. An auditor then guesses the responsible stage from the documentation alone. We simulate this with an LLM that reads the datasheet and the failing tests and names a stage. This is today's best practice, and its stage-identification accuracy sets the floor.
Keyword provenance search. For each candidate stage, count training examples that mention the demographic term in the failing tests, weighted by label skew. This is the obvious data-scientist heuristic. It is strong whenever the planted bias is lexical, which makes it a serious competitor for the toxicity task. On ToxiGen, however, 98.2% of statements contain no slurs, so the identity term alone carries less signal than it appears to.
Embedding nearest-neighbor attribution. Training examples are ranked by sentence-embedding similarity to the failing test inputs, and the scores are aggregated per stage. This is the strongest cheap competitor to influence-based attribution, because it needs no gradients.
Unaggregated FG-Trac. This is sample-level TracInCP without stage aggregation or intervention validation. It is the strongest existing method for sample-level tracing, but FG-Trac reports no attribution accuracy at all, only predictive parity (0.764 against 0.762 on CIFAR-10) and overhead. There is no reported result on Lacuna for influence-based fairness attribution in NLP.
Forward linking. The baseline is RICE_LRT as published. It reports 84% recall and 61% F2 on GDPR in Classifier or prompt, while the Kashif classifier reaches F2 of roughly 63% on HIPAA but only 15% recall on GDPR. We match their F2 metric on our fairness-requirement corpus. We do not claim to beat RICE, only to reach comparable recall, since it is a component of our system.
Mitigation baseline. The reference is MT-NLP's Neutral Layer, reported to fix over 98% of violations at $\epsilon = 0.1$, together with counterfactual augmentation. Both are compared against stage-targeted removal at matched retraining or inference budget.
Fairness and ablations. All attribution methods see the same trained checkpoints, the same failing pairs, and the same stage logs. They receive equal hyperparameter-tuning budgets on a held-out planted configuration. The ablations remove one ingredient at a time: stage aggregation, intervention validation, and gradients restricted to the final layers versus the full model. "Beating" a baseline means higher top-1 stage identification on planted configurations, with non-overlapping bootstrap intervals, and a larger confirmed violation reduction per removed example.
Why not just…?
Why not just keep good datasheets? Documentation records what was done but cannot say which choice caused a given behavior. Fell et al. show that even careful write-ups omit the decisive preprocessing steps. The datasheet-reading baseline tests this directly. If an LLM reading the datasheet identifies the planted stage as often as attribution does, the backward layer adds nothing, and we will report that outcome.
Why not just grep the training data for identity terms? For overtly lexical planted biases, this may genuinely match our method, and we expect it to on the simplest toxicity configuration. It should fail on two kinds of planted bias. The first is a filter that removes anti-stereotypical examples: the missing data leaves no keyword trace. The second is a biased relabeling pass, where identity terms are distributed evenly across stages and only the labels differ. These configurations are designed to settle the question.
Why not just use embedding similarity instead of gradients? This is the main threat. Similarity finds examples that look like the failing tests, not examples that moved the model, so it should miss label-only contamination. If it matches influence across all three tasks, we would drop the gradient machinery and its cost, and keep stage aggregation and intervention validation as the contribution.
Why not just fix the bias with the Neutral Layer or counterfactual augmentation? For reducing violations, these may well equal or beat stage removal. MT-NLP reports over 98% of violations fixed, although every query then needs $k$ forward passes. Our claim is about accountability, meaning naming the curation decision, not about mitigation strength. We report both. If targeted removal is no better than augmentation at equal cost, we will say the value lies in the audit trail alone.
Proposed Experiments
Planted-bias testbed. For each task, we assemble training sets from four to six documented sources and filter stages. Exactly one stage is contaminated, using one of three mechanisms: lexical correlation between a group mention and the negative label, removal of anti-stereotypical examples, or biased relabeling. Contamination strength varies over a grid. We fine-tune BERT- and RoBERTa-sized classifiers with three seeds each. The first decisive check is top-1 and top-2 identification of the contaminated stage across mechanisms. The core claim requires attribution to beat both the keyword and embedding baselines on the removal and relabeling mechanisms.
Intervention check. For every accepted trace link, we retrain without the attributed stage and without a size-matched random subset. We measure the change in violation rate on held-out test pairs and the change in task accuracy. Valid links should yield large confirmed reductions with small accuracy loss. A high rate of links that fail confirmation in unplanted settings would show that influence scores are not trustworthy as trace evidence.
Natural setting. We apply the pipeline, with no planted contamination, to the original ToxiGen and BBQ-relevant training data split into real sources. Here there is no ground truth. We therefore report how many failing requirements receive intervention-confirmed traces, and to which stages. On BBQ, the baseline signal is the 77% of incorrect ambiguous-context answers that UnifiedQA directed toward the biased option.
Forward linking and cost. We measure forward-link recall and F2 on the requirement corpus against the published RICE_LRT figures. Training-time overhead and ledger storage are compared against FG-Trac's reported 2.5x to 2.9x slowdown and roughly 1.2 GB per 100-epoch ledger.
Falsification condition. The proposal fails if, across tasks, stage-aggregated influence does not beat embedding similarity on the non-lexical contamination mechanisms, or if confirmed links are no more common than for random stages.
References
- Classifier or prompt: A case study on legal requirements traceability
- Fine-Grained Traceability for Transparent ML Pipelines
- TechOps: Technical Documentation Templates for the AI Act
- Metamorphic Testing and Certified Mitigation of Fairness Violations in NLP Models
- BiasGuard: A Reasoning-Enhanced Bias Detection Tool for Large Language Models
- Modeling data protection and privacy: application and experience with GDPR
- Reproducibility of deep learning in digital pathology whole slide image analysis
- ToxiGen: A Large-Scale Machine-Generated Dataset for Adversarial and Implicit Hate Speech Detection
- BBQ: A hand-built bias benchmark for question answering
- An Interface for Rapid Natural Language Processing Development in UIMA