DEV Community

Cover image for Local AI Is Not a Privacy Switch: Build a Workload Routing Contract
isabelle dubuis
isabelle dubuis

Posted on Originally published at trust-vault.com

Local AI Is Not a Privacy Switch: Build a Workload Routing Contract

Local AI Is Not a Privacy Switch: Build a Workload Routing Contract

Running a language model on a laptop or an internal server can remove one important data transfer: the prompt no longer has to travel to a hosted inference provider. That is useful. It is not the same as making the workflow private, secure, compliant, reliable, or economically sensible.

The document may still arrive through a cloud inbox. The application may write prompts to a verbose log. A retrieval index may contain records the user should not see. A desktop extension may send telemetry. A model file may come from an unverified source. Generated text may be copied into a system that triggers an action without validation. “Local” describes where one computation happens; it does not describe the whole data path.

The source field report on running language models without cloud inference focuses on a real motivation: keeping confidential drafts, client documents, proprietary code, or sensitive records on controlled equipment. This guide develops the decision architecture around that motivation.

The practical answer is a workload routing contract. Before any prompt reaches any model, the contract classifies the data, evaluates the requested action, chooses an approved execution zone, applies controls, and records evidence. Some work goes to a local model. Some goes to an approved private cloud service. Some stays manual. Some is rejected.

This is a more demanding design than a checkbox labeled “use local AI.” It is also far more useful because it connects privacy, security, quality, availability, cost, and human responsibility to the actual unit of work.

Start with the data path, not the model location

A useful threat model follows information from origin to deletion. Draw every component that can read, transform, persist, or transmit the content:

  1. source application or device;
  2. clipboard, upload, connector, or watched folder;
  3. preprocessing and document extraction;
  4. prompt builder and system instructions;
  5. retrieval store and embeddings;
  6. model runtime and model weights;
  7. tool calls and external services;
  8. output validator and human review;
  9. destination application;
  10. logs, caches, backups, crash reports, and monitoring;
  11. retention and deletion mechanisms.

If nine steps are local and one sends raw content to an external error tracker, the workflow is not local in the sense the user probably expects. If inference happens in a private data center but the retrieval layer has weak authorization, model placement does not solve the primary risk.

Create a data-flow inventory for each use case. For every edge, record:

Field Question
Origin Where did this data come from?
Classification What sensitivity and handling rules apply?
Controller Who is accountable for its use?
Processor Which component can read or transform it?
Destination Where does it go next?
Persistence Is it stored, cached, logged, or backed up?
Encryption How is it protected in transit and at rest?
Access Which identity or service may retrieve it?
Retention When and how is it deleted?
Evidence How can a reviewer verify the answer?

Do not fill the table from product marketing. Validate configuration, network behavior, filesystem paths, contracts, and observed logs.

Define four execution zones

A binary local-versus-cloud policy is usually too crude. Use zones with explicit trust assumptions.

Zone 0: prohibited automation

The task remains manual or uses deterministic, approved software. This zone covers workloads where the consequence, data sensitivity, missing authorization, or lack of reliable evaluation makes model use unacceptable.

Examples may include unreviewed final decisions about employment, credit, health, or legal rights; credentials and cryptographic secrets; or records whose use has not been approved. The exact list belongs to your organization's risk owners.

Zone 1: isolated local inference

The model runs on managed equipment with outbound traffic blocked or tightly controlled. Inputs, model artifacts, logs, and outputs remain in an approved boundary. Tools are disabled unless separately approved. This is the strongest local zone, but it requires operational work: patching, access control, model provenance, monitoring, backup policy, and incident response.

Zone 2: managed private inference

The model runs on internal or dedicated infrastructure reachable over a controlled network. Centralization may improve patching, capacity, and observability, but it creates a shared service with authorization and multi-tenant risks. Treat it as a production platform, not a convenient server.

Zone 3: approved hosted inference

The workload goes to a contracted external service under defined data-handling, retention, training-use, region, identity, and logging controls. Hosted does not automatically mean unsafe, and local does not automatically mean safe. The zone is appropriate only when the workload classification and contract match.

The routing decision should select the least restrictive zone that still satisfies the requirements. Forcing every task onto local hardware can reduce quality, availability, or maintainability without creating meaningful additional protection. Sending every low-risk public task through isolated infrastructure can also consume scarce capacity needed for sensitive work.

Classify the workload on more than sensitivity

Data classification is necessary but incomplete. Route on a vector of attributes:

  • sensitivity: public, internal, confidential, restricted;
  • identity: anonymous, pseudonymous, personal, special-category or regulated;
  • rights: permission to process, contractual limits, copyright or license constraints;
  • action: draft, summarize, recommend, decide, execute;
  • reversibility: can the effect be undone cleanly?
  • quality tolerance: what errors are acceptable and detectable?
  • latency: interactive, batch, or delay-tolerant;
  • availability: can work pause during an outage?
  • context size: can the approved model process the required evidence?
  • tool access: does the task need files, databases, shell, email, or transactions?
  • audit need: what must be reproducible later?

A public text-generation task with authority to publish may require more control than a confidential summarization task whose output never leaves a review screen. Action often matters as much as content.

The CISA and UK NCSC announcement of their Guidelines for Secure AI System Development describes security across design, development, deployment, operation, and maintenance, and states that the guidance applies broadly to AI systems, including systems using external APIs. That lifecycle perspective is the right antidote to treating deployment location as the entire security design.

Write the routing contract as policy and code

The contract should be readable by risk owners and executable by the application. Avoid a weighted score that lets a low-risk attribute compensate for a hard prohibition.

Use hard gates first:

  1. Is the use case approved?
  2. Is the user authorized for the source data?
  3. Is model processing allowed for this classification and purpose?
  4. Does the requested action require a human decision?
  5. Are all required components available in an approved zone?
  6. Is the model and dependency provenance accepted?
  7. Can the output be validated before its consequence?

Only then optimize among eligible zones using cost, latency, quality, and availability.

flowchart TD
    A[Work request] --> B{Use case approved?}
    B -- No --> P[Reject or manual path]
    B -- Yes --> C{Classify data and action}
    C --> D{Hard prohibition?}
    D -- Yes --> P
    D -- No --> E{Restricted data?}
    E -- Yes --> F{Isolated local controls pass?}
    F -- Yes --> L[Zone 1 local inference]
    F -- No --> P
    E -- No --> G{Private service required?}
    G -- Yes --> V[Zone 2 managed private]
    G -- No --> H{Hosted contract matches?}
    H -- Yes --> C3[Zone 3 approved hosted]
    H -- No --> V
    L --> Q[Validate output and record evidence]
    V --> Q
    C3 --> Q
    Q --> R{Action permitted?}
    R -- Human review --> U[Review queue]
    R -- Reversible automation --> X[Controlled execution]
    R -- No --> P

The route should fail closed when critical classification or configuration is missing. A fallback from local to hosted inference must never happen silently. If a confidential workload cannot run locally because memory is exhausted, the safe outcome may be delay or manual handling—not automatic transmission elsewhere.

An executable router

The following JavaScript example implements a small policy. It is deliberately explicit, returns reasons, and refuses silent fallback. Save it as route-workload.mjs and run it with a current Node.js version.

const zones = {
  ISOLATED_LOCAL: "zone-1",
  PRIVATE_SERVICE: "zone-2",
  APPROVED_HOSTED: "zone-3",
  MANUAL: "manual",
  REJECT: "reject"
};

function route(request, inventory) {
  const reasons = [];

  if (!request.useCaseApproved) {
    return { zone: zones.REJECT, reasons: ["USE_CASE_NOT_APPROVED"] };
  }
  if (!request.userAuthorized) {
    return { zone: zones.REJECT, reasons: ["SOURCE_ACCESS_NOT_AUTHORIZED"] };
  }
  if (request.containsCredentials) {
    return { zone: zones.MANUAL, reasons: ["CREDENTIALS_PROHIBITED"] };
  }
  if (request.action === "irreversible-decision") {
    return { zone: zones.MANUAL, reasons: ["HUMAN_DECISION_REQUIRED"] };
  }

  const needsIsolation = ["restricted", "special-category"].includes(
    request.classification
  );

  if (needsIsolation) {
    if (!inventory.local?.healthy) reasons.push("LOCAL_RUNTIME_UNHEALTHY");
    if (!inventory.local?.egressBlocked) reasons.push("LOCAL_EGRESS_NOT_BLOCKED");
    if (!inventory.local?.modelApproved) reasons.push("LOCAL_MODEL_NOT_APPROVED");
    if (!inventory.local?.encryptedStorage) reasons.push("LOCAL_STORAGE_NOT_ENCRYPTED");

    return reasons.length
      ? { zone: zones.MANUAL, reasons }
      : { zone: zones.ISOLATED_LOCAL, reasons: ["RESTRICTED_ROUTE"] };
  }

  if (request.classification === "confidential") {
    if (inventory.private?.healthy && inventory.private?.policyVersion) {
      return { zone: zones.PRIVATE_SERVICE, reasons: ["CONFIDENTIAL_ROUTE"] };
    }
    if (inventory.local?.healthy && inventory.local?.modelApproved) {
      return { zone: zones.ISOLATED_LOCAL, reasons: ["PRIVATE_UNAVAILABLE"] };
    }
    return { zone: zones.MANUAL, reasons: ["NO_APPROVED_CONFIDENTIAL_ZONE"] };
  }

  if (inventory.hosted?.approved && inventory.hosted?.retentionDays === 0) {
    return { zone: zones.APPROVED_HOSTED, reasons: ["LOW_RISK_HOSTED_ROUTE"] };
  }

  if (inventory.local?.healthy && inventory.local?.modelApproved) {
    return { zone: zones.ISOLATED_LOCAL, reasons: ["HOSTED_CONTRACT_MISMATCH"] };
  }

  return { zone: zones.MANUAL, reasons: ["NO_ELIGIBLE_ZONE"] };
}

const decision = route(
  {
    useCaseApproved: true,
    userAuthorized: true,
    containsCredentials: false,
    action: "draft",
    classification: "restricted"
  },
  {
    local: {
      healthy: true,
      egressBlocked: true,
      modelApproved: true,
      encryptedStorage: true
    },
    private: { healthy: true, policyVersion: "private-ai-4" },
    hosted: { approved: true, retentionDays: 0 }
  }
);

console.log(decision);
Enter fullscreen mode Exit fullscreen mode

Change egressBlocked to false. The router chooses the manual path; it does not leak into another zone. Change the classification to public and the approved hosted zone becomes eligible. In production, the policy engine should receive trusted classification attributes rather than accepting user assertions at face value.

Store the request identifier, policy version, decision, reasons, chosen runtime, model digest, and output-validation result. Do not log raw restricted prompts merely to prove that routing occurred.

“No cloud” requires network evidence

An application can call itself local while still contacting licensing servers, update services, analytics endpoints, model repositories, fonts, crash reporters, or plugins. Some traffic is benign and necessary; some defeats the stated boundary. You need evidence.

For an isolated zone:

  • enforce outbound network policy at the host or segment;
  • resolve dependencies before moving into isolation;
  • disable or redirect telemetry according to approved configuration;
  • capture attempted egress destinations without logging prompt content;
  • maintain an allowlist with owner, purpose, and expiry;
  • test the policy after updates;
  • verify that the interface does not fetch remote assets at runtime.

Air-gapped is a strong claim. Use it only when the environment actually lacks a path to other networks and transfer procedures are controlled. “We did not configure an API key” is not an air gap.

Network isolation also creates maintenance questions. How will security patches, model updates, vulnerability intelligence, and revocations enter? How will compromised artifacts be removed? A frozen system may protect confidentiality while accumulating known vulnerabilities. The contract needs a controlled update path.

Model files are executable supply-chain inputs

Local deployment increases your responsibility for artifacts. A downloaded model, runtime binary, native library, container image, tokenizer, template, or community adapter can alter behavior or execute code in the surrounding process.

Create an artifact manifest:

Artifact Required evidence
Runtime Publisher, version, signature or trusted digest
Model weights Source repository, license, immutable digest
Quantization Tool and parameters used to create it
Prompt template Reviewed version and owner
Native libraries Locked versions and vulnerability scan
Container Base image, build recipe, software bill of materials
Adapter Training origin, intended task, test results
Retrieval corpus Provenance, authorization, refresh and deletion rules

Do not execute arbitrary model packages in the same security context as sensitive files. Use a dedicated identity, least privilege, read-only mounts where possible, resource limits, and a disposable test environment for new artifacts.

CISA's secure-by-design framing matters here: the user should not bear the full burden of compensating for unsafe defaults. Internally, platform owners should make the approved path the easy path—signed artifacts, known configurations, automatic isolation, and visible failure.

Local retrieval can still violate access boundaries

Retrieval-augmented generation often creates the largest data store in the workflow. Teams copy documents into a shared vector index, then celebrate that inference is local. If the index ignores source permissions, a user may retrieve content they could not open in the original system.

Maintain authorization through ingestion and retrieval:

  1. preserve source identity and access-control metadata;
  2. reject documents without a known owner or classification;
  3. create chunks that retain document and section provenance;
  4. filter candidates by the requesting identity before ranking;
  5. apply deletion and retention changes to chunks and caches;
  6. test access with adversarial cross-department queries;
  7. return citations that a user can open through the original authorization path.

Embedding vectors are not automatically anonymous. They are derived from source content and can expose information through retrieval behavior or associated metadata. Treat them according to the source risk unless a validated transformation justifies another classification.

Output isolation matters as much as input isolation

A locally produced output can cause harm when it crosses into a trusted system. Generated shell commands, markup, database queries, configuration, or tool arguments are untrusted data until validated.

The OWASP Top 10 for Large Language Model Applications highlights risks including prompt injection, sensitive-information disclosure, supply-chain weaknesses, improper output handling, excessive agency, and overreliance. Local inference changes the exposure of some threats; it does not remove the threat classes.

Build a consequence boundary:

  • generated text is displayed, not executed, by default;
  • tool calls use typed schemas and allowlisted operations;
  • paths, commands, URLs, and identifiers are validated independently;
  • high-impact actions require human approval or a deterministic policy;
  • credentials never enter model context;
  • the executing identity has minimal permissions;
  • every action is idempotent or has a rollback plan where feasible;
  • untrusted retrieved content cannot rewrite the system policy.

The most secure local model can still generate a destructive command. Location is not authorization.

Evaluate quality per route

Organizations often compare local and hosted models on a public benchmark and select the fastest acceptable option. That misses the actual workload, the prompt template, retrieval quality, quantization, hardware, and acceptance criteria.

Build a representative, access-controlled evaluation set. Include ordinary cases, edge cases, adversarial inputs, long documents, ambiguous instructions, multilingual content, and cases where the correct action is abstention.

Measure:

  • task acceptance by a blinded reviewer;
  • factual support and citation validity;
  • critical omission rate;
  • refusal and abstention quality;
  • sensitive-data leakage tests;
  • prompt-injection resistance at the application boundary;
  • latency distribution, not only the fastest run;
  • memory consumption and failure under concurrency;
  • energy or infrastructure cost where material;
  • human review and rework time.

Quantization or a smaller context window may change error patterns rather than simply lowering an overall score. Keep results tied to a model digest, runtime, hardware class, and workflow version.

Compare total cost without pretending time is free

Local inference removes per-request vendor charges but introduces equipment, electricity, administration, monitoring, patching, capacity planning, and failure recovery. Hosted inference converts much of that into variable cost and provider dependence.

Use a cost model per accepted unit:

local cost = hardware amortization
           + energy
           + platform labor
           + security and evaluation labor
           + user review and rework
           + downtime impact

hosted cost = inference and platform fees
            + integration labor
            + governance and evaluation labor
            + user review and rework
            + network and outage impact
Enter fullscreen mode Exit fullscreen mode

Do not assume the local machine is free because it was already purchased. If inference consumes memory that displaces other work or requires a new workstation, that is a real resource decision.

PwC's discussion of generative AI adoption in technology, media and telecommunications identifies potential edge-computing advantages including latency reduction, bandwidth optimization, offline operation, and storage efficiency. Those are workload-dependent advantages, not universal guarantees. A centralized system may still win when utilization, specialized accelerators, maintenance, or collaboration dominate.

Design for availability and degraded modes

A local runtime may fail because a laptop sleeps, a GPU runs out of memory, a model is updating, or concurrent requests exceed capacity. Define what happens before failure occurs.

Possible degraded modes include:

  • queue until approved local capacity returns;
  • route to a managed private service if the classification permits;
  • reduce context or use a smaller approved model for a narrower task;
  • switch to deterministic search without generation;
  • require manual completion;
  • reject the request with a clear reason.

Never let the application invent a fallback. The same routing contract should decide normal and degraded execution. Test failures by deliberately removing network, disk, memory, and model availability in a safe environment.

Track service objectives by zone: availability, queue delay, inference latency, acceptance, error severity, and policy-denial rate. A high denial rate may indicate users are attempting unsuitable workloads or that the approved platform does not cover legitimate needs.

Contradictions the architecture must preserve

Local can improve confidentiality and reduce centralized oversight

Data may stay on the device while administrators lose inventory, patching visibility, incident evidence, or deletion control. Managed endpoints and attestation matter.

Centralized private inference can improve governance and increase blast radius

A shared platform supports consistent controls, but a permission error can expose information across teams. Isolation and authorization must be tested.

Smaller models can be safer to host and harder to rely on

Limited capability may reduce some abuse paths, yet increase omissions or unsupported answers. Safety includes task quality, not only network placement.

Offline operation increases resilience to network failure and dependence on the endpoint

Work continues without connectivity, but theft, disk failure, or local compromise becomes more consequential. Encryption, backup, and recovery remain necessary.

More logging improves investigation and can create a sensitive archive

Record decisions and technical evidence, not unrestricted prompt content. Apply minimization and retention to observability.

Open models improve inspectability and do not guarantee trustworthy provenance

Availability of weights or code can support review, but each distributed artifact, conversion, and dependency still needs verification.

Failure modes and controls

Failure mode: local-by-label

The interface says “local,” but a plugin, telemetry client, or document parser sends data externally.

Control: enforce and test outbound network policy; maintain an approved endpoint inventory.

Failure mode: silent cloud fallback

The local model fails and the application retries through a hosted service.

Control: make routing explicit, fail closed for sensitive classes, and log reason codes.

Failure mode: shared index leakage

Users retrieve chunks from documents they cannot access.

Control: preserve source ACLs, filter before retrieval, and test cross-tenant queries.

Failure mode: poisoned artifact

A model, adapter, runtime, or container comes from an unverified source.

Control: use approved registries, immutable digests, manifests, scanning, and staged evaluation.

Failure mode: output execution

Generated commands or tool arguments cross directly into a privileged system.

Control: validate typed output, allowlist operations, minimize permission, and require approval.

Failure mode: prompt logging

Restricted content is protected during inference but copied into logs, histories, or backups.

Control: minimize logs, redact metadata, disable content capture, and verify retention behavior.

Failure mode: unpatched isolation

The offline system stops receiving security fixes and artifact revocations.

Control: establish a signed, controlled update process with rollback and evidence.

Failure mode: workstation sprawl

Every team downloads different runtimes and models without inventory.

Control: provide a managed catalog, endpoint policy, discovery, and removal workflow.

Failure mode: privacy theater

The team selects local inference but has no lawful purpose, minimization, retention, or user authorization.

Control: require the same data-governance review regardless of execution zone.

Prove the boundary with an incident drill

A routing contract is incomplete until the team can demonstrate what happens when one control fails. Run a tabletop exercise with a deliberately expired model approval, a blocked destination, a corrupted artifact digest, and a request containing restricted data. The expected result is not simply that inference stops. Operators should be able to identify the policy decision, the component that enforced it, the affected records, and the safe recovery path without opening raw prompts broadly.

Then test a less obvious scenario: a permitted local request completes, but the result is written to an unauthorized shared folder. This separates inference privacy from lifecycle privacy. Evidence should show the route selected, process identity, model and policy versions, destination decision, retention timer, and any human approval. It should not duplicate the sensitive payload merely to prove that controls ran.

Set measurable recovery criteria before the drill. Examples include revoking a compromised artifact, locating every deployment that used its digest, disabling a route, preserving a minimal audit trail, and restoring a known-good version. Record gaps as engineering work with an owner and deadline. If the team cannot contain, explain, and recover from a simulated failure, the workload is not ready for sensitive production data—even if the model never contacts the internet.

A phased rollout

Phase 1: inventory and classify

List intended tasks, data sources, actions, current tools, and destinations. Identify workloads that must remain prohibited or manual.

Phase 2: build one isolated path

Choose a narrow read-only use case. Create managed hardware, model manifests, egress controls, encrypted storage, minimal logs, and an evaluation set.

Phase 3: run in shadow mode

Process approved copies without influencing real decisions. Test quality, leakage, resource exhaustion, retrieval authorization, updates, and deletion.

Phase 4: allow reviewed outputs

Expose results to trained users with mandatory review. Measure accepted outcomes, rework, incidents, latency, and denials.

Phase 5: add bounded actions

Only after read-only controls hold, permit reversible, typed, least-privilege tool calls. Keep high-impact decisions human-controlled.

Phase 6: operate and recertify

Reevaluate models, dependencies, routes, policies, and recovery after material changes. Remove unused artifacts and stale access.

Validation checklist

Before calling a workflow “local and controlled,” verify:

  • [ ] The entire data path is diagrammed from source through deletion.
  • [ ] The workload has a named owner, purpose, and approved population.
  • [ ] Data and requested action are classified separately.
  • [ ] Hard prohibitions cannot be outweighed by convenience or model quality.
  • [ ] The router fails closed and never falls back silently.
  • [ ] Outbound traffic is enforced and tested, not merely assumed absent.
  • [ ] Runtime, model, adapters, containers, and templates have immutable identities.
  • [ ] The execution identity has minimal filesystem and tool permissions.
  • [ ] Credentials and unnecessary personal data are excluded from context.
  • [ ] Retrieval preserves source authorization and deletion.
  • [ ] Logs, caches, chat history, crash reports, and backups follow retention rules.
  • [ ] Outputs are validated before execution or publication.
  • [ ] Quality is measured on representative and adversarial local workloads.
  • [ ] Latency, concurrency, memory exhaustion, and degraded modes are tested.
  • [ ] Local and hosted costs include administration, review, rework, and downtime.
  • [ ] Updates use a controlled, verifiable process with rollback.
  • [ ] Incident response can identify affected artifacts, users, and records.
  • [ ] Policy, route, model, and evaluator versions are stored with each decision.

The decision rule

Use local inference when the workload benefits materially from keeping processing inside a controlled boundary and your organization can operate that boundary responsibly. Use an approved hosted service when its contract, controls, quality, availability, and cost fit the workload. Use a private shared service when central governance outweighs endpoint autonomy. Keep the task manual when no zone satisfies the contract.

The strongest privacy claim is not “the model runs on my machine.” It is: “for this approved purpose, these data move through these verified components, under these identities and retention rules; no unapproved transmission occurs; the output cannot act beyond its authority; and we can produce evidence.”

Local AI is a useful execution option. The routing contract is what makes it an accountable system.

Top comments (0)