
LANGCHAIN — Can Ally Financial Collaborate with LangChain to Ensure Safe and Compliant Masking of Personal Identifying Information through Critical Coding Module?
The Internet is becoming the town square for the global village of tomorrow. — Bill Gates
Ally Financial, a prominent digital-only bank in the US, has collaborated with LangChain to release a critical coding module used for masking personal identifying information (PII) in a safe and compliant manner. The PII masking module, an essential tool for AI developers working with customer PII in regulated industries, provides a starting point for organizations in sectors such as finance, healthcare, and retail to develop generative AI applications while safeguarding customer data.
The Ally.ai platform, built with support from LangChain, plays a pivotal role in summarizing customer interactions for the Ally Customer Care & Experience team. It leverages commercial-grade LLMs to summarize customer calls, but given the regulated nature of the banking sector, it was imperative to strip out PII before the information is summarized.
To achieve this, Ally’s developers created a module for Ally.ai using LangChain software, which effectively masks various forms of PII, such as names, email addresses, and account numbers. The use of LangChain’s framework empowered the Ally team to swiftly solve this critical challenge. The PII Masking module has two-way communication with the LLM, ensuring PII is masked before it’s sent and then rehydrated once the summary or output is received.
Below, we will take a closer look at how the PII Masking module was integrated into the Ally.ai platform and how it provides secure and compliant PII masking.
Integrating PII Masking Module into Ally.ai
The following code snippet demonstrates how PII masking was integrated into the Ally.ai platform using LangChain’s PII Masking module.
// Import the PII Masking module
import { PiiMaskingModule } from 'langchain';
// Create an instance of the PII Masking module
const piiMaskingModule = new PiiMaskingModule();
// Mask PII data before sending it to the LLM
const maskedData = piiMaskingModule.mask(data);
// Send the masked data to the LLM for summarization
// Rehydrate the PII data from the LLM summary
const rehydratedData = piiMaskingModule.rehydrate(summarizedData);In the above code snippet, the PiiMaskingModule from LangChain is imported and used to mask and rehydrate PII data before and after it is sent to the LLM, respectively.
Contributing PII Filtering to LangChain
Additionally, Ally Financial’s developers contributed their code for PII filtering to the LangChain community. This contribution ensures that other financial institutions and companies operating in regulated industries can benefit from the secure PII masking capabilities developed by Ally.
Below is a code snippet showcasing how PII filtering was added to the LangChain codebase.
// Import the PII filtering module from the langchain-community package
import { PiiFilteringModule } from 'langchain-community';
// Create an instance of the PII filtering module
const piiFilteringModule = new PiiFilteringModule();
// Perform PII filtering on the data before sending it to the LLM
const filteredData = piiFilteringModule.filter(data);In this code snippet, the PiiFilteringModule from the langchain-community package is utilized to filter PII data before it is sent to the LLM, ensuring that customer data privacy and security are maintained.
By leveraging LangChain’s PII Masking module and contributing their PII filtering code, Ally Financial successfully addressed the challenges associated with handling customer PII in regulated industries. These code snippets provide a glimpse into how LangChain’s modules can be integrated into AI platforms to ensure the safe and compliant handling of PII.





