# LLM-powered data classification for data entities at scale

[Grab](https://yomu.fyi/company/grab) · Hualin Liu · Jul 15, 2024

**Type:** Problem & solution

## Summary

Grab needed to classify sensitive data at the table and column level across petabytes of database tables and streaming schemas. Manual schema-tiering campaigns had resulted in half of all schemas receiving overly strict Tier 1 access controls, while an initial automated service using regex patterns and third-party machine learning produced high false-positive rates and lacked customizability. To address this, the Caspian data engineering and governance teams enhanced their internal orchestration service, Gemini, by integrating GPT-3.5 via Azure OpenAI. Gemini aggregates classification requests into mini-batches, handles API rate limits, and uses prompt engineering—including few-shot examples, curated tag libraries, and explicit JSON DTO schemas—to reliably tag columns for data owner verification.

## Context

Manual sensitivity tagging caused half of all schemas to be locked down under strict Tier 1 access controls due to a few sensitive tables, while regex and third-party ML classifiers suffered from high false-positive rates and limited customizability.

## Approach / What changed

Grab enhanced its internal orchestration service, Gemini, to batch scan requests, enforce API rate limits, and send table and column metadata to GPT-3.5 using structured prompts, curated tag definitions, and few-shot JSON formatting.

## Takeaways

- Schema-level sensitivity tagging overly restricted access because a single Tier 1 table caused an entire schema of hundreds of tables to inherit the strictest access controls.
- Gemini relies on message queues to aggregate scanning requests into mini-batches and applies workflow-level rate limiting to adhere to Azure OpenAI limits of 240K tokens per minute.
- Prompt engineering techniques such as providing JSON DTO schemas, few-shot examples, and explicit default fallback tags (<None>) ensure the LLM returns structured, machine-parseable classifications.

**Tags:** [Architecture](https://yomu.fyi/topic/architecture), [Data Pipelines](https://yomu.fyi/topic/data-pipelines), [LLMs](https://yomu.fyi/topic/llm), [Privacy](https://yomu.fyi/topic/privacy), [Scalability](https://yomu.fyi/topic/scalability)

[Read original post](https://engineering.grab.com/llm-powered-data-classification)
