Inspiration

Documents like contracts, invoices and medical or HR files are full of useful information, but also of sensitive data. Cloud AI is very good at extracting that information, yet sending the original document means exposing names, emails and phone numbers. We wanted to keep the power of cloud AI without giving up control of the original data.

What it does

TrustExtract is a privacy-first document intelligence app. The user uploads a PDF, and a local model detects the sensitive data and replaces it with pseudonyms. In Privacy Lens, the user reviews and approves what will leave the device. Only the approved, pseudonymized text goes to Gemini, which returns a structured response. The original values are then restored locally, and the result can be exported as PDF or JSON. The original PDF and the mapping between real values and pseudonyms never leave the device.

How we built it

Local AI: a fine-tuned XLM-RoBERTa model for named entity recognition (NER) that detects sensitive data on the user's device, through a Local AI Companion. Cloud AI: Gemini through Firebase AI Logic, protected by Firebase App Check. Frontend: a web app hosted on Firebase Hosting, with the Privacy Lens review step. Two modes: a Mock Mode for an instant demo, and a Real Mode that uses the Local AI Companion. Testing: 80 automated tests (43 on the frontend, 37 on the Local AI side).

Challenges we ran into

Challenges we ran into Balancing privacy and usefulness: pseudonyms have to hide the data while still leaving the text understandable enough for the cloud model. Restoring the original values correctly after the cloud response, using only the local mapping. Connecting a browser interface to a local AI model. Evaluating honestly, since the local and cloud models are measured separately and not as one end-to-end system.

Accomplishments that we're proud of

A complete working workflow, from PDF upload to exported results. 94.18% reported validation F1 for the local NER model. 96.78% standalone micro-F1 for cloud extraction, on a benchmark of 60 synthetic documents (42 exact matches, 319/319 expected pseudonyms preserved). 80/80 automated tests passing. A user-in-the-loop design: nothing goes to the cloud without approval.

What we learned

What we learned Privacy works best as part of the architecture, not as an add-on. A hybrid approach (local model plus cloud model) combines the strengths of both. Human review stays necessary, and honest evaluation matters more than impressive numbers. How to use Firebase AI Logic, App Check and Hosting together in a real product.

What's next for TrustExtract

Evaluate the full pipeline end to end, on both privacy and accuracy. Support more document types and languages. Make the Local AI Companion easier to install, or run it directly in the browser. Test with real users and improve the Privacy Lens experience. Add more export formats and integrations.

Built With

Share this project:

Updates

Submission history