Part XIII: Trust, Safety, Evaluation, and Operations
Chapter 70: Responsible Sensory AI and Regulation

Documentation and accountability

"When the incident review asked why I flagged that pump as healthy, I could produce the exact model version, the sixty seconds of vibration I saw, and the confidence I reported. What nobody had written down was who decided my ninety percent was good enough to skip an inspection."

A Thoroughly Logged AI Agent

Prerequisites

This section assumes you can version and track a deployed model across a fleet, the operational machinery of Chapter 69, and that you can report an evaluation faithfully on a leakage-safe split, from Chapter 65. It builds on the data-provenance discipline of Chapter 5 and on calibrated confidence from Chapter 18. Dataset-level artifacts (datasheets and dataset cards) are covered in Section 70.5, and the legal instruments that mandate some of this paperwork in Section 70.6; here we focus on the documentation of the system and the chain of human answerability behind it.

The Big Picture

Documentation is not the tax you pay after building a system; it is the mechanism that makes a system accountable, meaning that when it makes a consequential decision, someone can reconstruct why it did so and someone can be answered to for it. These are two distinct properties. Traceability is technical: given an output, can you recover the exact model, inputs, configuration, and evaluation that produced it? Accountability is organizational: is there a named human who owns the decision to deploy this system at this threshold in this context? A sensor AI can be perfectly reproducible and still unaccountable, because nobody wrote down who authorized shipping it. This section gives you the three artifacts that close the gap: the model or system card that declares what the system is and is not for, the audit trail that lets you replay any decision, and the post-incident record that turns a failure into a corrective loop. Get these right and a regulator's request, a lawsuit's discovery, or a 3 a.m. incident all become a query against artifacts you already keep.

The accountability chain: from an output back to a person

Every consequential decision a sensor system makes should trace back along an unbroken chain to a human who is answerable for it. Break the chain at any link and accountability evaporates. Consider a wearable that decides not to raise a fall alert. To be accountable, that non-decision must connect to the model version that made it, the model to the training data and evaluation that qualified it, the evaluation to a documented operating envelope (the conditions under which the numbers hold), the envelope to a deployment threshold, and the threshold to a named owner who signed off that this threshold was acceptable for this population. Documentation is simply the material that makes each link inspectable. The failure mode you are guarding against is not usually a missing model; it is a missing reason. "The model said so" is not a reason a court, a hospital safety board, or a grieving family will accept, and it is not one you should accept from your own system either.

The important consequence is that documentation must be produced at the moment of the decision, not reconstructed afterward. Reconstruction is where accountability quietly dies: the model was retrained last week, the config drifted, the raw signal was already discarded for privacy, and the person who set the threshold left the company. An accountable pipeline captures the who, what, and why as immutable records synchronized to the decision itself, so that six months later the answer exists whether or not anyone remembers the incident.

Key Insight

Reproducibility and accountability are orthogonal. A model can be bit-for-bit reproducible (you can rerun it and get the same output) yet completely unaccountable (no one owns the choice to deploy it at that threshold on that population). Conversely, a system can have clear human ownership yet be untraceable because it logs nothing about its inputs. Responsible documentation requires both axes: technical traceability that answers "what happened," and an organizational record that answers "who is answerable." Most compliance failures in deployed sensor AI are not modeling failures; they are a broken link between a logged output and a named human decision.

Model cards and system cards for sensor AI

A model card is a short, structured document that states what a model is for, how well it works, and where it must not be used. The concept comes from Mitchell and colleagues, and the sensor setting adds fields that a generic vision or language card omits. A sensor model card must declare its modality and hardware assumptions (a fall-detector trained on a wrist IMU at \(50\,\text{Hz}\) is undefined on a hip-worn unit at \(25\,\text{Hz}\)), its operating envelope (sampling rate, orientation, mounting, temperature, motion regime), its subgroup performance across bodies and environments as required by Section 70.3, its calibration and confidence semantics so a downstream consumer knows what a reported \(0.9\) means, and its explicit out-of-scope uses. A system card zooms out one level to document how models, thresholds, human oversight, and fallback behavior compose into the deployed product; it is the artifact a functional-safety review (Chapter 68) reads first.

The discipline that makes cards worth the effort is that the numbers on them are co-computed in one pass on one evaluation configuration and cite the leakage-safe split they came from. A card that reports overall accuracy from one run and per-subgroup accuracy from a different, more favorable run is worse than no card: it launders an invalid comparison behind an official-looking template. Treat the card as a signed claim, not a marketing surface.

Audit trails: replaying any decision

An audit trail is the append-only record that lets you reconstruct a specific past decision. For sensor AI the minimum unit is a decision record that binds five things: a timestamp, a hash of the model version and configuration, a hash or reference to the input window (not necessarily the raw signal, which privacy may forbid you to keep), the output and its calibrated confidence, and the identity of the policy or human that acted on it. Hashing rather than storing raw sensor data is what lets the trail coexist with the data-minimization duty of Section 70.1: you can prove which input was seen without retaining a re-identifiable biometric trace. The code below constructs such a record and shows why the hash matters: change the model or the window by one byte and the recomputed digest no longer matches, so tampering and silent version drift both become detectable.

import hashlib, json, time
from dataclasses import dataclass, asdict

def digest(obj) -> str:
    """Stable content hash of any JSON-serializable object."""
    blob = json.dumps(obj, sort_keys=True, separators=(",", ":")).encode()
    return hashlib.sha256(blob).hexdigest()[:16]

@dataclass(frozen=True)
class DecisionRecord:
    ts: float
    model_id: str            # e.g. "fall-detect-v3.2"
    model_hash: str          # digest of weights + config
    input_hash: str          # digest of the input window (raw signal not stored)
    output: str
    confidence: float
    acted_by: str            # policy id or human sign-off owner

def log_decision(model_id, model_cfg, window, output, confidence, acted_by):
    rec = DecisionRecord(
        ts=time.time(),
        model_id=model_id,
        model_hash=digest(model_cfg),
        input_hash=digest(window),      # window = list of sensor samples
        output=output,
        confidence=round(confidence, 4),
        acted_by=acted_by,
    )
    return asdict(rec)

rec = log_decision("fall-detect-v3.2", {"arch": "tcn", "fs": 50, "thr": 0.62},
                   window=[0.98, 1.01, 0.15, 2.4], output="no_alert",
                   confidence=0.91, acted_by="policy:auto-suppress-below-0.62")
print(rec)
A minimal, privacy-compatible decision record. Hashing the model config and the input window (rather than storing raw signal) makes version drift and tampering detectable while retaining nothing re-identifiable. Appended to an immutable log, these records are what let you replay the "why" of any past output.

Library Shortcut

Do not hand-author model cards as free-form prose that rots the moment the model is retrained. Tooling such as Hugging Face's huggingface_hub model-card API or Google's Model Card Toolkit generates a schema-validated card from your evaluation results and metadata, rendering it to HTML or JSON from roughly ten lines of Python. What would be a fifty-plus-line hand-maintained template with hand-copied metrics (and the copy errors that follow) becomes a call that pulls the numbers straight from the evaluation artifact, so the card cannot silently disagree with the run that produced it. The library handles schema, versioning, and rendering; you supply the co-computed metrics.

Incident records and the corrective loop

Accountability is proven not when nothing goes wrong but when something does. A post-incident record documents a failure and closes a loop: what the system did, what it should have done, which link in the chain broke, and what change prevents a recurrence. The value is in making failures legible and cumulative rather than embarrassing and forgotten. A disciplined incident record names a root cause at the level where the fix lives (a mislabeled training segment, a threshold set for a population the deployment did not match, an uncalibrated confidence), not a scapegoat, and it links to the corrective action and the model version that carries the fix. Over a fleet, these records become the institutional memory that keeps the same failure from shipping twice.

Step-Through: a predictive-maintenance miss and the record that redeemed it

An industrial condition-monitoring system (the machinery of Chapter 36) reports a gearbox as healthy; three days later it seizes and halts a production line. The plant demands answers. Because every inference wrote a decision record, the team replays the exact window the model scored and confirms the reading itself was clean: the fault signature was a sideband the training set never contained. The model card's operating envelope, it turns out, declared coverage only for the two gearbox families in the training data; this was a third, retrofitted unit outside the documented envelope. The audit trail shows an operator had suppressed the "out-of-envelope" warning to reduce alert noise, and the sign-off record names who approved that suppression policy. No single villain: a documented envelope, an inspectable trail, and a named policy owner together locate the break precisely. The post-incident record ties the fix (extend the envelope, block auto-suppression outside it) to model version v4.1, and the same class of unit is covered fleet-wide within the week. The documentation did not prevent the miss; it made the miss survivable and non-repeating, which is the realistic goal.

Keeping documentation alive

The predictable way all of this fails is drift: the card describes v2 while the fleet runs v4, the audit schema stops matching the pipeline, and the incident log fills with prose nobody queries. Static documents written once and filed are worse than useless because they radiate false confidence. The fix is to treat documentation as a build artifact, regenerated in the same CI job that trains and evaluates the model, versioned in the same repository, and gated so a deploy is blocked if the card's metrics were not co-computed on the current evaluation run. In regulated settings such as medical devices, this living dossier is close to what Chapter 34 calls the technical file; in the ordinary case it is simply the difference between documentation you can trust and paperwork you cannot. When the artifact is generated from the run, it cannot lie about the run, and that single property is what turns documentation from a liability into the backbone of an accountable system.

Exercise

Take the DecisionRecord above and extend it into an append-only log. Write a verify(log, model_registry) function that walks the log and flags any record whose model_hash is not present in the registry of approved model versions, and any record whose confidence falls below the threshold declared in that model's card yet was still auto-acted-upon. What class of accountability failure does the second check catch, and why can it not be found by looking at the model in isolation?

Self-Check

  1. A model is bit-for-bit reproducible and every inference is logged, yet the deployment is still described as "unaccountable." What is missing, and which artifact supplies it?
  2. Why does an audit trail hash the input window instead of storing the raw sensor signal, and which earlier duty does that choice satisfy?
  3. A model card reports overall accuracy from one evaluation run and per-subgroup accuracy from a different run. Explain why this is worse than shipping no card at all.

Lab 70

produce a responsible-use, privacy, and compliance checklist for a wearable, industrial, or smart-building system.

Bibliography

Documentation frameworks

Mitchell, M., Wu, S., Zaldivar, A., et al. (2019). Model Cards for Model Reporting. ACM FAT*.

The foundational model-card proposal: structured reporting of intended use, performance across conditions, and out-of-scope uses. The template every sensor model card specializes.

Gebru, T., Morgenstern, J., Vecchione, B., et al. (2021). Datasheets for Datasets. Communications of the ACM.

The dataset-provenance counterpart to model cards; explains why documenting the data behind a system is inseparable from documenting the system itself.

Crisan, A., Drouhard, M., Vig, J., Rajani, N. (2022). Interactive Model Cards: A Human-Centered Approach to Model Documentation. ACM FAccT.

Studies how practitioners actually read and misread cards, motivating generated, interactive documentation over static prose that drifts from the model.

Accountability and governance

Raji, I. D., Smart, A., White, R. N., et al. (2020). Closing the AI Accountability Gap: Defining an End-to-End Framework for Internal Algorithmic Auditing. ACM FAT*.

A practical internal-audit framework spanning scoping, artifact collection, and post-audit action; the organizational scaffolding behind the accountability chain in this section.

Bender, E. M., Friedman, B. (2018). Data Statements for Natural Language Processing. TACL.

Argues that structured provenance statements are a precondition for accountability and bias analysis; the reasoning transfers directly to sensor-stream documentation.

NIST (2023). Artificial Intelligence Risk Management Framework (AI RMF 1.0).

The Map-Measure-Manage-Govern framework whose Govern function is essentially the documentation-and-accountability discipline treated here; widely referenced by deployers.

Tooling and standards

Google (2020). Model Card Toolkit.

Open-source library that generates schema-validated model cards from evaluation metadata, the concrete shortcut behind this section's library callout.

ISO/IEC (2023). ISO/IEC 42001: Information technology, Artificial intelligence, Management system.

The first AI management-system standard; its documentation, traceability, and continual-improvement clauses formalize the living-dossier practice recommended here.

What's Next

In Chapter 71, we leave the cross-cutting principles behind and assemble everything into domain playbooks, where the documentation, privacy, and accountability duties of this chapter become concrete checklists for wearables, robotics, vehicles, smart spaces, environmental monitoring, and security, each with its own regulator, failure modes, and evidence a deployer must be ready to produce.