---
title: "From RAG to Richness: How Ramp Revamped Industry Classification"
description: "Ramp's former industry classification system combined third-party data, sales-entered information, and customer self-reporting, creating inconsistent, overly broad, and unauditable categories. Precise classification was needed for compliance, portfolio monitoring, sales targeting, and product analytics, despite fuzzy boundaries, sparse data, and no ground truth. Ramp migrated to six-digit NAICS codes and built an in-house Retrieval-Augmented Generation model that embeds business data, retrieves candidate codes, and uses an LLM to select a final prediction. The system evaluates retrieval with accuracy-at-k and final predictions with a hierarchy-aware fuzzy-accuracy metric, while ClickHouse stores knowledge-base embeddings and Kafka logs intermediate results. Deployed guardrails validate output codes, and the model has improved data quality, consistency, auditability, and control over tuning and costs."
---

# From RAG to Richness: How Ramp Revamped Industry Classification

[Ramp](https://yomu.fyi/company/ramp) · Ryne Carbone · Jan 15, 2025

**Type:** Problem & solution

## Summary

Ramp's former industry classification system combined third-party data, sales-entered information, and customer self-reporting, creating inconsistent, overly broad, and unauditable categories. Precise classification was needed for compliance, portfolio monitoring, sales targeting, and product analytics, despite fuzzy boundaries, sparse data, and no ground truth. Ramp migrated to six-digit NAICS codes and built an in-house Retrieval-Augmented Generation model that embeds business data, retrieves candidate codes, and uses an LLM to select a final prediction. The system evaluates retrieval with accuracy-at-k and final predictions with a hierarchy-aware fuzzy-accuracy metric, while ClickHouse stores knowledge-base embeddings and Kafka logs intermediate results. Deployed guardrails validate output codes, and the model has improved data quality, consistency, auditability, and control over tuning and costs.

## Context

Ramp's homegrown industry taxonomy had multiple sources of truth, many-to-many mappings to SIC and NAICS, occasionally incorrect or overly generic categories, inconsistent treatment of similar businesses, and no auditability or interpretability. Teams needed a precise, shared classification system for compliance, portfolio monitoring, sales targeting, product analytics, and communication with external partners.

## Approach / What changed

Ramp migrated industry classification to hierarchical six-digit NAICS codes and built an in-house RAG model. The system embeds business and knowledge-base text, retrieves candidate NAICS codes using similarity scores, and asks an LLM to choose from those recommendations. It uses accuracy-at-k for retrieval, a hierarchy-aware fuzzy-accuracy metric for final predictions, ClickHouse for stored embeddings and retrieval, Kafka for intermediate-result logging, and validation guardrails for output codes.

## Takeaways

- Migrating to NAICS replaced Ramp's 100-plus internal levels and complex many-to-many mappings with a standardized hierarchical taxonomy that supports both precise codes and broader rollups.
- The RAG pipeline constrains LLM predictions to valid NAICS codes while retaining a multi-stage evaluation approach: accuracy-at-k measures whether retrieval includes the correct code, and fuzzy accuracy rewards partially correct hierarchical predictions.
- Ramp reports improved data quality and classification consistency, plus direct control over tuning, updates, latency, and costs; logged intermediate steps also help distinguish retrieval problems from re-ranking issues.

**Tags:** [ClickHouse](https://yomu.fyi/topic/clickhouse), [Kafka](https://yomu.fyi/topic/kafka), [Retrieval-Augmented Generation](https://yomu.fyi/topic/retrieval-augmented-generation)

- Source: [Ramp](https://builders.ramp.com/post/industry_classification)
- Source URL: https://builders.ramp.com/post/industry_classification
- Ingested by Yomu: 2026-09-01T01:34:20.705Z

[Read original post](https://builders.ramp.com/post/industry_classification)
