AI System for an Air-Gapped Environment
Run and maintain useful document AI inside a restricted enclave, with controlled artifacts, local identity and tested recovery.
- Kind
- Case study
- Level
- Advanced
- View
- Interview prep
- Sections
- 4
- By
- Sourav Banerjee
- Last updated
- 20 Nov 2026
Practise this as a worksheet: AI System for an Air-Gapped Environment
Interview view. The case brief, design walkthrough, technical deep dives and quick review, condensed into bullets, tables and lines to say out loud, with interactive diagrams to step through.
Want to go deep? The full casebook has the complete reasoning in prose, the original diagrams, practice questions with worked answers and the sources.
Case brief
The case in one line: run useful AI inside a network with no route out, and leave the customer's own people able to keep it running.
30-Second Cheat Sheet
- The setting: an enclave, a restricted network with no route to the internet.
- The work: analysts get documents classified, fields extracted or passages redacted, from documents that can never leave.
- The hard constraint: nothing crosses the enclave's network, artifact, identity or audit boundaries at runtime.
- The core idea: build outside, prove the bundle offline, then deploy inside. Nothing at runtime reaches out.
- Two flows: a document request (synchronous, all local) and a release (slow, asynchronous, run by operators).
- Where the case is won or lost: the release. A bundle missing one transitive dependency must fail closed.
- The fixed facts: 1,000 users, 20 QPS peak, 50 million pages, a GPU pool that cannot grow.
Outcome line (learn it word for word): "maintainable AI that runs locally and never crosses the enclave's network, artifact, identity or audit boundaries."
1. Run useful AI inside a network with no way out
What the customer wants
- They run an enclave: a restricted network with no route to the internet.
- They want AI inside it, and they want their own people to keep it running after the build team leaves.
- Analysts need answers from documents that can never leave the enclave:
- classify a packet of documents;
- extract specific fields;
- redact sensitive passages.
- Every model, index and software package arrives through an approved transfer. Nothing inside can download anything.
The hard constraint is the boundary
- Nothing crosses the enclave's network, artifact, identity or audit boundaries at runtime.
- The system can't fetch a model, pull a package or reach a telemetry endpoint when it needs one.
- An ordinary cloud app behind a firewall fails this test the first time:
- its installer fetches a package;
- its model calls an external endpoint;
- its crash reporter phones home.
- The source states the goal as one outcome line, and every later decision is tested against it.
The key terms
| Term | Meaning |
|---|---|
| Enclave | A restricted network with no route to the internet |
| Air gap | The physical or logical separation that keeps the enclave offline |
| Bundle | A signed release package: models, services, dependencies and a manifest |
| Manifest | A list of every artifact in the bundle and its hash |
| Pinned dependencies | Exact, locked versions |
| Transitive dependency | A package needed by another package, not named directly |
| Attested | Given a signed record of how it was built |
| Trust roots | The locally held keys that decide which signers are trusted |
| Canary node | One node that takes the new release first |
| Fail closed | Refuse the action and keep the current state when a check can't pass |
| OCR | Optical character recognition: turns scanned pages into text |
The core idea in one flow
connected build world → signed release bundle → transfer staging zone → offline checks (intact? complete? compatible?)
Pass → offline registry → local model and retrieval in the enclave.
Fail → stop, and keep the evidence.
A bundle that passes enters the offline registry and becomes deployable.
A bundle that fails stops where it is, and its evidence is kept for investigation.
There is no third path where the system reaches outside to fix the problem.
2. Follow one document and one release
Two flows run through the system, and the design treats them very differently.
The document request (synchronous, all inside)
- An analyst inside the enclave submits a packet of documents.
- The local identity provider confirms who the analyst is.
- The document pipeline:
- runs OCR;
- parses and chunks the text;
- retrieves context;
- calls the local model server;
- scores the output;
- applies redaction.
- The analyst receives a typed result tagged with the model version that produced it.
- The local telemetry stack records an audit event.
- Every step happens inside the enclave, synchronously, with no external dependency.
The release (asynchronous, run by operators)
- A new model or patch is built on the connected side from pinned dependencies.
- It is scanned, attested, signed and exported as a bundle with a manifest.
- The bundle waits in a quarantined staging zone.
- It is verified offline against the enclave's own trust roots.
- It is imported to the local registry.
- It is tried on a canary node.
- It is promoted or rolled back.
- This flow is slow, asynchronous and run by operators. Users never wait on it.
The failure that decides the case
- The signed bundle arrives.
- One transitive dependency never made it into the offline mirror.
- With no network, a retry can't conjure a file nobody copied in.
- Correct behaviour: fail closed.
- Refuse to promote.
- Keep the evidence.
- Leave the running release untouched.
Soundbite: "The release flow is where this case is won or lost. A retry can't create a file nobody copied in, so a missing dependency fails closed."
3. What you need to design
The task
- You are the FDE (Forward Deployed Engineer): you work with the customer, find the real problem and ship a working system in their environment.
- Bring generative AI into this air-gapped environment and make the boundary the centre of the design.
Five groups care about the outcome
| Group | What they need |
|---|---|
| Security officer | Proof the boundary holds and every change can be audited |
| Operations | A system it can repair on site at 2 a.m. without calling the vendor |
| Analysts | Trustworthy results faster than manual work |
| Program sponsor | A gain they can measure from inside the enclave |
| External build team | A clean handoff |
The four fixed facts
| Fact | Value |
|---|---|
| Users | 1,000 |
| Peak load | 20 queries per second (QPS) |
| Corpus | 50 million pages |
| GPU pool | Fixed: it cannot grow |
- Every other figure in the source (memory per replica, tokens per request, throughput, rollout weeks, thresholds) is an illustrative assumption by the source author, not a measurement.
- This prototype guarantees no model, hardware performance, accreditation or commercial platform.
Who it's for
- Engineers preparing for forward deployed, solutions or applied-AI interviews set in regulated, defence or on-premises settings.
What it assumes you know
- Retrieval-augmented generation (RAG).
- Serving a model on your own GPUs.
- Basic release engineering: artifact registries, signing and rollback.
How the sections divide the work
- Design walkthrough: the interview answer, in order.
- Technical deep dives: the records, the verifier code and the trade-offs.
- Practice (in the full casebook): the source worksheet, drills and model answers as exercises with worked answers behind reveals.
- Quick review: the card for the night before.
Quick Recall: Lines to Say in the Interview
- "Build outside, prove the bundle offline, then deploy inside. Nothing at runtime reaches out."
- "Nothing crosses the network, artifact, identity or audit boundaries at runtime."
- "A cloud app behind a firewall fails the first time its installer fetches a package."
- "Document requests are synchronous and local; releases are asynchronous and run by operators."
- "A missing transitive dependency fails closed: refuse to promote, keep the evidence, leave the running release alone."
- "Four fixed facts: 1,000 users, 20 QPS peak, 50 million pages, a GPU pool that can't grow. Everything else is illustrative."
- "Maintainable AI that runs locally and never crosses the enclave's boundaries."
Design walkthrough
The goal: a local AI service the customer can run and patch themselves, where every release proves itself offline before it touches the running system.
30-Second Cheat Sheet
- The boundary is the design: requirements, architecture, data model, security and delivery all start from it.
- Defend one assumption first: no internet at runtime. Relaxing it later simplifies the design; assuming the reverse breaks it.
- Size against a fixed pool: the toy formula gives 477 replicas. Challenge the request mix, never ask for hardware.
- Two worlds: a connected build side and an offline runtime, joined only by signing and the transfer staging zone.
- One system of record for deployable artifacts: the offline registry. No runtime falls back to an older cached copy.
- First production gate: no bundle enters until it has proved, offline, that it is intact, complete and compatible.
- Every failure gets a policy: fail closed, degrade, queue or human. None of the source's examples fails open.
- Delivery is design: four phases with owners and exit gates, six health metrics, a three-row dashboard and explicit rollback triggers.
Outcome line to open and close with: "Maintainable AI that runs locally and never crosses the enclave's network, artifact, identity or audit boundaries."
1. Discover the boundary and who operates it
Start from the tension
- The enclave has no route out, yet the customer wants AI inside it, maintained by their own people.
- Restate the outcome line before drawing anything and hold every later choice to it.
- The boundary is the design. It isn't a constraint you bolt onto an ordinary AI system afterwards.
- The source advises learning the outcome line word for word and ending each later summary with it. Interviewers notice when every section points back to one goal.
Stakeholder map: fill in both columns before drawing a box
| Stakeholder | What they want | What worries them |
|---|---|---|
| Security/compliance officer | Proof the boundary holds and every update can be audited | A stopgap that quietly becomes permanent |
| Operations/IT admin | A system the local team can support without calling the vendor | An outage at 2 a.m. that no one on-site can fix |
| End users (analysts) | Quick, correct answers about their own documents | A tool slower than doing the work by hand, or harder to trust |
| Program sponsor | Measurable value, delivered when promised | Accreditation review stalling the program |
| External vendor/build team | A clear, clean handoff | Taking the blame for problems that appear once releases cross the boundary |
Six discovery buckets (don't fire questions at random)
| Bucket | What it finds out |
|---|---|
| Workflow | The real job the user needs done |
| Risk | The cost of an answer that is wrong, slow or compromised |
| Boundary | Precisely what sits inside the enclave and what stays outside |
| Update process | The lawful, safe route by which new capability gets in |
| Identity and audit | Who may act, and how you prove it afterwards |
| Operations | Who keeps the system up day to day |
Discovery ends with four answers
six buckets → scope + risks + owners + success → outcome statement
- Scope: which capabilities ship in the first release, and which are deliberately left out?
- Risks: which assumption is most dangerous, and who is responsible for reducing it?
- Owners: which team answers for build, for transfer and for operate?
- Success: how will the customer check, on their own terms, that it works?
Pick a success metric the customer checks from inside
- Analyst turnaround time per case works: the customer sees it locally.
- A vendor-reported figure is weaker: believing it means trusting an outside system, which is what the enclave exists to avoid.
Before drawing, confirm which boundary carries the most risk
- What does the air gap protect?
- Is isolation total, or are there governed transfer points for media, packages and logs?
- Is this one secure enclave, several disconnected sites, or a staged network split into separate trust zones?
- Should analysts share one central service, or do especially sensitive teams need isolated workstations?
- The answers change packaging, rollout and how many copies of the system you operate.
2. Turn restrictions into deployable requirements
The six questions that shape the architecture most
| # | Question | What the answer changes |
|---|---|---|
| 1 | How is the data classified, and which handling rules follow? | Whether you may store document text, keep prompts, cache intermediate results or write audit records with sensitive content |
| 2 | What compute hardware sits inside? | One of three shapes: a single smaller model, a bigger model with batching, or retrieval paired with a light model |
| 3 | How good must answers be, and how long can a person wait? | The product's role: a tool that assists a person, a batch analyst, or a near-interactive copilot |
| 4 | What path does an artifact follow to be imported, approved, scanned, signed and rolled in? | How fast the customer can patch a vulnerability or refresh the model |
| 5 | Which identity system runs locally, and which storage and directory services can you depend on? | Whether you plug into local SSO, file shares, object storage or directory-backed authorisation |
| 6 | What limits apply to logging, retention, backup and disaster recovery? | Whether you can see failures without exposing classified data, and survive a lost node or site within policy |
SSO = single sign-on: one company login for every app, and the source of the user's identity for permission checks.
The question tree (settle the hardest unknowns first)
| Yes/no question | Yes → | No → |
|---|---|---|
| Classified data? | Define which fields may be stored, logged, cached or exported | Still define retention and audit |
| GPUs? | Consider a larger model, batching, or separate embedding and inference services | Prefer smaller models, retrieval-first or asynchronous work |
| Interactive responses? | Prioritise low-latency serving and preprocessing | Batch analysis may be easier to govern |
| Automatic artifact import? | Enforce signatures, scanning and approval gates | Design a manual ceremony with provenance records, not an informal copy |
| Existing local identity and storage? | Integrate with them | The MVP may need a minimal internal service: a high-risk scope expansion, not a routine task |
- Settling the hardest unknowns first tells the interviewer you're protecting delivery.
- Once about half the questions have answers, stop chasing a complete picture. State assumptions and turn them into three lists.
Functional requirements (the MVP's six must-haves)
- Core workflow: an analyst uploads a document inside the enclave and gets a classification, extraction or redaction, with nothing at runtime touching the internet.
- Package the model and services for offline use, so the whole runtime deploys with no internet connection.
- Sign and version every artifact, so each model, container and dependency traces back to an approved release.
- Run a local registry and dependency mirror, so installs and redeploys never reach beyond the enclave.
- Integrate with local identity, so access follows the customer's approved accounts and groups.
- Provide observability, backups and restore that work offline, so operations need no outside telemetry.
- Run an update and rollback ceremony with an audit trail, so each promotion can be reviewed and undone.
MVP = minimum viable product, the smallest version real users actually use.
- The list is short on purpose: the least the system needs to be operationally credible on a controlled network.
- Could-haves: richer analytics dashboards, a choice of models, automatic canary releases, replication across sites. In an air gap they pull attention from the core problem.
Nonfunctional requirements (four, name them out loud)
- Nothing depends on the internet at runtime.
- Installs from approved artifacts are reproducible.
- Every code file, model file and packaged dependency has provenance you can check.
- It stays supportable when patches and model refreshes arrive only rarely.
Constraints versus preferences
- Constraint = a wall the design must stay inside: all compute on-premises, logs kept only locally, updates only through a manual approval path.
- Preference = softer, such as favouring one storage engine over another.
- Keep them apart out loud. Otherwise the team optimises for convenience and breaks a boundary by accident, for example by sending logs to a convenient monitoring service.
What the MVP won't support (naming exclusions builds trust)
- Calls to a live model on the internet.
- Unmanaged package installs, or fetching dependencies on the fly.
- Agents that update themselves and skip the approved import process.
- Any promise of unlimited model size or of running arbitrary plugins.
- Any assumption that logs can go to a cloud observability stack.
- Backup as a vague promise. Every backup runs through a storage and restore path the customer has already approved.
Requirement-to-component traceability (a requirement with no component is a wish)
| Requirement | Component or mechanism |
|---|---|
| Offline model and service packaging | A build pipeline that emits one deployable bundle: model, service and runtime assets |
| Signed versioned artifacts | Signing step, artifact registry, release manifest, a record of each promotion |
| Local registry and dependency mirror | On-premises container registry, plus package mirrors per language |
| Local identity integration | A bridge to the directory or SSO, with role mapping and authorisation checks |
| Offline observability and backups | Local logs and metrics store, backup jobs, checks that restores work |
| Auditable update and rollback ceremony | A change-approval workflow, a release ledger and a rollback runbook |
| No runtime internet dependency | Network policy that denies egress, plus a dependency allowlist |
| Reproducible installs | Every version pinned, every manifest locked, build inputs that never vary |
| Verifiable supply chain | Provenance records, signatures, scan results, evidence of approval |
| Supportable under long update intervals | Cautious dependency choices, compatibility checks, written restore paths |
If you defend only one assumption, defend the network boundary
- The system works completely with no internet access at runtime.
- It shapes packaging, dependency management, model deployment, observability and rollback.
- The asymmetry:
- If the customer relaxes it later, the design only gets simpler.
- If you assume the reverse and are wrong, the whole architecture falls apart.
- When an interviewer says "assume whatever you need", pin this one down first.
Why this step is a strong FDE signal (source's framing)
- It shows three habits at once: care for the customer, engineering judgement and delivery.
- In practice: find the constraints that matter, prioritise while facts are missing, keep it shippable, and guard the riskiest constraint rather than tune for the easiest feature.
- In the interview: ask the six questions → turn them into the six must-haves → name the four nonfunctional requirements → finish with what the MVP leaves out.
3. Size against a GPU pool that cannot grow
Where candidates slip
- They picture an on-premises document service, guess a few dozen active users and settle on one model replica behind a queue.
- That holds on an average day. Then the customer names a deadline (their busiest day, or a date the backlog must be gone) and the plan falls over.
- An enclave gives little or no room to scale out later, so the capacity plan must be right before anything ships.
Start from the four facts
- 1,000 users, 20 QPS (queries per second) at peak, 50 million pages, a fixed GPU pool.
- They choose between three architectures:
- batch processing;
- online interactive extraction;
- a split: indexing runs asynchronously under a smaller interactive layer.
- They also decide what failure looks like: a slow response, or a missed mission deadline.
Keep four load figures apart
| Figure | What it answers |
|---|---|
| Average load | Ordinary daily behaviour |
| Peak load | Protects you when bursts pile up in the queue |
| Growth | Whether the design lasts through a year of adoption |
| Headroom | Stops you running at the edge of collapse when a large document lands |
Storage is never just the model
- Model weights and runtime packages: one primary release plus two rollback versions.
- Vector or search indexes covering 50 million pages, with metadata and sharding overhead.
- Logs, audit trails and operational metrics for as long as local policy requires.
- Short-lived staging space for signed updates, validation artifacts and canary packages.
- Real sizes depend on the model, chunking, embedding dimension, retention and compression. Avoid false precision.
- Keep the rollback copies even though they cost space. Reverting can be slow or held up by approvals, so without a prepared fallback on disk a bad release may stay live a long time.
Memory and throughput per replica: you need both
- Memory must fit model weights, the KV cache, framework overhead and batch buffers.
- Throughput is usually tokens per second for one replica at a chosen model, quantisation and batch size.
- A GPU count without throughput misses the bottleneck. A memory figure without throughput misses the placement constraint.
KV cache = the attention keys and values stored for every token already processed (prompt and output), so each new token doesn't recompute them. It grows with context length and with the number of sequences in flight.
Illustrative memory estimate (the source author's, not a measurement):
| Item | Size |
|---|---|
| Weights after quantisation | 12 GB |
| Runtime and framework overhead | 2 GB |
| KV cache plus transient activations at target context | 6 GB |
| Batch buffers with fragmentation slack | 2 GB |
| Total per replica | ~22 GB |
- A 24 GB card leaves too thin a margin for a noisy batch or a longer-than-planned context.
- Options: step up to a 32 GB GPU, choose a smaller model, cap context harder or quantise further.
- Use it to decide whether today's hardware class can carry the workload at all. It's not a promise.
The replica formula
Replicas = ⌈ (QPS × Tokens_request) / (TokensPerSecond_replica × UtilizationTarget) ⌉
| Term | Meaning |
|---|---|
QPS |
The arrival rate |
Tokens_request |
Mean token work in one request |
TokensPerSecond_replica |
What one replica sustains |
UtilizationTarget |
Share of peak capacity you'll spend before latency degrades too far |
- The numerator turns request rate into token demand.
- The denominator turns one replica into the capacity it really offers once headroom is set aside.
Worked example
- Case supplies: 1,000 users driving a 20 QPS peak.
- Source author assumes: 2,000 tokens per request (RAG prompt plus output), 120 tokens/s per replica at the chosen batch shape, 70% target utilisation.
Replicas = ⌈ (20 × 2,000) / (120 × 0.70) ⌉ = ⌈ 40,000 / 84 ⌉ = 477
- The result is meant to feel wrong. A fixed pool will never hold 477 replicas, so the assumptions are probably wrong for an air gap.
- Don't defend 477 and don't ask for more hardware. Question the request profile:
- Not all 20 QPS may be LLM inference; much could be retrieval or metadata lookups.
- Chunking, caching or form-based extraction might shrink the model work per request.
- The workflow may really be batch-first: a queue with a nightly SLA fits better.
- The source notes interviewers often pick numbers that produce an absurd replica count on purpose, to see whether you cling to it or question the request mix.
SLA = service level agreement: the promise to the customer, usually looser than the internal target. SLO = service level objective: the internal target, such as "95% of answers in under 3 seconds".
When replicas exceed the pool: the six levers (the full list)
compute replicas → fit the fixed pool? Yes → proceed with the current profile. No → pull a lever:
- Reduce token work per request.
- Use a smaller or more aggressively quantised model.
- Batch harder.
- Relax the SLO.
- Move work into offline preprocessing.
- Agree to a smaller interactive feature set.
- Never a hardware request.
Sensitivity, not one heroic number
| Scenario | QPS | Avg tokens/request | Effective token demand | Replica implication | Design pressure |
|---|---|---|---|---|---|
| Baseline illustrative | 20 | 2,000 | 40,000 tokens/sec, before headroom | Toy formula gives 477: this mix can't fit the fixed pool | Batch or offline processing, less work per request, or a far smaller model fraction |
| 10x growth | 200 | 2,000 | 400,000 tokens/sec, before headroom | About 4,760 on the same toy assumptions | The same architecture breaks badly: partition the workload, precompute, or serve it another way |
- Exactly, 400,000 / 84 = 4,761.9, which rounds up to 4,762.
- Read the direction more than the figure. You can't fix ten times the load by buying more of the same: GPU pool, storage and the operational process can't stretch on demand.
Growth doesn't hit every component first
| Growth in | Strains first |
|---|---|
| More users | Identity, audit and queueing, before raw inference |
| More pages | The index: rebuild time or storage bandwidth |
| Longer documents | Token count and context length |
| Stricter SLOs | Headroom, so the fixed pool runs short |
State the uncertainty plainly (as the source does)
- The numbers are illustrative.
- Build the first deployment around the 20 QPS peak plus a growth factor and some rollback margin.
- If the real mix leans to batch, the interactive pool shrinks. If requests are longer, add replicas or narrow what each request may ask.
- Per-request token demand is the lever most likely to steer component choice:
- Light requests: one general-purpose inference tier with retrieval may do.
- Heavy requests: three layers: cheap preprocessing up front, a retrieval and rules layer in the middle, a small set of expensive inference workers.
- Inside an enclave each added replica uses scarce offline capacity, and each added dependency makes updates and audits heavier.
Benchmark prefill and decode separately
- Prefill (reading the input) processes all prompt tokens in parallel and is usually compute-bound.
- Decode (generating output) emits one token per step per sequence and is usually memory-bandwidth-bound.
- So a GPU reads prompt tokens far faster than it writes output tokens.
- If most of the assumed 2,000 tokens are retrieved context, one blended tokens-per-second figure overstates the replica count. Measure both phases on the chosen model and put the measured split into the formula.
SLIs tied to the workflow
SLI = service level indicator: the actual measurement behind an SLO.
| SLI | What it measures |
|---|---|
| Availability | Share of working hours in which the system accepts jobs and returns results |
| Latency | Time to the first useful result for a document, and separately the time for a whole batch |
| Freshness | Time from approved content arriving until it can be searched or used by the model |
| Quality | Extraction accuracy, retrieval relevance, or the rate analysts accept output |
| Security | Whether the network, identity, signing and audit boundaries hold |
| Cost | GPU-hours, storage footprint, support load, what a rollback costs |
- Fit objectives to the workflow:
- Analysts review interactively → the interactive latency budget matters most.
- Ingestion runs nightly → freshness and completion time outrank per-request latency.
- Break the end-to-end latency target into parts: upload → preprocessing → retrieval → inference → validation → rendering.
- When inference eats most of the budget: a smaller model, a shorter context or retrieval done ahead of time.
4. Separate connected builds from offline execution
Walk one request through twice
- Once when everything works, once when something critical is missing.
- Hidden constraint: software, models and metadata reach the offline side through a single controlled update path and no other way.
- So the design splits into two worlds: a connected side where things are built, an offline side where they run.
The nine components, in dependency order
| # | Component | Job |
|---|---|---|
| 1 | Connected build environment | Gathers source code, pinned dependencies and model artifacts before export |
| 2 | Artifact signing service | Signs whatever crosses and issues attestations anyone can check |
| 3 | Transfer staging zone | Holds each bundle in quarantine for inspection until the offline side admits it |
| 4 | Offline registry and package mirror | The one trusted local store for every approved model package, image and library |
| 5 | Local orchestrator | Runs canary rollouts, applies deployment policy, decides where services run |
| 6 | Model server | Hosts the local model or inference runtime the pipeline calls |
| 7 | Document pipeline | Ingest, OCR and parsing, chunk, retrieve, score, redact, build the result |
| 8 | Local identity provider | Confirms who each user and service is without leaving the boundary |
| 9 | Local telemetry stack | Collects audit events, logs, metrics and traces, and exports none of it |
Trust boundaries
- The main boundary separates the build environment (the only connected part) from everything else.
- Inside the enclave too: orchestrator vs workloads, identity vs services, document pipeline vs telemetry store.
- Cutting the network link doesn't remove untrusted code. It moves the threat model from internet exposure to admission control, least privilege and a strong audit trail.
Each box earns its place
- Build environment: inputs that can be rebuilt identically.
- Signing service: evidence of exactly what crossed.
- Transfer zone: unvetted material never lands directly on the offline side.
- Registry and mirror: deterministic deployments.
- Orchestrator: a managed runtime.
- Model server and pipeline: do the work.
- Identity and telemetry: every access authenticated, every operation auditable.
System of record, cache or queue
- The source calls this the distinction that separates a strong answer from an architecture that only looks good. For each component, say which bucket its data is in and what breaks when it goes stale.
| Bucket | What lives there |
|---|---|
| System of record | Approved packages and images (offline registry); user and service identities (identity provider); each deployment and when (audit log) |
| Cache | Model weights in memory, retrieval indexes, frequent document fragments, any response cache. Derived and replaceable. |
| Queue | Document ingestion jobs; scan, attest and export tasks; background enrichment and post-processing |
| External dependency | End-user traffic has none. The only outside input is the controlled build pipeline that produces the bundle. |
- Common error: a cache behaving as the source of truth. Air gaps make it worse: nothing online refreshes the cache, so stale entries linger unnoticed.
- If the registry marks an image approved, the runtime must not quietly fall back to an older cached copy.
- If a service credential is revoked in the identity provider, the control plane revokes it everywhere, consistently.
The happy path as state changes
- Build from pinned dependencies: code, system packages and model versions pinned to known revisions.
- Scan, attest, sign and export: policy check, provenance attestation, signature, packaging.
- Inspect in the transfer zone: integrity, policy conformance and chain of custody before anything moves inward.
- Verify signatures offline: an authorised signer produced it and nothing altered it on the way.
- Import to the local registry: the runtime can now pull approved files, images and libraries locally.
- Deploy a canary: a small share of serving and pipeline capacity against harmless test data.
- Run acceptance tests: authentication, ingestion, latency, output quality, logging and rollback readiness.
- Promote or roll back: a passing canary gets more traffic; a failing one is reverted and its bundle quarantined for review.
- Steps 1 to 4 are administrative and asynchronous. Deployment, request handling and user-facing inference are synchronous.
- Say it plainly: document requests need a synchronous answer from the offline runtime; updates and the supply chain run in the background, so a user never waits on them.
The synchronous request path (no external call)
user → document pipeline → local identity provider (authenticate user and service) → model server (inference or extraction) → local telemetry (audit events, metrics) → response to user
The fail-closed drill (the second pass)
- A bundle arrives, but the offline mirror lacks one transitive package.
- The system fails closed and never improvises by reaching across the boundary.
- Any unresolved dependency blocks promotion. The bundle stays quarantined until the dependency is repaired and approved again.
Narrate the overlay out loud:
- The bundle arrives.
- The mirror lacks one transitive package.
- Promotion stalls in the orchestrator, which leaves the canary isolated.
- The telemetry stack logs the failed rollout.
- The registry holds the bundle in quarantine.
- An operator repairs the package on the connected build side and retries the controlled transfer.
Backpressure at four layers
- Without it, a burst of uploads can melt an offline service with no spare capacity to scale into.
| Layer | Control |
|---|---|
| Ingestion | Cap concurrent uploads, check size and type early, queue oversized jobs |
| Pipeline | Shard each document's work on a fixed key (case ID, tenant or document ID) so state lands in one place and retries are deterministic |
| Model server | Limit concurrency, cap batch size, reject or defer once GPU or CPU saturation passes a safe threshold |
| Orchestrator | Rollout limits, so the canary sees a small share of traffic until acceptance passes |
- The partitioning key matters most when a document's context, redaction choices and audit trail must agree. With document ID as the key, retries and partial failures are easier to reason about, and one document's state can't corrupt another's.
Component responsibility and state ownership
| Component | Primary responsibility | State ownership | Notes |
|---|---|---|---|
| Connected build environment | Pin, package and compile for offline use | Source tree and build metadata | Outside the runtime trust boundary |
| Artifact signing service | Attest and sign artifacts | Signing keys and provenance records | Tight control over who can use the keys |
| Transfer staging zone | Examine each bundle before admission | Quarantine manifests | Never serves runtime traffic |
| Offline registry / package mirror | Hand out approved packages and images | Catalogue of approved artifacts | Authoritative record of what may deploy |
| Local orchestrator | Deploy, scale and roll back | Desired state and rollout state | Applies policy on site |
| Model server | Run inference | Model runtime state, cached weights | Keep its API small and stable |
| Document pipeline | Ingest, analyse, redact, assemble outputs | Document processing state | Usually the main request path |
| Local identity provider | Confirm users and services | Identities, groups, tokens | Authoritative record for access |
| Local telemetry stack | Store audit events, logs, metrics, traces | Observability data | Retain as long as policy requires |
MVP versus later
- MVP: one each of offline registry, orchestrator, identity provider, telemetry stack, model server and document pipeline, plus a clear canary process.
- Signing, verification and the transfer zone ship in the first release: offline updates can't be defended without them.
- Later: smarter scheduling, routing across several models, better retrieval, background reindexing, richer policy engines.
- Make the offline path dependable and auditable first, then tune throughput and operator convenience.
Control plane versus data plane
- Control plane: signing, verification, deployment, identity and policy.
- Data plane: inference and live document requests.
- Be explicit about which workflows are sync, which async, and which system owns each durable state transition.
- One architecture, two audiences:
- Customer hears: "The system stays inside our boundary, and we can still take controlled updates."
- Engineering hears: "State has a known home, failures have a known edge, and promotion holds no surprises."
Spoken answer (source's 90-second summary): "I'd keep the connected build side apart from the offline runtime, with signing and staging as the only bridge. Inside the enclave sit a local registry, an orchestrator, a model server, a document pipeline, an identity provider and a telemetry stack. Requests are synchronous. Updates are asynchronous and tightly controlled. Deployable artifacts have one system of record: the offline registry. Local telemetry and the identity provider hold the audit trail. My biggest trade-off is security versus how hard updates become. The first production gate is simple: no bundle enters the enclave until it has proved, offline, that it is intact, complete and compatible. After that, a canary proves signature provenance, complete dependencies, working authentication and a rollback path before wider promotion."
5. Admit only complete, verified, compatible releases
The riskiest component
- Release verification carries more risk than anything else. If the system can't check a bundle offline, the rest is theatre.
First production gate (repeat it word for word in every section): "No bundle enters the enclave until it has proved, offline, that it is intact, complete and compatible."
| Word | Means |
|---|---|
| Intact | Every artifact hash matches the signed manifest |
| Complete | Every declared dependency is present |
| Compatible | The bundle fits the target node class and the stored index |
Admission = the happy path with explicit gates
- Verification runs before import.
- Canary and acceptance tests run before promotion.
- Acceptance covers identity, document handling, output quality, latency, local logging and tested recovery.
- A failure at any gate leaves the active release untouched.
The missing transitive package, again
- "Just retry" is the wrong reflex. A retry can't create a dependency that was never transferred.
- Fetching it from the internet "just this once" breaks the boundary the whole system exists to protect.
- Correct response:
- Keep the bundle quarantined.
- Preserve its dependency graph, manifest version, bundle hash and signer.
- Leave the active release running.
- Repair the connected build and prove dependency closure (every transitive dependency is present).
- Repeat the controlled transfer.
- Why
dependenciessits in the manifest, not in someone's head: a manifest naming a dependency the offline store lacks fails validation before installation, not at runtime.
Duplicate requests test idempotency
Idempotency = repeating a call has the same effect as making it once.
- Validate sent twice (first response timed out): with a matching idempotency key and bundle hash, the second call returns the same validation outcome and doesn't move state forward again.
- Promote resent after a transient fault: the server returns the state already reached, or rejects with a clear, stable error that this version is no longer waiting for promotion.
- Record and API details are in the release records deep dive.
6. Treat the release path as a high-trust control plane
Open like a security and operations reviewer
- Start with the incident that hurts most, not with the model.
- A good answer to the missing-package incident halts promotion, keeps the manifest and evidence intact and shrinks the damage to the smallest slice of the system.
Threat-model the offline control plane
- Inference is only one thing you defend. The chain: signing keys, model artifacts, index files, package repositories, privileged admin actions and update workflows. Any link can be attacked.
- Pin and attest every dependency.
- Nothing crosses without it.
- The manifest lists each exact version and hash; the installer checks signatures against offline trust roots.
- Anything outside the known-good set is refused at deployment.
- Avoid telemetry egress assumptions.
- Connected products switch on cloud diagnostics, remote metrics and crash reporting by habit. In the enclave that's wrong.
- Every observability path is local-first and approved on purpose: metrics go to an internal collector; support bundles leave only through a controlled operator workflow.
- A library that silently calls home is a leak.
- The source flags this as where candidates slip: interviewers wait to hear "we'll send logs to our SaaS dashboard", said out of habit.
- Treat privileged administration as a high-risk interface.
- Admin commands live apart from the everyday user flow and need local role-based approval.
- Key rotation, index rebuilds, trust-root updates and rollback promotion each run as a deliberate, explicit, audited operation.
Sort every failure into one of five policies
fail open · fail closed · degrade · queue · hand to a human
| Source example | Policy |
|---|---|
| Authentication and signature checks | Fail closed |
| Downstream classifier down | Ingestion can queue, only inside a bounded local buffer |
| Search on a stale index | Degrade, as long as users see a freshness warning |
| Memory runs short | Serving degrades to a smaller approved model, verified in advance |
| Promoting a bundle or updating a trust root | Needs a human to approve |
- None of the source's examples fails open. This sorting separates a system that is down from one that is dangerous.
Five-condition decision table
| Condition | Policy | User-visible behaviour | Recovery path |
|---|---|---|---|
| Missing transitive package | Fail closed | Promotion blocked; current release keeps running | Put the mirrored artifact back, repeat verification |
| Artifact corrupted in transfer | Fail closed | Bundle refused before installation | Copy again from the release origin; check hash and signature |
| Model exceeds GPU memory | Degrade or queue | A smaller approved model answers, or the request waits | Rework routing, or revise the packaging policy |
| Local certificate expires | Admin actions fail closed; read-only flows degrade where policy permits | Admin operations stop; some reads carry on | Rotate the cert from the offline trust anchor |
| Update breaks stored-index compatibility | Queue or rollback | Promotion pauses; old index stays live | Rebuild the index offline, or roll back model and index together |
Blast radius
- Spell it out per workflow, per tenant, per dependency and per region.
- On an air-gapped government network, a "region" is usually a physical enclave or site, not a cloud geography.
- One bad index rebuild must not knock out search across the whole enclave where tenants or workspaces can be isolated.
- A failed model rollout must leave the audit service valid.
- If policy lets reads continue, a certificate fault in the admin plane must not stop read-only lookup.
- Give every dependency its own containment boundary.
The critical incident drill (mandatory in the source)
- Setup: the bundle has a valid signature, yet the installer can't pull one transitive dependency from the local mirror.
- However tempting, don't install "just this once".
Detection: the installer can't resolve a transitive dependency from the local mirror.
Containment (five steps, first):
- Halt promotion before it writes any partial state.
- Capture the failing dependency graph with the exact bundle hash and manifest version.
- Save signer metadata, logs and the artifact as evidence.
- Check the release in service hasn't been touched.
- Tell the operator the mirrored set is incomplete, which isn't a runtime defect.
Recovery: rebuild the offline mirror from the source of truth → prove dependency closure is whole → verify hashes and signatures again.
Prevention: run a dependency-closure preflight before the bundle ever reaches the enclave. A release process that can't prove completeness must never hand the bundle to the installer.
Other failure paths
- Artifact corruption during transfer.
- Check hashes and signatures at every hop, not only where it was built.
- A bundle that verifies at origin but fails at the boundary is hostile or damaged until shown otherwise.
- Set it aside for investigation; don't overwrite it.
- Model exceeds GPU memory.
- A capacity and packaging problem that should never surprise you at runtime.
- Route to a smaller approved model, hold until a compatible worker frees up, or reject with a clear operational error.
- Never let the node crash hoping the scheduler sorts it out.
- Spot memory pressure before admission, and keep an explicit compatibility map: model size × quantisation format × hardware profile.
- Local certificate expiring.
- First an availability and admin problem; a security problem the moment the system skips checks to stay up.
- Short-lived operational certificates, watch expiry, renew locally from an offline trust anchor, keep an escalation path for overdue rotation.
- Privileged actions halt; read-only workflows may continue degraded if policy allows.
- The enclave needs a trusted local time source: certificate validity, signature timestamps and revocation lists are judged against the clock. A drifting clock can reject a valid release or accept an expired certificate.
- Revocation lists arrive through the same controlled transfer path as any artifact, so plan their cadence alongside releases.
- Update breaks stored-index compatibility.
- Version the index format with the model and the reader code; the three ship as one unit.
- Ship only when the new reader can read the old index or rebuild it deterministically. If not, pause promotion and keep the old path serving.
- A human steps in if nobody is sure what the compatibility matrix says, or a rebuild would take longer than the recovery objective allows.
Evidence and runbooks
- Runbooks before go-live for: node replacement, index rebuild, rollback, certificate renewal, trust-root rotation, verification failure.
- Each names who may run it, which evidence it keeps, which systems it pauses and how success is judged.
- The audit trail captures:
- the operator's identity and approval record;
- the signed manifest with its hash list;
- the trust-root fingerprint;
- installation logs;
- any rollback decision.
- When a customer asks why a release was blocked, that evidence alone should reconstruct the answer. Without it, every incident is forensic guesswork.
Why it matters for the job (source's close)
- A strong FDE shows the design survives stale state, partial failure, dependency outages, hostile input, retries that change nothing and political pressure to "just make it work".
Spoken answer (source's version): "The offline release pipeline is a high-trust control plane, and I guard it that way. Every dependency is pinned and attested. Signatures are checked against offline trust roots. Telemetry never assumes it can leave the network. Privileged admin is kept apart from normal use. The riskiest failure is a bundle that is incomplete or corrupted. So the system fails closed, keeps the evidence and leaves the running release alone. Runtime problems each get a clear policy: some queue, some degrade to an approved fallback, some need a human. My first production gate: no bundle enters the enclave until it has proved, offline, that it is intact, complete and compatible."
7. Turn the prototype into an operating path
A demo is only the start
- The real milestone: the customer seriously asking when they can rely on it in production.
- Inside an air gap, delivery is part of the design. If the team must improvise to move, verify, install, watch or roll back, they have an encouraging demo they can't deploy.
- The FDE's job: an operating path safe enough for the enclave, dull enough for operators, valuable enough for users.
- Wrong answer to the production question: "after we tune the model some more".
Four rollout phases (each with an owner, an exit gate and a reason)
| Phase | Owner | Exit gate | Why |
|---|---|---|---|
| 1. Staging on identical hardware | Infrastructure or platform engineering; security review by the enclave team | Trust roots, OS image, GPU/CPU profile, storage layout and node class match production | Convenience staging hides package incompatibility, driver mismatch, disk layout surprises and painful upgrades |
| 2. Rehearse the signed transfer | Release engineering runs it; security and operations watch | Carry a bundle along the controlled path, check signatures offline, install with no call beyond the boundary | Real systems often fail at transfer. "Someone will hand-carry it" falls short unless written down, repeatable and auditable |
| 3. Canary on one node | Operations, with the product owner and an incident responder on call | One production node takes the release, handles real traffic and stays within agreed health thresholds for a set observation window | No cloud-scale rollback shortcut: the first live node must show config, dependencies, model and bundle behave together |
| 4. Tested rollback bundle and runbooks | Operations rolls back; release engineering keeps artifacts; technical lead approves | Last known-good bundle stored, tested and ready, with escalation path, operator checklist, rollback steps and signatures | Rollback is a prepared artifact, not a scramble to rebuild confidence under pressure |
- A failed canary or acceptance test returns to the tested rollback bundle.
The source's week plan
| Weeks | Work |
|---|---|
| 0 to 1 | Agree scope; write down non-goals (no live internet calls, no on-the-fly dependencies, no self-updating agents, no cloud observability) |
| 1 to 2 | Build production-identical staging |
| 2 to 3 | Practise the full transfer and import drill |
| 3 to 4 | Write the handoff so anyone can repeat and audit it |
| 5 | One-node canary |
| 6 to 8 | Build and test the rollback bundle as a proper artifact |
- After the pilot: add nodes only while install success, signature checks and capacity saturation stay healthy; keep watching release age.
- Caveat: the schedule lists the formal rollback exercise after the canary, but the phase list makes a tested rollback a prerequisite for wider promotion. Read the week plan as planning order, not permission to expand before rollback is proven.
- Owner + gate + stopping point before damage spreads: a staged rollout, not deployment by hope.
8. Measure, own and stop a release
Six technical health metrics
| Metric | Calculation | Data from | Owner | Alert threshold |
|---|---|---|---|---|
| Offline install success rate | Successful offline installs ÷ attempts, same release window | Installer logs, release logs, node boot records | Release engineering | Under baseline, or failures on more than one staging or production node in a cycle, halts expansion; check integrity, dependency drift, environment mismatch |
| Signature verification failures | Failed signature checks on bundles, artifacts or manifests, in transfer or at install | Transfer logs, install-time verification logs | Security or release engineering, per the local operating model | Any unexpected failure is a go/no-go blocker until root cause is clear |
| Model throughput and latency | Documents or pages per unit time, with latency at the chosen percentile on user paths | Local performance counters, service telemetry | Platform or ML operations | Latency outside the accepted band, or throughput under forecast: inspect queue limits, saturation, quantisation, batching |
| Capacity saturation | Share of safe headroom in use: token budget, queue depth, disk I/O, memory, GPU or CPU | Service queues, host metrics | Infrastructure or SRE | Sustained near the ceiling: scale up, shed load or throttle before it turns unstable |
| Mean time to repair | Average time from declaring an incident to restoring service | Incident timelines | Incident management with primary on-call | Climbing release over release: missing documentation, automation or spare capacity |
| Release age | Time since the running bundle was signed off and deployed | Deployment records, release registry | Release manager | Too old: drifted from security fixes and lessons. Changing too fast: too little soak time |
SRE = site reliability engineering. ML = machine learning.
Keep user and business metrics separate
- A healthy system can still go unused.
- Adoption: repeat use, active users, documents submitted, share of workflows done with no manual workaround.
- Business outcome: time saved per case, lighter manual review, more analyst throughput, fewer missed deadlines or rework cycles.
- Owner: usually the business sponsor or operations manager, backed by product and the FDE.
- Tie the layers together: faster throughput means little if analysts distrust output; if users still correct results by hand, the gain is smaller than the demo implied.
A dashboard that tells one story (three causal rows)
| Row | Shows |
|---|---|
| Top: user outcome | Documents per shift, mean turnaround per case, share of cases finished without manual fallback |
| Middle: service behaviour | Install success per release, signature failures per transfer, latency and throughput per node, queue depth and saturation |
| Bottom: operational control | Release age, rollback bundle available, mean time to repair with open incidents, last successful signed transfer |
- It answers the question that counts in a closed network: is the user's problem getting better because the system is healthy, or is the system only alive while the workflow stays painful?
- "How would you dashboard this?" is a common follow-up. Three rows show causal layers, not a wall of green lights.
Owners
| Owner | Answers for |
|---|---|
| Product or business owner | The case-review workflow and the definition of success |
| Release engineering | Packaging, signing bundles, release records |
| Security | Trust-root handling, audit evidence, the transfer process |
| Operations or SRE | Health monitoring, the canary, carrying out rollback |
| ML or platform engineering | Model performance, runtime efficiency, compatibility |
| Help desk or support lead | User problems, training gaps, documentation defects |
Go/no-go gates, in order
- Offline verification of the bundle passes.
- The bundle is complete and fits the target node class (these two apply the first production gate).
- Staging on near-production hardware shows the expected behaviour.
- Canary latency, throughput and saturation stay within thresholds.
- Someone has tested the rollback bundle. Archiving it isn't enough.
Rollback triggers
- Repeated signature failures.
- An unexplained install failure.
- A latency regression on the canary.
- A climbing error rate.
- Any sign the release puts enclave integrity at risk.
- "We'll debug it live" isn't a plan. Saying it means the team never had a working way back.
Standardise what repeats
| Layer | What goes in it |
|---|---|
| Configuration | Approval thresholds, retention rules, document types, queue limits, which approved offline model, workflow routing |
| Adapters | Importers for document sources, exporters to case systems, translation layers for local formats |
| Shared services | Release registry, audit logging, bundle validation, signature verification, model-serving primitives: reusable across enclaves |
| Core product | Document analysis engine, health-check framework, offline package manager, rollback discipline: improving them improves every deployment |
- Product thinking: don't hand-build one-off integrations forever; turn repeated local pain into reusable capability while respecting each boundary.
Risk register
| Risk | Owner | Mitigation | Trigger |
|---|---|---|---|
| Offline bundle lacks a transitive package | Release engineering | Dependency lockfiles, preflight bundle validation, install rehearsed in staging | An install fails, or an import can't resolve at boot |
| Signatures don't match during transfer | Security engineering | Offline trust-root validation, signed manifest checks, dual-control transfer steps | Any unexpected verification failure |
| Model latency on one node exceeds what users tolerate | Platform or ML operations | Smaller model variant, adjusted batching, or moving work to other hardware | Canary latency regression, or queues keep growing |
| Operators need tribal knowledge | Support lead and technical lead | Incident drills, runbooks, training, explanations attached to alerts | Same questions keep coming, escalations stall, cases handled inconsistently |
The delivery story the interviewer wants
- Four steps from prototype to staged rollout.
- Tracked: release age, repair time, saturation, latency, throughput, signature failures, install success.
- Separate layers: business outcome, adoption, model quality, technical health.
- Owners and gates named, so a bad release halts before it becomes an incident.
Soundbite (source's measurable impact statement): "It counts as a success only when analysts use it, documents are handled faster and more consistently, and the operating team keeps it running as maintainable AI that runs locally and never crosses the enclave's network, artifact, identity or audit boundaries."
Quick Recall: Lines to Say in the Interview
- "The boundary is the design, not a constraint I bolt on afterwards."
- "If I defend one assumption, it's no internet at runtime. Relaxing it later only simplifies things."
- "477 replicas against a fixed pool means the request mix is wrong. I won't ask for hardware."
- "Signing and the transfer staging zone are the only bridge between the two worlds."
- "The offline registry is the one system of record; the runtime never falls back to an older cached copy."
- "No bundle enters the enclave until it has proved, offline, that it is intact, complete and compatible."
- "A retry can't create a file nobody copied in. Missing dependencies fail closed and keep the evidence."
- "A library that silently calls home is a leak."
- "Rollback is a prepared, tested artifact, and 'we'll debug it live' isn't a plan."
Technical deep dives
What this part covers: the release records and APIs, two verifier sketches and their limits, four deployment trade-offs, and how to close the cost, build-versus-buy and governance gaps live.
30-Second Cheat Sheet
- Three records make the system governable: ReleaseManifest (what may deploy), ModelDeployment (what's live), OfflineAuditEvent (who did what, append-only).
- Four APIs: analyze, models status, validate, promote. Every write path is idempotent, and promote uses optimistic concurrency.
- Verifier sketch: shape checks → signature → per-artifact hashes, with separate exception classes for separate operator responses.
- Its limits matter: HMAC scaffolding, no closure check, no path containment, parses before it authenticates.
- Tamper test: proves one invariant: a tampered bundle is refused and the evidence is kept.
- Replay gap: signed material without a version lets an older, validly signed bundle replay. Sign the version.
- Trade-offs: smallest model that clears the bar; containers or appliance by the customer's standard; fewer, more trusted releases; start central.
- Governance: discussion maps (NIST 800-53 CM, AU, SC families), not compliance claims.
1. Release records and API contracts
Three records, each with a key, lifecycle, retention rule and owner
| Record | What it is | Primary key | Lifecycle | Retention |
|---|---|---|---|---|
ReleaseManifest(version, artifact_hashes, signatures, dependencies) |
The promise a bundle makes: the contract you deploy against | version: one stable name to cite, rebuild against and promote |
Written on the connected side → signed → carried in → validated → staged → promoted or rejected | Keep the manifest, signature material and enough dependency detail to show later why it passed or failed. Audit needs and local policy set it; no universal standard |
ModelDeployment(model_id, version, hardware, status) |
Runtime truth: which model is live, and where | Preferred: a dedicated deployment_id with a unique constraint over (model_id, version, hardware). Without it, that composite is the natural key. Pick one on purpose. |
staged → validated → active → draining → retired |
Enough history to answer "which model served this document when we analysed it?" |
OfflineAuditEvent(actor, action, artifact_hash, time) |
Which actor took which action on which artifact, and when | Usually an event ID, with the four-field tuple as the business key | Append-only: nobody rewrites an audit row | The customer's audit policy. Purge too eagerly and trust goes; keep too much and you may break local retention rules |
- Without a vendor console, the audit log is the only way to reconstruct an incident.
Ownership is split deliberately
| Owner | Holds |
|---|---|
| Build team | Signed release material, until the handoff into offline validation |
| Offline runtime | Deployment state |
| Security and operations | The audit trail |
- The split stops a government network from becoming one large mutable blob.
Four API contracts
| Endpoint | Plane | Takes → returns | Idempotency / guards | Errors it separates |
|---|---|---|---|---|
POST /v1/documents/analyze |
Data plane (analysts) | Authenticated document payload + optional idempotency key or analysis profile → typed result, request ID, pointer to model version | Same key + identical body → same result or a stable "already processed". Same key + different body → reject as a conflict: the key no longer names one operation | Bad input, unauthorised, no free model capacity, policy rejection |
GET /v1/models/status |
Operators' read path | → each model's deployment state, live version, readiness per hardware target | Repeated calls change nothing, but callers still authenticate: status can reveal operational details | Unknown model, not deployed, temporarily unavailable |
POST /v1/admin/releases/validate |
Control-plane gate | Bundle pointer or uploaded bundle → structured pass/fail or validation report | Idempotent per release ID: two runs on one bundle → one logical validation record unless content changed | Checks manifest signature, artifact hashes, every declared dependency present |
POST /v1/admin/releases/{id}/promote |
Control plane | Moves a release from validated to active |
Three guards: authorisation, policy checks, optimistic concurrency | Refuses: can't promote from current state; target deployment changed since last read; live release isn't the one the client expected |
- Authentication stays inside the boundary: the offline identity provider or a token minted on the network itself. "Just use OAuth" isn't an answer.
Optimistic concurrency and retries
- Each release object holds a revision token.
- The promote call sends it back.
- If another operator already moved the deployment, the server refuses the write.
- So two people can't push incompatible releases live at once.
- Retry automatically: safe reads and validation calls, nothing else by default.
- Retry a promotion only when it was built to be idempotent and a write token guards it.
Version everything, not only public APIs
- Request and response shapes carry versions, so a manifest or validation-output change can't break older tooling overnight.
- Versioning covers the bundle format, the manifest schema and the audit event schema too.
- When nobody can update the offline environment at will, every breaking change is a planned migration, never a light refactor.
Spoken answer (source's 90-second implementation summary): "I'd ship each release as a signed manifest that lists every artifact hash and declares every dependency. Deployment state lives apart from audit state. Versioned endpoints cover analysis, status, validation and promotion. Every write path is idempotent and uses optimistic concurrency. Release verification is the riskiest part, so I'd build and test it first: typed checks on the manifest, a signature check, a hash check per artifact, and clearly structured failure modes."
2. Read the verifier sketch piece by piece
The order of checks
read manifest.json + manifest.sig → valid JSON object? → version, artifacts, dependencies present? → verify signature over canonical_json(manifest) → hash each artifact vs manifest sha256 → normalise dependencies → return VerifiedManifest
| Check fails | Raises |
|---|---|
| Not valid JSON, or root isn't an object | ManifestError |
| Required field missing or wrong type | ManifestError |
| Signature invalid | SignatureError |
sha256 isn't a 64-char hex digest |
ManifestError |
| An artifact's hash differs | IntegrityError(path) |
| A dependency isn't a non-empty string | ManifestError |
The core lines (from the source sketch)
def canonical_json(obj):
return json.dumps(obj, sort_keys=True, separators=(",", ":")).encode("utf-8")
def verify_signature(trusted_public_key, payload, signature):
# Interview sketch: replace with a real signature primitive such as Ed25519 verification.
expected = hmac.new(trusted_public_key, payload, hashlib.sha256).digest()
if not hmac.compare_digest(expected, signature):
raise SignatureError("manifest signature verification failed")
# inside verify_bundle, per artifact:
if len(expected_hash) != 64 or any(c not in "0123456789abcdef" for c in expected_hash.lower()):
raise ManifestError(f"artifacts[{idx}].sha256 is not a valid hex digest")
actual_hash = sha256_hex(bundle.read_bytes(path))
if not hmac.compare_digest(actual_hash, expected_hash):
raise IntegrityError(path)
- The full sketch (imports,
_require_str,_require_list, normalisation) is in the full casebook.
Piece by piece
| Piece | What it does | Why |
|---|---|---|
canonical_json |
Deterministic bytes: sorted keys, no extra whitespace | One logical manifest → same bytes → same signature |
sha256_hex |
Stable digest per artifact | Something fixed to compare against |
verify_signature |
Labelled a sketch on purpose. Uses HMAC even though the parameter is named trusted_public_key |
Production needs a genuine asymmetric primitive such as Ed25519, where the enclave holds only a public key that can't create signatures, plus an approved key lifecycle |
| Three exception classes | SignatureError (who produced it), ManifestError (shape), IntegrityError (content) |
Each calls for a different operator response. A fourth, ValidationError, is declared but never raised |
VerifiedManifest |
Frozen dataclass | Nothing quietly alters a successful result. Limit: the tuple holds dicts, which are still mutable; deep immutability needs more normalisation |
_require_str, _require_list |
Type checks at the boundary | Malformed input fails early, before any state moves |
verify_bundle |
Reads, parses defensively, checks fields, verifies signature over the canonical form, compares hashes with hmac.compare_digest |
Constant-time comparison avoids leaking information through timing; returns a typed result the promote step can rely on |
HMAC = hash-based message authentication code: a symmetric scheme where the same secret both creates and checks the tag.
What the snippet leaves out on purpose
- Concurrency and retries belong in the production layer (covered in the records section above).
- Observability: surround the path with logs, counters and structured audit events. Each validation records who validated which bundle, which hash it checked and, on failure, why.
Limits the source doesn't spell out (they matter for "complete")
- No closure check. It validates dependency names but doesn't check the files exist or resolve transitive closure. Prove closure separately.
- No path containment. It reads artifact paths from the manifest without rejecting absolute paths,
..traversal or unsafe archive members. - Parses before it authenticates, then checks the signature over a re-serialised copy, not the exact signed bytes.
- Fix: verify the signature over the raw
manifest.jsonbytes first; parse only after it passes. - Re-serialisation works only if signer and verifier emit identical JSON (number formatting, escaping, key order): the problem RFC 8785 canonicalisation addresses.
- Python's
json.loadssilently keeps the last of any duplicate keys (see RFC 8259), so two parsers can disagree about what one manifest says.
- Fix: verify the signature over the raw
- Case bug in the digest check. It accepts upper-case hex but compares case-sensitively against lower-case
hexdigest(), so a valid upper-case digest raisesIntegrityError. Normalise case before comparing. - A production verifier also: bounds sizes, parses without executing, applies signer policy and target compatibility checks, writes durable local audit records, handles trusted timestamps and revocation.
Contract and failure-injection tests
- Goal: show how the gate behaves on a pass and on a failure. Full coverage isn't the goal.
| Test | Setup | Expects |
|---|---|---|
| 1. Contract test | Manifest version "2024.10.1", artifact model.bin with its real hash, dependency tokenizer.json, valid HMAC signature |
A normalised VerifiedManifest with the expected version, path and dependency tuple |
| 2. Failure-injection test | Same, but sha256 is "0" * 64 and model.bin holds b"tampered-weights" |
IntegrityError naming exactly model.bin |
| 3. (Source says a real repo adds) | Damage manifest.sig |
SignatureError, because a bad signature and a bad artifact need different operational responses |
- Beyond that: negative tests for malformed fields, missing files, unsafe paths, signer mismatch and incomplete closure.
- For a whiteboard sketch: one contract test and one failure-injection test are enough.
3. Prove one security invariant with a tamper test
The point
- Interview code should prove a security invariant, not walk a toy happy path.
- The invariant: a tampered bundle is refused before it's deployed.
- It's a separate, self-contained example with its own
IntegrityErrorandverify_bundle. Don't concatenate it with the first sketch.
How it differs from the first sketch
| Difference | Detail |
|---|---|
signer field |
Must match the pinned local key before anything else happens |
| Artifacts as a path-to-hash map | On disk, hashed in 1 MB chunks (1024 * 1024) so large model files don't load into memory |
| Missing artifact | Detected explicitly: missing artifact: <path> |
| Audit on every outcome | Every refusal appends an AuditEvent with the reason; acceptance is audited too |
Check order in verify_bundle
- Load the manifest: missing →
"missing manifest"; bad JSON or not an object →"invalid manifest". signer≠ trusted key name → audit +"untrusted signer".signaturemissing or empty → audit +"missing signature".artifactsnot a dict → audit +"invalid artifact list".- For each artifact: bad entry types →
"invalid artifact entry"; file absent →"missing artifact"; hash differs →"hash mismatch: <path>". - HMAC over
{"signer", "artifacts"}(sorted, compact JSON) ≠signature→"signature verification failed". - All pass → audit
"bundle accepted".
Trace the test
- Write a bundle signed by
offline-root-1(secretb"local-trust-root-secret", model bytesb"approved-model-bytes"). - Overwrite
model.binwithb"tampered". - Verification passes the signer and signature-presence checks and reaches the hash loop.
- It appends an audit event and raises
IntegrityError("hash mismatch: model.bin"). - The test asserts an audit event exists and the tampered file is still on disk: the evidence was preserved, not overwritten.
From interview sketch to production
- Keep the control flow; replace the teaching scaffold with a hardened verifier:
- check the manifest schema explicitly;
- write structured audit events to local storage;
- add negative tests for signer mismatch, a malformed manifest, a missing file and a broken dependency closure.
- Further limits worth naming:
- The HMAC secret is symmetric scaffolding, like the first sketch.
- The in-memory audit list isn't durable.
- The hash loop checks only the listed artifacts, so transitive closure still needs its own preflight.
- Bundle-relative paths need containment checks.
Two ordering points
- It hashes files named by a manifest it hasn't authenticated yet, so an attacker-controlled manifest can direct file reads. Check the signature first.
- The signed material covers only
signerand the artifact map: no version, no expiry. An older, validly signed bundle replays cleanly.- The Update Framework calls this a rollback attack.
- Fix: sign the version and refuse any bundle older than the installed release unless a recorded rollback decision allows it.
What it proves and what it doesn't
- Proves: the system won't install a bundle whose integrity it can't establish.
- Doesn't certify: key protection, safe extraction, atomic installation or regulatory compliance.
4. Four deployment trade-offs
One pattern for every trade-off
- Lay out both options.
- Name the deciding factor in terms of the customer's real constraints.
- Commit to a default and say when you'd leave it.
- Use the same pattern live for trade-offs not listed here.
| Trade-off | Option A | Option B | Deciding factor | Default |
|---|---|---|---|---|
| Model size vs hardware fit | Bigger: may improve extraction and summaries, but may not fit GPU memory, answers slower, harder to patch, may need new hardware | Smaller: fits, simpler to support, may struggle with noisy documents, specialised vocabulary or long context | Task type. Triage or structured extraction → a reliable small model can beat a brittle large one. Subtle legal or technical interpretation can justify bigger hardware, only if operators can sustain and safely patch it | Smallest model that clears the quality bar on the customer's own documents. "Always biggest" and "always smallest" are both wrong |
| Containers vs virtual appliances | Containers: portable, repeatable, cleaner separation; fit an existing platform team refreshing components one at a time | Appliance: whole stack sealed in a fixed boundary, fewer moving parts, easier for some security teams to review | Operational complexity vs governance simplicity; the organisation's existing standards | A hardened virtualisation standard → appliance. An existing secure container platform → containers |
| Update frequency vs accreditation cost | Frequent: less vulnerability exposure, better quality, faster feedback | Each update packaged, signed, transferred, verified, staged, tested, approved, and may trigger re-accreditation | The governance load the customer can carry. "Ship weekly because we're agile" is wrong | Fewer, more trusted releases. Security patches on a separate track (still with provenance and validation, a pre-agreed faster approval path); prebuild trusted bundles; dev → staging → enclave; make each high-friction change smaller and more predictable |
| Central cluster vs workstations | Central: easier to manage and observe, every analyst gets the same models; one asset to protect and monitor closely | Workstations: suit a heavily segmented network, low volume, or limited central infrastructure; harder patching, more support, weaker consistency | User count, concurrency, isolation needs, how much central admin the customer can sustain | Start central if the enclave can host it; fall back to workstations for isolated teams or cut-off sub-enclaves |
Soundbite (source's model-size line): "I'd pick the smallest model that clears the quality bar on the customer's own documents. Each step up in size competes for enclave hardware, adds latency and adds accreditation work."
- Source phrasing on update frequency: "I'd favour fewer releases that we trust more. In an air-gapped setting, change costs you in engineering and in governance."
5. Cost, build-versus-buy and governance gaps
The source scored itself and published the result
| Rubric result | Detail |
|---|---|
| Scale | A 20-item rubric in four phases |
| Covered | 17 items |
| Item 7: unit economics and cost drivers | Absent. The Cost SLI and rollout discussion stay qualitative; no figures were invented |
| Item 10: build vs buy, vendors, model choice | Partial. Weighs model size but assumes every component is built in-house |
| Item 17: regulation and governance depth | Absent. Accreditation, approval gates and audit trails run through the design, but no framework is named, deliberately |
| Item 18: responsible AI | Covered through correctness, governance and integrity (audit evidence, signed provenance, fail-closed policy), not bias or fairness |
- No second review was run. The source author then sketched how to close each gap live, using only the existing architecture.
Unit economics without invented numbers
- Shape from the replica formula:
cost per document = (GPU-hours on the model server + amortised storage and index + telemetry and audit storage) / documents handled in that window
- Support and update effort belong in the overhead too.
- A fixed pool simplifies this: replicas can't grow, so the question becomes how much of the pool this workload uses. The 477-replica example already says: far more than exists.
- Present it as cost per analyst-hour saved against GPU-hours burned; use the baseline-versus-10x table for the scaling argument, not a dollar figure you can't defend.
- Without the customer's GPU procurement cost and fully loaded analyst cost, sketch only the shape and invite the interviewer to supply one real figure as an anchor.
- Never make up a cost-per-document number.
Build or buy, per component (the nine components make it a per-component call)
| Bucket | Components | Why |
|---|---|---|
| Buy or adopt (if on the approved products list) | Offline registry and package mirror, identity-provider integration, telemetry stack | Commodity infrastructure. A bespoke air-gapped mirror could take months to re-solve a problem the accreditation programme may already have cleared a vendor for |
| Build | Document pipeline's redaction and extraction logic, release manifest schema, the verify_bundle integrity gate |
No vendor can own domain-specific redaction correctness or a manifest schema shaped around this customer's audit policy |
| Caveat | A vendor platform could still supply some verified mechanisms | If the customer accepts its evidence and support model |
- Source's rule of thumb: buy solved, security-commoditised problems whose vendors already hold the right government credentials (identity brokers, package mirrors, base OS images); build only the boundary logic and the mission pipeline.
Governance frameworks as conditional context
- US government on-premises procurement signals (source):
- a product on NIAP's Product Compliant List under Common Criteria;
- a published DISA STIG (Security Technical Implementation Guide) for it.
- FedRAMP is the wrong yardstick here: it authorises cloud services, not on-premises products.
- If the enclave is US government, the source would name NIST SP 800-53 Rev 5 and map control families onto controls the design already has:
| Control | What it is | Maps to |
|---|---|---|
| CM-3 | Configuration change control | Signed release manifest |
| CM-14 | Signed components | Signed release manifest |
| AU-2 | Event logging (Rev 5 retitled it from "Audit Events") | Offline audit log |
| AU-12 | Audit record generation | Offline audit log |
| SC-7 | Boundary protection | Fail-closed dependency policy |
- Export-controlled technical data: ITAR/EAR rules could limit which analysts may see some documents at all; the compliance officer adds that as a new constraint in the stakeholder map.
Spoken answer (source's version): "I don't know yet which framework governs this enclave. But what I've already described (append-only audit, signed provenance, fail-closed promotion) maps cleanly onto the CM and AU families in NIST 800-53. So once we learn the exact framework, the architecture stays put. Only the format of the evidence changes."
- These are discussion maps, not compliance claims. The customer's compliance authority decides which framework applies, which controls are in scope and what evidence counts. No architecture sketch establishes legal compliance or an authorisation to operate.
6. Source references
- Primary references: NIST SP 800-53 Rev 5; RFC 8785 JSON canonicalisation; RFC 8259 on duplicate object names; The Update Framework specification; DistServe on prefill and decode (arXiv 2401.09670); the SLSA specification.
- The source author checked these on 27 September 2026. They support the standards and supply-chain claims; verify current requirements with the customer's authorised reviewers.
| Reference | What it supports |
|---|---|
| NIST SP 800-53 Rev 5 control catalog (OSCAL JSON) | Control titles for CM-3, CM-14, AU-2, AU-12 and SC-7 |
| FedRAMP | Authorises cloud services, not on-premises products |
| NIAP Product Compliant List | Common Criteria listing for commercial IT products in national security systems |
| DISA Security Technical Implementation Guides | DoD configuration guides for operating systems and other products |
| SLSA provenance specification v1.0 | Build provenance attestations. The SLSA site now marks later versions current (v1.2 in November 2026), so check the version the customer's policy names |
Python hmac.compare_digest |
Constant-time comparison to reduce timing attacks |
- The full casebook has the links.
Quick Recall: Lines to Say in the Interview
- "The manifest is the contract I deploy against; the audit log is append-only and is my only incident record."
- "Same idempotency key with a different body is a conflict, not a replay."
- "Promote carries a revision token, so two operators can't push incompatible releases at once."
- "Three exception classes, because a bad signature and a bad artifact need different responses."
- "The sketch uses HMAC as scaffolding; production needs Ed25519-style asymmetric signatures."
- "Verify the signature over the raw bytes first, then parse."
- "Sign the version too, or an older signed bundle replays cleanly."
- "Smallest model that clears the bar on the customer's own documents."
- "These are discussion maps onto NIST 800-53, not compliance claims."
Quick review
One sentence: build outside, prove the bundle offline, then deploy inside. No bundle enters until it has proved, offline, that it is intact, complete and compatible, and every failure keeps the running release untouched.
30-Second Cheat Sheet
- Outcome line: maintainable AI that runs locally and never crosses the enclave's network, artifact, identity or audit boundaries.
- Defend first: no internet at runtime.
- Sizing: ~22 GB per replica (24 GB too tight); 477 replicas → challenge the request mix, never ask for hardware.
- Architecture: connected build world + offline runtime, signing and transfer staging the only bridge.
- First production gate: intact, complete and compatible, proved offline.
- Failure policies: fail closed, degrade, queue or human. A library that calls home is a leak.
- Records: ReleaseManifest, ModelDeployment, append-only OfflineAuditEvent.
- Delivery: four phases, six health metrics, three-row dashboard, explicit rollback triggers.
1. Recall the boundary, the gate and the recovery path
Outcome line
- Maintainable AI that runs locally and never crosses the enclave's network, artifact, identity or audit boundaries.
- The boundary is the design.
- Defend the no-internet-at-runtime assumption first: relaxing it later simplifies the design, but assuming the reverse breaks it.
- Measure success with analyst turnaround per case, which the customer can check from inside.
Sizing
| Item | Value |
|---|---|
| Users | 1,000 |
| Peak | 20 QPS |
| Corpus | 50 million pages |
| GPU pool | Fixed |
| Illustrative memory per replica | ~22 GB, so a 24 GB card is too tight |
| Replica formula | 20 QPS × 2,000 tokens ÷ (120 tokens/s × 70%) = 477 replicas |
- 477 means challenge the request mix: retrieval, rules, batch, smaller model, offline preprocessing, narrower interactive scope.
- Never ask for hardware.
Architecture
- A connected build world and an offline runtime, with signing and the transfer staging zone as the only bridge.
- Nine components in dependency order.
- The offline registry is the one system of record for deployable artifacts. No runtime falls back to an older cached copy.
- Requests are synchronous; updates are asynchronous.
First production gate
Say it word for word: "No bundle enters the enclave until it has proved, offline, that it is intact, complete and compatible."
- Each release ships as a signed manifest listing every artifact hash and declaring every dependency.
- So a missing package fails before installation, not at runtime.
Failure policies
| Condition | Policy |
|---|---|
| Missing transitive package or corrupted artifact | Fail closed, keep evidence, leave the running release untouched, add a closure preflight |
| Signature and authentication checks | Fail closed |
| Stale index | Degrade with a freshness warning |
| Ingestion | Queue in a bounded buffer |
| GPU memory pressure | Fall back to a pre-approved smaller model, or queue |
| Certificate expiry | Admin actions stop; permitted reads degrade |
| Trust-root updates and promotion | Need a human |
- Every observability path is local-first, because a library that calls home is a leak.
Records and code
| Record | Role |
|---|---|
| ReleaseManifest | What may deploy |
| ModelDeployment | What is live, staged to retired |
| OfflineAuditEvent | Who did what; append-only |
- Promotion uses optimistic concurrency; analysis and validation are idempotent.
- Both verifier sketches use HMAC scaffolding. Before production they need:
- a real asymmetric signature;
- path containment;
- proven dependency closure;
- durable audit.
Model and index
- Version them as a compatible pair.
- New weights that change embeddings or tokenisation force a rebuild or a parallel index.
- Keep the old pair serving until compatibility is proved.
Trade-offs
| Trade-off | Default |
|---|---|
| Model size | The smallest model that clears the quality bar on the customer's documents |
| Packaging | Containers or an appliance by the customer's existing standard |
| Update frequency | Fewer, more trusted releases, security patches on a separate track |
| Placement | Start central, fall back to workstations for isolated teams |
Delivery
- Identical staging.
- Rehearsed signed transfer.
- One-node canary.
- Tested rollback bundle with runbooks.
- Each phase has an owner and exit gate.
- Six health metrics with owners and alert rules, a three-row dashboard, a four-item risk register and explicit rollback triggers.
- Success means analysts use it, documents move faster and the local team can keep it running.
Flashcard Drill
Quick Recall: Lines to Say in the Interview
- "Maintainable AI that runs locally and never crosses the enclave's network, artifact, identity or audit boundaries."
- "If the customer relaxes the no-internet assumption later, the design only gets simpler."
- "22 gigabytes a replica, so a 24 gigabyte card is too tight."
- "477 replicas means the request mix is wrong, not that I need more GPUs."
- "Signing and the transfer staging zone are the only bridge."
- "Intact, complete and compatible, proved offline, before anything enters."
- "A missing package fails closed, keeps the evidence and leaves the running release alone."
- "Version the model and the index as a pair, and keep the old pair serving until compatibility is proved."
- "Success is analysts using it and the local team keeping it running."
Where next
- Practise this as a worksheet
- AI System for an Air-Gapped Environment
- Revise the concepts