Inspiration

Knowledge workers face an impossible trade-off: leverage the cognitive power of frontier AI models, or protect the confidentiality of their data.

Whether analyzing medical records, reviewing $M&A$ contracts, or parsing proprietary codebases, pasting sensitive source text into third-party cloud models creates unacceptable compliance, regulatory, and exfiltration risks. Yet, manual redaction is an operational bottleneck: it is slow, mentally draining, and prone to human error.

We set out to eliminate this compromise. We envisioned Veil as an air-gapped, local-first intelligence workspace that empowers professionals to interrogate sensitive documents completely offline, while offering a mathematically rigorous, deterministic bridge to safely leverage external cloud models when advanced reasoning is required.


What it does

Veil is a privacy-first document intelligence platform built around two core pillars:

  1. Local Document Intelligence (100% Offline RAG): Users ingest confidential PDFs, TXT, and Markdown files. Veil indexes and embeds the documents locally, enabling conversational question-answering powered by on-device models. Every assertion is backed by verifiable, page-level citations grounded in the source passages: $$\text{sim}(\mathbf{q}, \mathbf{d}_i) = \frac{\mathbf{q} \cdot \mathbf{d}_i}{|\mathbf{q}|_2 |\mathbf{d}_i|_2}$$ where $\mathbf{q}$ is the query vector and $\mathbf{d}_i$ represents on-device embedded document chunks retrieved with zero network egress.

  2. The Privacy Bridge (Air-Gapped Handoff): When users require cloud-scale reasoning, Veil acts as an offline, deterministic de-identification proxy. It identifies sensitive entities $\mathcal{E} = {e_1, e_2, \dots, e_n}$ and applies an injective surrogate mapping: $$M: e_i \mapsto \langle \text{TYPE}_k \rangle \quad \text{such that} \quad e_a = e_b \iff M(e_a) = M(e_b)$$ This preserves structural relationships and relational logic (e.g., <ORG_1> acquired <ORG_2> for <FIN_1>).

Users copy the sanitized prompt via clipboard to any external AI. Once the response is returned, Veil calculates the inverse mapping $M^{-1}$ locally to reconstruct the response with original names and values intact. The lookup table never touches the network or leaves volatile local memory.


How we built it

Veil was architected from day one under a strict Zero-Egress Invariant:

+---------------------------------------------------------------------------------+
| LOCAL MACHINE (Zero Outbound Egress)                                            |
|                                                                                 |
|  [ React UI (Vite + shadcn/ui) ] <----> [ FastAPI Engine (127.0.0.1) ]          |
|                                                    |                            |
|             +--------------------------------------+---------------------+      |
|             v                                      v                     v      |
|    [ Presidio/NER Engine ]                 [ ChromaDB Vectors ]   [ Ollama LLM ]|
|             |                                      |                            |
|             v                                      +---------------------+      |
|   [ Ephemeral Mapping Vault ]                                                   |
+-------------|-------------------------------------------------------------------+
              | (Manual Clipboard Action)
              v
+---------------------------------------------------------------------------------+
| UNTRUSTED EXTERNAL AI (Cloud LLM: ChatGPT / Claude / Gemini)                    |
+---------------------------------------------------------------------------------+
  • Client Layer: React 18, TypeScript, Vite, Tailwind CSS, and shadcn/ui for a high-density, analytical desktop workspace.
  • Core Orchestration: Python 3.11 with FastAPI running on loopback (127.0.0.1).
  • Local AI & Embeddings: Ollama running quantized llama3:8b-instruct for inference and nomic-embed-text for generating 768-dimensional local vector representations.
  • Vector & Relational Storage: Embedded ChromaDB for local cosine-distance retrieval; SQLite for document metadata, message threads, and ephemeral de-identification vault tables.
  • Privacy Engine: Combined Microsoft Presidio with localized spaCy models and custom deterministic RegEx extractors for PII, legal entities, balance-sheet figures, and project codenames.

Challenges we ran into

1. External Model Token Mutation

External frontier LLMs frequently modify placeholder tokens during generation—turning <ORG_1> into <ORG-1>, [ORG_1], or even dropping the suffix entirely. To solve this without guessing, we implemented an exact-token state machine backed by a constrained Levenshtein distance parser: $$\text{lev}(s_1, s_2) \le \tau$$ This reliably snaps mutated placeholders back to active session surrogates while enforcing a strict non-guessing invariant: unrecognized tokens remain intact and are flagged for human review.

2. Contextual Quasi-Identifiers

Direct identifiers (names, SSNs, emails) are straightforward to redact, but quasi-identifiers (unique job titles, specific transaction dates, rare geographical pairings) can allow statistical re-identification. Stripping too much context renders the prompt useless to an external LLM; stripping too little leaks proprietary insights. We spent significant time calibrating our sensitivity profiles to redact entities while preserving syntactic dependencies.

3. Absolute Zero-Egress Enforcement

Modern software ecosystems frequently leak telemetry silently (analytics packages, font CDNs, third-party update checkers). We had to audit every pip and npm dependency, mock internal socket transports, and implement packet-level inspection tests via mitmproxy to prove zero outbound packets leave the local perimeter.


Accomplishments that we're proud of

  • 100% Offline Capability: Veil functions flawlessly in true airplane mode. Ingestion, chunking, indexing, and document QA execute on consumer hardware with zero latency from network calls.
  • Deterministic Reconstruction Fidelity: Achieved 100% token reconstruction accuracy across complex, multi-party legal agreements and balance-sheet prompts without leaking entity dictionaries.
  • Grounding and Citation Verifiability: Eliminated ungrounded hallucinations in local mode by anchoring every completion to source chunks with exact page, paragraph, and byte offsets.
  • Intuitive Human-in-the-Loop UX: Designed a split-pane diff view that highlights detected entities, displays residual risk scores, and lets users approve or modify redactions before clipboard transfer.

What we learned

  • Small Models are Ready for Local RAG: Modern quantized models (such as Llama 3 8B) running locally via Ollama provide more than enough semantic capacity for extraction, summarization, and citation-grounded QA when retrieval context is clean.
  • Privacy is a UX Challenge: Privacy controls fail if they introduce excessive friction. Making de-identification as simple as an automated review gate with a one-click clipboard handoff transforms privacy from a compliance burden into a seamless habit.
  • Relational Preservation Over Anonymization: Traditional anonymization scrambles text irreversibly. Deterministic surrogate tokenization preserves the underlying grammar and mathematical logic, allowing external LLMs to execute complex reasoning over data they cannot decipher.

What's next for Veil

  • Contextual Information Entropy Scoring: Implement an empirical metric to calculate residual re-identification risk based on semantic context entropy: $$\mathcal{R}{\text{residual}} = 1 - \frac{H(T{\text{sanitized}})}{H(T_{\text{raw}})}$$ alerting users when rare contextual phrases might de-anonymize their intent.
  • Native OS Sandboxing: Package Veil into a lightweight desktop runtime (via Tauri/Rust) leveraging OS-level hardware security modules (Apple Secure Enclave / TPM) for mapping-table encryption at rest.
  • Structured Multi-Format Parsing: Expand the local parsing engine to process tabular financial spreadsheets (.xlsx), presentation decks (.pptx), and scanned legal contracts via local, on-device OCR models.
  • Cross-Document Contradiction Engine: Introduce offline multi-document comparative matrices to automatically detect discrepancies across disparate contracts and audit reports.

Built With

Share this project:

Updates

Submission history