Skip to main content
3Nsofts logo3Nsofts
Chapter 3 • Week 3

Privacy-Preserving AI Architectures

Privacy does not happen automatically just because inference is on-device. This chapter covers architecture decisions, data boundaries, and implementation patterns that stand up to audit and review.

Threat model first, implementation second

Before selecting frameworks, define what data should never leave the device, what data can be retained, and what metadata can be collected for product analytics. Most teams invert this order and retrofit policy later.

  • - Classify raw input, derived features, model output, and telemetry separately.
  • - Define retention budgets for each class (ephemeral, session, persisted).
  • - Establish explicit no-export categories for regulated or sensitive domains.

Data minimization architecture pattern

Keep inference payloads local, persist only transformed artifacts when needed, and isolate telemetry as aggregate events without user content. The architecture should make policy violations difficult by default.

struct PrivacyPolicy {
    let allowRawInputPersistence: Bool
    let allowOutputPersistence: Bool
    let allowNetworkTelemetry: Bool
}

actor PrivacyGate {
    private let policy: PrivacyPolicy

    init(policy: PrivacyPolicy) { self.policy = policy }

    func persistOutput(_ value: String) throws {
        guard policy.allowOutputPersistence else {
            throw PrivacyError.persistenceBlocked
        }
        // persist redacted or tokenized output only
    }
}

App Privacy Details alignment checklist

  1. 1. Map each collected field to purpose and retention policy.
  2. 2. Verify no hidden collection via third-party SDK defaults.
  3. 3. Include AI-specific diagnostics fields in privacy review docs.
  4. 4. Keep generated output out of analytics payloads unless explicitly consented.
  5. 5. Add runtime kill switch for telemetry in sensitive environments.

Audit-ready implementation artifacts

Maintain these as versioned project docs:

  • - Data flow diagram with trust boundaries.
  • - Per-feature data inventory and retention schedule.
  • - Logging redaction policy and incident response path.
  • - Privacy test matrix and release sign-off checklist.

Interactive Example Links