Productionizing LLM-Powered Data Governance with LangChain and LangSmith

grab · Tech · 2024 · source Agentic: no · promotional bias: low · source-backed · extracted with prompt 0.5.6 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: Enterprise data governance metadata and PII classification

Grab needed to automate governance metadata generation and data-entity classification across a large data lake while reducing dependence on third-party classifiers, managing LLM capacity limits, and preserving human verification for sensitive privacy decisions.

Constraints:

Architecture

Metasense V2 decomposes Grab's data-governance classification task into PII and non-PII subtasks, reduces tags from 21 to 8 for the PII model, shortens prompts from 1,254 to 737 words, chunks tables with more than 150 columns, and uses LangChain/LangSmith to manage prompt versions, datasets, evaluations, collaboration, and deployment configuration. Human data owners verify outputs, while monitoring alerts and improvement protocols watch for misclassification drift.

Diagram confidence: reconstructed (reconstructed from prose).

flowchart LR
  data-lake-tables["Data lake tables"] --> table-chunker["Table chunker"]
  data-lake-tables["Data lake tables"] --> metasense-classifier["Metasense classifier"]
  table-chunker["Table chunker"] --> pii-classifier["PII classifier"]
  table-chunker["Table chunker"] --> non-pii-classifier["Non-PII classifier"]
  pii-classifier["PII classifier"] --> langchain-backend["LangChain backend"]
  non-pii-classifier["Non-PII classifier"] --> langchain-backend["LangChain backend"]
  pii-classifier["PII classifier"] --> metasense-classifier["Metasense classifier"]
  non-pii-classifier["Non-PII classifier"] --> metasense-classifier["Metasense classifier"]
  langchain-backend["LangChain backend"] --> langsmith-workspace["LangSmith workspace"]
  langsmith-workspace["LangSmith workspace"] --> evaluation-datasets["Evaluation datasets"]
  metasense-classifier["Metasense classifier"] --> governance-rules["Governance rules"]
  governance-rules["Governance rules"] --> data-owner-verification["Data owner verification"]
  langsmith-workspace["LangSmith workspace"] --> monitoring-alerts["Monitoring alerts"]
  monitoring-alerts["Monitoring alerts"] --> data-owner-verification["Data owner verification"]
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Data lake tables Enterprise data entities and columns requiring governance metadata and sensitivity classification. Table chunker, Metasense classifier
Table chunker Splits very wide tables into smaller classification inputs. Data lake tables, PII classifier, Non-PII classifier
Metasense classifier LLM-powered system that generates governance tags and classifications. Data lake tables, PII classifier, Non-PII classifier, Governance rules
PII classifier Simplified prompt/model path focused on personal-data tags. Table chunker, Metasense classifier, LangChain backend
Non-PII classifier Separate model path for remaining tag types after decomposition. Table chunker, Metasense classifier, LangChain backend
LangChain backend Chains interoperable components from raw table input to classification output. PII classifier, Non-PII classifier, LangSmith workspace
LangSmith workspace Prompt management, evaluation datasets, collaboration, metrics, and prompt version deployment. LangChain backend, Evaluation datasets, Monitoring alerts
Evaluation datasets Testing/training examples built from table owner feedback and Data Governance Office classifications. LangSmith workspace
Governance rules Privacy rules that combine with column tags to determine data sensitivity tiers. Metasense classifier, Data owner verification
Data owner verification Human review step for preventing misclassification in sensitive governance decisions. Governance rules, Monitoring alerts
Monitoring alerts Periodic misclassification monitoring and threshold-based alarms with improvement protocols. LangSmith workspace, Data owner verification

Data flow

Data lake tables and columns enter Grab's metadata generation workflow. Metasense chunks oversized tables, sends PII and non-PII classification subtasks through LangChain-backed prompts, and records results as governance tags that combine with privacy rules to determine sensitivity tiers. LangSmith stores prompts and evaluation datasets, lets data scientists iterate prompt versions in commit mode, exposes accuracy/latency/error metrics, and supports deployment by swapping prompt identifiers in service configuration. Data owners verify outputs and monitoring alerts trigger improvement protocols when misclassification thresholds are crossed.

3 supporting quotes
“Task decomposition: Split the model into two parts—one for PII tags and another for all other tag types.”summary, stated
“Tables with more than 150 columns are split into smaller tables, ensuring the LLM has sufficient capacity to focus on each column.”summary, stated
“Data scientists can create, update, and evaluate prompts directly on the LangSmith user interface and save them in commit mode.”summary, stated

Why this architecture

Grab's architecture manages LLM capacity by reducing task complexity before asking the model to classify data. Splitting PII from non-PII, shortening prompts, reducing tag space, and chunking wide tables all make the classification problem smaller. LangSmith gives the cross-functional team a shared prompt/eval/deployment workflow, while human verification and alerts acknowledge that governance errors still carry risk.

3 supporting quotes
“The team hypothesized that the core issue was model capacity—when given high volumes of classification tasks simultaneously, the model's effectiveness degraded.”summary, stated
“Reduced the word count in the prompt from 1,254 to 737 words, using clearer and more concise language while removing unnecessary detail.”summary, stated
“Despite achieving "exceptionally low misclassification rates," the team has implemented several safety measures:”summary, stated

Models used: LLM classifier · LangChain · LangSmith

Scale

Alternatives considered (roads not taken)

Third-party data classification services

Rejected because: They restricted customization and required significant resources for custom model training.

“Gemini, relied on third-party data classification services that had restrictions on customisation and required significant resources to train custom models.”summary, stated

One model prompt for all 21 tags

Rejected because: Non-PII tags distracted from the primary PII task and overloaded model capacity.

“13 of them aimed at differentiating types of non-PII data, which distracted from the primary task of identifying PII.”summary, stated

Classify very wide tables in one request

Rejected because: LLM attention/capacity degraded when too many columns were classified simultaneously.

“Input chunking strategies (such as splitting large tables) can help manage LLM context limitations”summary, stated

Fully automated governance without human verification

Rejected because: High-stakes data classification still needs human oversight to prevent misclassification.

“the data pipeline still requires human verification from data owners to prevent misclassifications.”summary, stated

Patterns

workflow-decomposition (architecture)

Grab splits one broad governance classifier into PII and non-PII subtasks and chunks wide tables.

“• Task decomposition: Split the model into two parts—one for PII tags and another for all other tag types. This follows the principle of breaking complex tasks into smaller, more manageable sub-tasks.”summary, stated

eval-driven-development (quality)

Table-owner feedback and Data Governance Office classifications become datasets for model and prompt improvement in LangSmith.

“combined this with manual classifications from the Data Governance Office to create training and testing datasets for model improvements.”summary, stated

observability-tracing (operations)

LangSmith provides prompt versioning, metrics, datasets, and evaluation visibility for the LLM workflow.

“LangSmith serves as the unified DevOps platform for the LLM workflow, enabling collaboration among product managers, data scientists, and software engineers. The integration provides several operational benefits:”summary, stated

human-in-the-loop-gate (governance)

Data owners verify classifications to protect against high-impact governance misclassification.

“Human oversight remains important for high-stakes classification tasks, and systems should be designed to support rather than replace human judgment”summary, stated

safety-policy-enforcement (privacy)

The classifier feeds privacy rules and sensitivity tiers, with alarms when misclassification rates cross thresholds.

“• Threshold-based alarms: Internal alarms trigger if misclassification rates cross defined thresholds”summary, stated

Tradeoffs

Use LLM prompt engineering instead of custom classifier training

Chose LLM-based classification with prompt/task design over Third-party services or resource-heavy custom model training.

Rationale: LLMs offered a more flexible and affordable path for enterprise-scale governance classification.

“The LLM-based approach offered a more affordable and flexible alternative that could scale across the organization.”summary, stated

Shorten and simplify prompts

Chose Concise 737-word prompt over More detailed 1,254-word prompt.

Rationale: Removing unnecessary detail helped model capacity focus on the classification task.

“• Prompt conciseness: Reduced the word count in the prompt from 1,254 to 737 words, using clearer and more concise language while removing unnecessary detail.”summary, stated

Adopt LangChain and LangSmith

Chose Third-party LLMOps collaboration and prompt tooling over Pure custom prompt-management workflow.

Rationale: The tools accelerated experimentation and cross-functional collaboration, with some dependency tradeoff.

“This upgrade was motivated by the need to enable rapid experimentation with prompt versions and facilitate collaboration among a diverse team”summary, stated

Gotchas (what bit them)

Too many classification tags reduce model focus.

Root cause: The model had to discriminate 21 tags, including many non-PII categories unrelated to the primary risk.

Resolution: Split PII/non-PII classification and reduce PII tags to 8.

“the model's effectiveness degraded. The original prompt required the model to distinguish between 21 tags”summary, stated

Wide tables overload LLM attention.

Root cause: Classifying too many columns at once leaves insufficient capacity to reason about each column.

Resolution: Split tables with more than 150 columns into smaller chunks.

“• Input chunking: Tables with more than 150 columns are split into smaller tables, ensuring the LLM has sufficient capacity to focus on each column.”summary, stated

PII can hide in mostly non-PII fields.

Root cause: Business emails, nested JSON, and passenger communications can include legal names, phone numbers, or email addresses amid other metadata.

Resolution: Use feedback-derived edge cases and simplified PII-focused prompts to improve detection.

“Nested JSON structures occasionally containing personal names, phone numbers, and email addresses hidden among non-PII metadata”summary, stated

Evaluation

Grab evaluates with LangSmith datasets and metrics across accuracy, latency, and error rate; monitors misclassification rates periodically; triggers alarms on thresholds; and uses human owner verification for governance-critical outputs.

Metrics: accuracy · latency · error rate · misclassification rate · threshold alarms · data-owner verification

“• Transparent performance metrics: LangSmith's evaluation capabilities allow the team to run evaluations on datasets and obtain performance metrics across multiple dimensions including accuracy, latency, and error rate.”summary, stated
“• Periodic monitoring alerts: Alerts are set up to monitor misclassification rates on a regular basis”summary, stated

Outcomes

Concrete anchors include 20,000+ entries, 300-400 entities/day, 21 to 8 tag reduction, 1,254 to 737 prompt-word reduction, and 150-column chunking threshold.

“Since launch, the model has grown to cover the vast majority of Grab's data lake tables, significantly reducing manual classification workload.”summary, stated
“The specific misclassification rates and accuracy improvements are not quantified in the case study, making it difficult to assess the precise impact of the improvements. Terms like "exceptionally low misclassification rates" are somewhat vague.”summary, stated