Threat Modeling for Solo Practitioners and Private Individuals
When you paste a tax return, a medical pathology report, an employment contract, or a client's proprietary source code under a non-disclosure agreement into a hosted web chat interface, you cross an irreversible trust boundary. Even when a cloud provider promises zero data retention or enterprise opt-out from model training, your raw plaintext still traverses public TLS infrastructure, lands in remote memory buffers, generates billing and telemetry metadata, and becomes subject to provider policy changes, third-party breaches, or legal subpoenas.
For an individual practitioner - a solo attorney, independent physician, financial analyst, investigative journalist, or software consultant - the threat model is straightforward: any sensitive artifact that never leaves localhost cannot be leaked in transit, logged on a remote server, or subpoenaed from a third-party vendor. Local AI eliminates external data custody entirely. Instead of trusting legal terms of service, you enforce privacy mathematically and at the operating system boundary.
Air-Gapped and Zero-Egress Local Inference Architecture
A genuine zero-egress architecture separates model acquisition from model execution. During setup, you download verified open-weights models (via Ollama or llama.cpp from Hugging Face with SHA-256 checksum verification) while your workspace is clean and empty. Once the weights are cached locally, you never need internet connectivity to analyze sensitive documents.
At runtime, every component in the stack - the PDF parser (pymupdf or pdfplumber), the PII redactor (Microsoft Presidio), the embedding engine, the vector store, and the LLM server - runs in-process or over the loopback interface 127.0.0.1. By binding the inference server strictly to loopback and disabling telemetry environment variables, your machine can operate completely disconnected from Wi-Fi or behind a strict outbound firewall rule.
Consumer Hardware Sizing and GGUF Quantization Trade-Offs
You do not need an enterprise GPU cluster to run high-accuracy document analysis locally. Modern GGUF quantization compresses model weights from 16-bit floating point down to 4-bit or 5-bit representations with minimal perplexity loss, allowing capable reasoning models to fit comfortably inside consumer unified memory or a single workstation GPU.
When sizing your workstation for sensitive document workflows, budget memory for both the model weights and the KV cache (which grows with context length). Analyzing a 20-page contract or medical history often requires an 8k to 32k token context window:
- 16 GB RAM / 8-12 GB VRAM (Laptop Tier): Run 7B to 9B parameter models at
Q4_K_M(~5.5 GB weights) alongside a local embedding model (~0.3 GB) with an 8k-16k context window. Ideal for fast summarization, clause extraction, and PII auditing. - 32-48 GB Unified Memory or 24 GB VRAM (Prosumer Workstation): Run 14B to 32B parameter models at
Q4_K_MorQ5_K_Mwith 32k context windows. This tier delivers strong multi-document legal and financial reasoning at 20-45 tokens per second. - 64+ GB Unified Memory / Dual GPU (Solo Research Rig): Run 70B-class models quantized to
Q4_K_M(~42 GB) completely offline for complex synthesis across large private archives.
Avoid 2-bit or 3-bit quantizations (Q2_K, Q3_K_S) on sensitive medical or legal records: aggressive quantization increases numerical hallucination and degrades instruction-following fidelity. Stick to Q4_K_M as your floor and Q5_K_M or Q8_0 when memory permits.
Deterministic PII/PHI Redaction and Reversible Token Vaults
Even when running models locally, defense in depth dictates that you should strip unnecessary identifiers before embedding documents into a long-lived vector store or passing text into an LLM prompt. Why? Because vector indices and prompt logs are often backed up or searched repeatedly; keeping raw Social Security numbers, bank account numbers, passport IDs, or API keys out of your vector database minimizes blast radius if your laptop is ever stolen while unlocked.
A production personal redaction pipeline combines deterministic pattern matching (regex for SSNs, IBANs, credit cards, API keys) with local Named Entity Recognition (NER) via Microsoft Presidio and spaCy. Rather than destroying structure with generic [REDACTED] blocks - which confuse the LLM when two people or two accounts appear in the same contract - use reversible indexed placeholders such as <PERSON_1>, <PERSON_2>, and <IBAN_1>. The mapping dictionary lives in an encrypted, short-lived local vault so you can rehydrate the final answer deterministically on screen without ever exposing raw identifiers to the embedding store.
Encrypted Local RAG: Protecting Vector Embeddings at Rest
A common misconception among solo practitioners is that vector embeddings are "anonymous math." Research has repeatedly demonstrated that dense text embeddings can be inverted to reconstruct significant portions of the original sensitive sentences. Furthermore, almost every local vector store (Chroma, LanceDB, SQLite) stores the raw text chunk right next to the embedding vector for retrieval.
Therefore, your vector database must be treated with the exact same cryptographic rigor as your raw tax or medical files. Place your entire sensitive workspace - source PDFs, redaction token vault, and vector database - inside an encrypted container using LUKS (Linux), FileVault + APFS encrypted disk images (macOS), or VeraCrypt (cross-platform). For application-level database encryption in Python, pair SQLite with SQLCipher so the database file on disk remains unreadable ciphertext unless unlocked with your session passphrase.
OS-Level Firewall Locks and Telemetry Elimination
Modern Python libraries and AI frameworks frequently ship with opt-out usage telemetry, automatic version checks, or model-hub auto-downloads that phone home silently on startup. When processing confidential files, "opt-out" is not enough - you want hard network enforcement.
On Linux, you can run your local AI pipeline inside an isolated network namespace (unshare --net) that has only the loopback interface lo enabled, making external TCP/UDP egress physically impossible at the kernel level. Alternatively, configure ufw or nftables outbound rules, or use an application firewall such as Little Snitch on macOS to deny all outbound connections from your Python virtual environment and Ollama process after initial model download.
Defending Against Prompt Injection in Untrusted Local PDFs
Running locally protects your data from leaving your machine, but it does not automatically protect your workflow from indirect prompt injection (OWASP Top 10 for LLM Applications). If you ingest third-party PDFs - such as opposing counsel filings, vendor security questionnaires, or downloaded research papers - hidden white-text instructions inside those PDFs can attempt to hijack your local LLM's output or trigger unintended local tool calls.
Two simple guardrails neutralize this risk for solo practitioners: first, run sensitive document Q&A in tool-free read-only mode (never attach bash, email, or file-write tools to an inference session reading untrusted PDFs); second, wrap every retrieved document chunk in explicit XML delimiters (<untrusted_document>...</untrusted_document>) and instruct the system prompt to treat all text inside those tags strictly as passive data, never as executable instructions.
Failure-Mode Recovery: Silent Cloud Fallback, Swap Leaks, and Temp Files
Most privacy breaches in personal AI setups happen not from exotic attacks, but from mundane configuration mistakes:
- Silent Cloud Fallback: Some IDE extensions and agent frameworks silently fall back to a cloud API key in your environment variables if the local Ollama port is busy. Always unset cloud API keys (
OPENAI_API_KEY,ANTHROPIC_API_KEY) in your sensitive-data shell profile and assertbase_url.startswith("http://127.0.0.1")in code. - Unencrypted Swap & Hibernation Files: When loading a 20 GB model, the OS may page decrypted document buffers to disk swap. Ensure full-disk encryption covers your swap partition (encrypted swap on Linux/macOS) so plaintext never touches unencrypted sectors.
- Orphaned Temp Files in
/tmp: PDF-to-text converters and OCR tools often write intermediate plaintext files to system temp directories. Always mount a RAM-backedtmpfsor an encrypted temp directory inside your mounted vault and scrub it on exit.
Production Python Pipeline: Local PII Redactor and Reversible Token Vault
This Python module runs 100% locally with zero network calls. It detects high-risk identifiers (SSNs, credit cards, email addresses, phone numbers, and IBANs - extensible with Presidio NER), replaces them with indexed placeholders, stores the mapping in an in-memory or encrypted JSON vault, and provides a deterministic rehydration function for your final output.
Production Prompt Template: Sensitive Document Classifier and Redaction Verifier
Before storing any newly scanned document into your local RAG index, run this verification prompt locally to catch contextual identifiers (such as rare job titles, home street addresses, or medical record numbers) that pure regex rules might miss.
Step-by-Step Operational Guide: Hardening an Offline AI Workstation
Follow these five steps to convert a standard laptop or desktop into a verifiable zero-egress workstation for confidential documents:
- Create an Encrypted Vault Container: Mount a dedicated VeraCrypt volume or APFS encrypted sparsebundle (e.g.,
~/PrivateVault) where all sensitive PDFs, SQLite indices, and outputs will reside. - Pre-Stage Weights & Embeddings: While online and before mounting sensitive files, pull your quantized reasoning model and local embedding model in Ollama, then verify disk presence with
ollama list. - Bind Inference to Loopback Only: Set
OLLAMA_HOST=127.0.0.1:11434so the inference API is never exposed on your LAN interface. - Lock Offline Environment Variables: In your vault shell profile, export
HF_HUB_OFFLINE=1,TRANSFORMERS_OFFLINE=1,ANONYMIZED_TELEMETRY=False, and explicitlyunset OPENAI_API_KEY ANTHROPIC_API_KEY GEMINI_API_KEY. - Enforce Kernel or Firewall Egress Block: Run your Python analysis inside
unshare --net(Linux) or enable an outbound firewall block rule for your Python binary, then verify with a test socket connection that external egress fails immediately.
Production Python Pipeline: Zero-Egress Encrypted Document Q&A with Ollama
This complete script asserts localhost-only endpoints at startup, embeds redacted document chunks using Ollama's local embedding API, stores them in a single-file SQLite database inside your encrypted vault, and answers questions with strict XML data-delimited grounding.
Production Prompt Template: Grounded Legal, Medical, and Financial Extractor
Use this prompt template when extracting structured obligations, lab values, or financial line items from sensitive personal documents. It enforces strict verbatim grounding and requires an explicit "NOT_FOUND" marker rather than guessing missing numbers.
Step-by-Step Operational Runbook: Swap Encryption, Temp Shredding, and Audit
Complete this hygiene and verification runbook after finishing a sensitive client engagement, tax season review, or medical record audit:
- Verify Swap & Core Dump Protection: Confirm swap encryption is active (
swapon --showon Linux LUKS or FileVault on macOS) and disable core dumps (ulimit -c 0) so process memory is never written to disk on crash. - Purge Temporary Extraction Artifacts: Delete any intermediate OCR or text files created during ingestion and clear sensitive command arguments from shell history (
history -cor prefixing commands with a leading space). - Audit Listening & Outbound Sockets: Run
ss -tulnp(Linux) orlsof -i -P(macOS) to confirm your Ollama and local RAG processes are bound exclusively to127.0.0.1with zero established external connections. - Retire Ephemeral Token Vaults: If you only needed temporary Q&A for a one-off contract review, securely delete the token vault and session SQLite index, keeping only your encrypted source archive.
- Unmount Encrypted Volume: Cleanly unmount your VeraCrypt or encrypted disk image when stepping away from your workstation so the volume keys are evicted from RAM.
Live Technical References
- Ollama Documentation - Local model runtime, loopback binding, and offline execution configuration.
- llama.cpp Repository & GGUF Guide - High-performance C/C++ local LLM inference and quantization formats.
- Microsoft Presidio Documentation - Open-source PII detection, anonymization, and reversible redaction framework.
- OWASP Top 10 for LLM Applications - Authoritative threat taxonomy covering prompt injection and sensitive data disclosure.
- NIST AI Risk Management Framework (AI RMF) - Federal guidance on privacy, security, and risk governance for AI systems.
- SQLCipher Documentation - Transparent, 256-bit AES encryption for SQLite database files at rest.
- VeraCrypt Documentation - Cross-platform encrypted containers and full-disk encryption for sensitive archives.
- EFF Surveillance Self-Defense - Practical operational security, disk encryption, and threat-modeling guides for individuals.
- Linux unshare(1) Manual - Kernel network namespace isolation for running offline processes with zero external NICs.
- Gitleaks Secret Scanner - Automated scanning to detect leaked API keys and credentials in local repositories.