Feedback on a Privacy Middleware for Sending Sensitive Data to LLMs

Reddit r/AI_Agents News

Summary

A concept for a privacy middleware that anonymizes sensitive data before sending to LLMs to protect privacy, with local placeholder mapping, seeking feedback on feasibility.

I’m currently working on a concept for a privacy middleware that sits between an application and an external LLM. The goal is to prevent sensitive or personally identifiable information from being sent to the model while still allowing the LLM to work with the relevant context. The middleware would detect sensitive data locally and replace it with consistent placeholders or anonymized values before the request is sent to the LLM. For example: Original: "Write an email to Max Mustermann at [email protected]." Sent to the LLM: "Write an email to <PERSON\_1> at <EMAIL\_1>." The LLM would then generate its response using the anonymized data. Once the response is returned, the middleware would locally replace the placeholders with the original values: LLM response: "Hello <PERSON\_1>, please contact us at <EMAIL\_1>." Final response: "Hello Max Mustermann, please contact us at [email protected]." The mapping between the placeholders and the original values would remain local and would never be sent to the LLM. This would create an additional privacy layer that could potentially be added to existing applications without requiring major changes to the underlying LLM integration. Possible use cases include names, email addresses, phone numbers, customer IDs, order numbers, medical information, financial data, internal company terms, and sensitive database content. The middleware could also support structured formats such as JSON and XML, as well as documents and longer text passages. A simple regex-based solution would probably not be enough, since many types of sensitive information can only be identified through context. I’m therefore considering a combination of configurable rules, pattern matching, and local NER or language models. Another important aspect would be maintaining consistent placeholders across multiple messages, so the LLM can understand that `<PERSON\_1>` always refers to the same person within a conversation. The local mapping would need to be handled securely, possibly using encryption and strict access controls. The system should also validate the LLM’s response before restoring the original values, since placeholders could be changed, deleted, or misunderstood by the model. Depending on the use case, it might also make sense to replace data with format-preserving synthetic values instead of generic placeholders. I’d be interested in feedback on whether this approach is practical and what potential weaknesses I might be overlooking. In particular, I’m curious about how reliably sensitive data can be detected, how placeholder mappings should be managed, and whether similar open-source projects or existing solutions already address this problem. I would start with just a text file in which i would write down the sensitive data with a the according Tag to retrieve it from that file locally. I’d appreciate any technical feedback, suggestions for improving the architecture, or experiences with privacy gateways, LLM integrations, anonymization, and data loss prevention.
Original Article

Similar Articles

Demystifying the Privacy-Utility Trade-off in LLM Interactions

arXiv cs.AI

This paper analyzes the privacy-utility trade-off in LLM interactions, uncovering underlying mechanisms and introducing an intent-driven local protection framework with a lightweight model to enhance privacy while maintaining response utility.

LLM Anonymization Against Agentic Re-Identification

Hugging Face Daily Papers

AURA is an LLM-powered anonymization framework that balances privacy protection against agentic web-search re-identification while preserving contextual utility through adaptive privacy scopes and mask-reconstruct methods.

Local LLM Peeps

Reddit r/LocalLLaMA

A developer with 45 years of experience is building a local-first harness for LLMs with multi-agent logic, soon to be open-sourced on GitHub, and asks the community what features would improve their local LLM experience.