Introducing Free-Form Text Anonymization for AI and Machine Learning Workflows
Use Neosync to detect and redact PII in free-form text such as LLM prompts and other workflows
December 13th, 2024
One of the biggest issues for companies these days is figuring out how to protect their sensitive data from ending up in LLMs. In fact, many companies that work with sensitive data have gone so far as to ban LLMs such as ChatGPT, Claude and others from their corporate networks. The fear is that an employee inadvertently sends sensitive data to an LLM as part of a natural language prompt. Once that prompt is sent to the LLM, it's nearly impossible to remove the sensitive data (even if the model provider says that they won't use it in their training data). However, outright banning LLMs means that employees can't take advantage of the power of LLMs to do their jobs more efficiently and effectively. Of course, companies can run their own models but that's difficult and only tenable for a very small subset of companies.
So the question then is - how can companies allow their employees to use LLMs while protecting sensitive data? A possible solution is Named Entity Recognition (NER) models.
Let's jump in.
NER is a subtask of Natural Language Processing (NLP) that aims to identify and classify entities in text. Here are some examples of entities:
NER models are machine learning models that implement NER and can detect and classify these entities in structured and unstructured text. Most NER models come pre-trained with some entities that it can recognize and usually have a way to add on new entities to the training data that you can fine-tune. In the context of LLMs, this means being able to detect and classify text in a prompt that may or may not be sensitive. Let's look at an example in the next section.
Developing an NER model can a pretty complex task but let's break it down into the main steps.
Let's say that you're building an app that transcribes doctor's visits into text and using OpenAI to do summarization. There is a lot of sensitive data (PII & PHI) that gets said in a doctor's visit and before you send that data to OpenAI to summarize, you want to anonymize the sensitive data. In this case, using an NER model is a great to to detect and classify that sensitive data. For example:
For example, in the sentence: "Angela, you're 25 years old, right? I'm going to prescribe you Metformin to help with your high blood pressure."
An NER model would identify:
Person: Angela Age: 25 Medicine: Metformin Diagnosis: High Blood Pressure
In this sentence, the NER model has identified the Person and Age entities which are PII (Personally Identifiable Information) and the Medicine and Diagnosis entities which are PHI (Personal Health Information). Then this gives developers the ability to deal with these entities. They can mask them, redact them or generate synthetic data that looks like it in order to backfill it before it gets sent to the LLM.
Generally NER models are used in free-form text since that's where the most ambiguity about sensitive data arises. Here are some examples of where we've seen NER models being used in the real world:
These are just a few examples, but there are many other use-cases where free-form text is sent to an LLM for summarization, transcription, parsing or some of other operation. In many of those cases, if there is sensitive data at play, it may make sense to use an NER model to identify, classify and redact that data.
If you're working with sensitive data in free-form text, you should consider Named Entity Recognition (NER) models as a way to detect, classify and anonymize that text before sending it to an LLM. Especially in agentic workloads where different agents are passing around prompts and data. As LLMs become even more intertwined into our infrastructures and workflows, it's critical to protect users' sensitive data.
Use Neosync to detect and redact PII in free-form text such as LLM prompts and other workflows
December 13th, 2024
A guide on how to test your data warehouse using Neosync
December 11th, 2024
Nucleus Cloud Corp. 2024