Privacy-Enhancing Technologies and Anonymization Questions
Technical safeguards that reduce identifiability: anonymization, pseudonymization, tokenization, differential privacy, and related privacy-enhancing technologies. Covers the difference between anonymized and pseudonymized data, re-identification risk, and when each technique is appropriate. Includes evaluating the privacy-utility tradeoff of a given technical control.
How would you design personalization features for Airbnb recommendations while minimizing privacy risk and complying with regulations? Evaluate approaches such as differential privacy, federated learning, cohort-based personalization, local aggregation, and feature hashing. Discuss trade-offs in model utility, deployment complexity, and auditability.
Sample Answer
Situation: Design Airbnb recommendation personalization that maximizes relevance while minimizing privacy risk and meeting regulations (GDPR, CCPA).
Approach overview (requirements & constraints):
- High utility: relevant listings, host/item personalization
- Privacy: limit PII exposure, enable user control, data minimization
- Auditable & explainable for compliance
- Scalable, low-latency for UX
Evaluate approaches:
- Differential Privacy (DP)
- What: add calibrated noise to gradients/aggregates or use DP-SGD.
- Utility: small utility loss tunable via epsilon; tight privacy reduces accuracy.
- Complexity: moderate (privacy accounting, tuning epsilon, re-training).
- Auditability: good — formal guarantees and logs; but explains only overall risk, not individual recommendations.
- Federated Learning (FL)
- What: train models on-device; only model updates sent.
- Utility: near-central training if many clients; heterogeneity and communication noise affect convergence.
- Complexity: high (orchestration, secure aggregation, compression, handling stragglers).
- Auditability: harder — need provenance for updates and secure aggregation makes inspection limited; combine with DP for stronger guarantees.
- Cohort-based Personalization (e.g., k-anonymity / hashed cohorts)
- What: bucket users into behavior cohorts for group-level signals (similar to FLoC-like).
- Utility: lower granularity than per-user, but still effective for many features.
- Complexity: low — easier to deploy and explain.
- Auditability: high — cohorts are transparent and easier to document; risk of re-identification if cohorts small.
- Local Aggregation / On-device Feature Engineering
- What: compute features locally (preferences, recent searches), send only aggregates or feature hashes.
- Utility: retains temporal personalization; can combine with server models.
- Complexity: moderate — requires client code, storage, sync logic.
- Auditability: good if aggregates logged; preserves raw PII on-device.
- Feature Hashing / Pseudonymization
- What: hash identifiers or map to pseudo-ids; reduce direct linkage to PII.
- Utility: minimal loss for categorical features; potential collision issues.
- Complexity: low.
- Auditability: medium — reversible if salts leaked; must manage key rotation.
Trade-offs & recommended hybrid design:
- Combine FL + DP + local aggregation: train base model centrally, fine-tune on-device with FL; apply DP to updates and secure aggregation to prevent update leakage. Use cohort signals for cold-start and non-sensitive personalization.
- Use feature hashing + strict key management for server-side features, and keep sensitive raw data local.
- Provide auditability by logging model versions, privacy budgets, cohort definitions, and running periodic privacy impact assessments. Expose opt-out controls and data deletion flows.
Practical considerations:
- Start with cohort-based + server models (fast, low-risk). Pilot FL+DP for high-value personalization where client density is sufficient.
- Monitor utility vs. epsilon; run A/B tests measuring CTR, bookings, and fairness metrics.
- Ensure legal/compliance sign-off, encryption-in-transit & at-rest, and regular privacy audits.
This hybrid balances utility, deployment effort, and provable privacy while remaining auditable and compliant.
How would you incorporate differential privacy (DP) into an online learning pipeline where data arrives continuously and you must provide per-update privacy guarantees? Discuss DP-SGD adaptations, clipping/noise per update, streaming privacy accounting, and the cost on utility and latency.
Sample Answer
Approach summary:
For online learning with per-update DP guarantees, adapt DP-SGD into a streaming variant: treat each incoming minibatch (or single example) as an “update” and apply per-update clipping + noise, with a streaming privacy accountant (e.g., moments accountant or Renyi DP) to accumulate budget.
Key components:
- Per-update clipping: Clip each example’s gradient g to norm C: g_clipped = g * min(1, C/||g||). For single-example updates this is standard; for minibatch updates clip per-example then average.
- Per-update noise: Add Gaussian noise N(0, σ^2 C^2 I) to the sum/average of clipped gradients. Choose σ to achieve (ε_t, δ) per-update or select σ globally and derive per-update ε_t via accountant.
- Streaming privacy accounting: Use Renyi DP (RDP) with conversion to (ε,δ) to compose updates efficiently. For potentially unbounded streams use:
- Fixed horizon: pre-allocate total ε_total and stop or reduce learning when exhausted.
- Privacy decay / sliding window: only count contributions within the window (use concentrated DP or privacy amplification by subsampling if sampling is used).
- Use advanced composition (RDP) or privacy filters (dynamic checks) to enforce per-update bounds.
Trade-offs (utility & latency):
- Utility: Clipping introduces bias (underestimates large gradients); noise increases variance—both slow convergence. Mitigations: tune clipping C, use larger batch sizes to reduce relative noise, adapt learning rate, use momentum/Adam variants designed for DP.
- Latency: Per-example clipping and RNG for noise add compute overhead. Minibatching and vectorized clipping reduce cost; hardware RNG or batched noise sampling helps. Streaming accounting adds small CPU cost but is negligible compared to backprop on GPU.
Practical recommendations: - Start with conservative σ and C, track empirical gradient norms to set C.
- Use minibatches when possible to get privacy amplification by subsampling.
- Implement an RDP accountant with periodic conversions to (ε,δ).
- Monitor utility; if budget exhausted, fall back to non-sensitive updates or slow learning rate.
This balances formal per-update DP guarantees with practical model performance and latency.
Meta faces new regulatory constraints in a major market that limit personalization. Propose technical and process-level controls to comply while preserving as much mission-relevant personalization as possible. Discuss model design choices (on-device, federated, differential privacy), evaluation strategies, monitoring, and rollback plans.
Sample Answer
Situation: A major market introduces rules that restrict using individual-level data for personalization (e.g., bans on profiling, limits on retention, stricter consent and explainability). Our goal as an AI engineer is to remain compliant while preserving mission signals that improve user experience.
Proposal — Technical controls
- Data minimization & schema gating: only ingest attributes allowed by regulation; enforce schema-level validators and automated redactors at ingestion.
- Pseudonymization + purpose-bound tokens: separate identifiers from profile attributes; bind tokens to allowed purposes with short TTLs.
- On-device models: move inference and short-term personalization to the client where possible (local feature stores, cached embeddings), reducing server-side profiling risk.
- Federated Learning (FL): use FL for model updates so raw data never leaves devices; combine with secure aggregation to prevent reconstruction.
- Differential Privacy (DP): add DP (e.g., Gaussian/odp) to gradients/updates and to analytics outputs to provide provable privacy budgets.
- Policy engine + enforcement: runtime policy layer that blocks disallowed personalization flows (e.g., no cross-context linking).
Model design choices & trade-offs
- On-device inference: best for latency and privacy but limited model capacity. Use distilled models or hybrid split models (small on-device + server-side aggregate model).
- Federated + DP: reduces central data collection but incurs communication costs and statistical heterogeneity; mitigate with robust aggregation and personalization layers (meta-learning).
- Server-side cohorting: where individual personalization banned, use cohort-based models (k-anonymity, clustering) to approximate personalization while complying.
- Explainability: design models with interpretable components or post-hoc explainers constrained to not reveal sensitive features.
Evaluation strategies
- Dual evaluation: privacy metrics (DP epsilon, reconstruction risk tests, membership inference, bias audits) and utility metrics (A/B tests on quality, engagement, error rates).
- Synthetic and holdout sims: simulate regulatory constraints with held-out data, run adversarial attacks to test leakage.
- Statistical significance on cohort-level experiments when individual targeting disabled.
Monitoring & detection
- Runtime telemetry: track feature usage, policy violations, model drift, and privacy budget consumption.
- Leakage detectors: periodic MI/MI-style tests, shadow models to probe for memorization.
- Compliance dashboards: immutable audit logs, access controls, and alerts for unusual aggregation patterns.
Process-level controls
- Data governance board: pre-approve features and retention; feature registry with legal tags.
- CI/CD privacy gates: automated checks (schema, DP budgets, policy violations) block merges; privacy-preserving unit tests.
- Consent & UX: explicit, revocable consent flows; default to privacy-preserving modes.
- Cross-functional reviews: legal, security, product sign-off for experiments.
Rollback & incident response
- Safe deploy pattern: staged rollout (canary → cohort → region), monitor privacy signals and utility.
- Fast rollback hooks: feature flags and model versioning to disable personalization or revert to cohort model within minutes.
- Remediation: revoke affected models, rotate tokens, notify regulators if required, run root-cause and compensating controls.
- Post-incident DP audit and re-training using provably private pipelines.
Why this works
- Combines technical guarantees (DP, on-device, FL) with pragmatic server-side patterns (cohorting) to retain personalized utility where legally allowed.
- Process controls (governance, CI gates, audits) ensure sustained compliance and defensibility.
- Monitoring and rapid rollback minimize user impact and regulatory exposure while enabling iterative improvements.
You need to choose an epsilon for DP-SGD fine-tuning of a ranking model. Describe an experimental evaluation plan to quantify privacy-utility trade-offs, including metrics to track, holdout strategy, curves to plot, and decision criteria for selecting epsilon under business constraints.
Sample Answer
Situation: We need to pick an epsilon for DP-SGD fine-tuning of a ranking model so business utility remains acceptable while meeting privacy targets.
Plan (steps)
- Define constraints and goals
- Set allowed delta (e.g., 1e-6 or 1/|users|) and regulatory/contractual privacy floors.
- Define minimum acceptable business metrics (e.g., NDCG@10 loss ≤ X% relative to non-DP baseline, CTR lift thresholds, latency constraints).
- Experimental setup
- Holdout strategy: user-level split (no user in both train and test) into train/val/test. Reserve a separate “production shadow” holdout built from latest traffic for final validation and A/B simulation.
- Repeatable runs: run each config with 3–5 seeds to get variance.
- Sweep and tuning
- Sweep epsilons: e.g., {0.1, 0.3, 1, 3, 8, ∞ (non-DP)}. For each ε, tune clipping norm and learning rate using the same budgeted hyperparameter protocol to avoid confounding.
- Use privacy accountant (RDP / moments accountant) to compute exact ε for the entire fine-tune procedure; report ε, δ.
- Metrics to track
- Utility: NDCG@k, MRR, AUC, calibration (expected calibration error), offline CTR prediction loss, business KPIs simulated (predicted revenue/CTR).
- Robustness: recall by cohort (cold-start, tail queries), fairness metrics across demographic groups if available.
- Stability: per-query ranking variance, permutation consistency.
- Privacy: reported ε, δ, total training steps, clipping norm, noise multiplier.
- Cost: compute/time.
- Analysis & plots
- Plot utility metric vs epsilon with error bars (mean ± CI). Also show relative change vs non-DP baseline.
- Privacy-utility frontier (Pareto): utility on y, ε on x; mark points satisfying business thresholds.
- Additional plots: utility vs noise multiplier, utility vs clipping norm, cohort-specific utility curves.
- Calibration and fairness deltas vs ε.
- Decision criteria
- Primary rule: choose smallest ε whose utility stays above business threshold with statistical significance (e.g., non-inferiority test, p < 0.05) and acceptable cohort/fairness behavior.
- If multiple ε satisfy, prefer lower ε (better privacy) unless operational costs (training time or stability) trade off.
- If no ε meets threshold, consider alternatives: partial DP (only sensitive features), pretraining with DP, synthetic data, or relaxed business targets with mitigation.
- Deployment checks
- Run production shadow A/B for top candidate ε for 2–4 weeks; monitor online KPIs, user-level metrics, and any distribution shifts.
- Maintain reproducible privacy accounting and documentation for compliance.
This plan gives a quantitative privacy-utility curve, cohort and fairness checks, and concrete selection criteria aligned with business constraints.
Compare secure multiparty computation (MPC), homomorphic encryption (HE), and differential privacy (DP) as privacy technologies for machine learning. Explain trust assumptions, types of computations supported, performance characteristics, and example use cases where each is preferable.
Sample Answer
High-level summary: MPC, HE, and DP address different privacy goals and make different trust/performance trade-offs. Use the table below (described in text) to choose the right tool per use case.
Trust assumptions
- MPC: Multiple non-colluding parties compute joint functions without revealing inputs. Security requires an honest majority or bounded collusion; no single trusted server needed.
- HE: A data owner encrypts data and a (possibly untrusted) server computes on ciphertexts; security relies on cryptographic hardness (LWE, RLWE). The decryptor must hold the secret key.
- DP: Trust in a curator or mechanism that adds calibrated noise; guarantees are statistical (bounded leakage) even if outputs are public. Does not protect raw intermediate values.
Types of computations supported
- MPC: General-purpose, supports arbitrary functions including ML training/inference via garbled circuits, secret-sharing-based arithmetic. Flexible but protocol complexity rises with function complexity.
- HE: Naturally supports arithmetic (add/multiply). Some schemes (CKKS) support approximate real-valued linear algebra and neural-net inference; deep non-linear operations (activations) are expensive or require approximation/interaction.
- DP: Agnostic to computation; it’s an output-perturbation layer. You can train models with DP-SGD or release DP aggregates/statistics.
Performance characteristics
- MPC: Communication-heavy and latency-sensitive; scales with number of parties and rounds. Secret-sharing arithmetic is efficient for linear ops; garbled circuits costly for many gates.
- HE: Computation-heavy on server-side, low communication. Bootstrapping (to refresh ciphertexts) is expensive if deep circuits required. Good for low-interaction workloads (one server).
- DP: Minimal runtime overhead (noise addition); main cost is accuracy loss — utility vs epsilon privacy. Computation cost comparable to non-private training (DP-SGD adds gradient clipping/noise).
When to prefer each (use cases)
- MPC: Collaborative analytics where parties cannot reveal raw data to each other (joint fraud detection between banks, multi-hospital study) and low-latency interaction among known parties is acceptable.
- HE: Outsourced inference/training where a single cloud provider should not see raw inputs (private inference for user data, encrypted genomic queries); best when model operations are mostly linear or shallow networks.
- DP: Public release of models/statistics or to protect model outputs against membership inference (training a recommendation model to be shared, telemetry analytics, analytics dashboards). Combine with HE/MPC to bound leakage from outputs.
Practical combos and trade-offs
- Combine DP+HE: HE protects data in transit/compute; DP limits what final model leaks. Useful for outsourced training with public model release.
- Combine MPC+DP: Use MPC for secure joint training, apply DP at output to limit aggregate leakage.
- Consider engineering cost: HE/MPC require cryptographic libraries and heavy compute; DP requires careful privacy accounting, tuning epsilon, and may need larger datasets to retain utility.
Example specifics
- HE (CKKS) for encrypted inference of logistic regression or first layers of a CNN.
- MPC (3-party replicated secret sharing) for secure linear regression across hospitals.
- DP-SGD with epsilon 1-8 for training language models when releasing model weights publicly.
Key takeaway: MPC and HE protect raw values with cryptographic guarantees at a performance/complexity cost; DP protects against inference from outputs with statistical guarantees and lower runtime cost but sacrifices accuracy. Choose based on who you must trust, which computations are needed, and acceptable performance/privacy trade-offs.
Unlock Full Question Bank
Get access to all 25 Privacy-Enhancing Technologies and Anonymization interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.