AI-Powered Merchant Classification Correction Agent

ramp · Finance · 2025 · source Agentic: yes · promotional bias: low · source-backed · extracted with prompt 0.5.4 (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: Financial transaction merchant classification

Ramp needed to resolve customer-reported merchant classification errors that previously required support, finance, and engineering intervention and scaled with transaction volume.

Constraints:

Architecture

Ramp built an AI agent that takes a customer correction request and constructs context from the transaction card acceptor, merchant category code, extracted receipt names, addresses, line items, and related transaction memos. The LLM uses embeddings, OLAP queries, multimodal RAG, and guardrails to decide whether the request is legitimate and what action is safe. If it acts, the merchant mapping is corrected; if it rejects, a second LLM rewrites the rejection reasoning into plain language for the user. Evaluation evolved from manual review to follow-up/rejection-rate signals and finally an LLM judge, including shadow-mode evaluation before rollout.

Diagram confidence: reconstructed (reconstructed from prose).

flowchart LR
  customer-correction-request["customer-correction-request"] --> context-builder["context-builder"]
  context-builder --> receipt-image-extraction["receipt-image-extraction"]
  context-builder --> olap-query-layer["olap-query-layer"]
  context-builder --> embedding-retrieval["embedding-retrieval"]
  context-builder --> classification-agent["classification-agent"]
  classification-agent --> guardrail-policy["guardrail-policy"]
  classification-agent --> merchant-database["merchant-database"]
  classification-agent --> rejection-explainer["rejection-explainer"]
  classification-agent --> evaluation-loop["evaluation-loop"]
  merchant-database --> evaluation-loop
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
customer-correction-request User-submitted request to fix a merchant classification. context-builder
context-builder Assembles card acceptor, MCC, receipt, memo, embedding, OLAP, and merchant data for the LLM. customer-correction-request, receipt-image-extraction, olap-query-layer, embedding-retrieval, classification-agent
receipt-image-extraction Extracts merchant names, addresses, and line items from related receipt images. context-builder
olap-query-layer Provides rapid analytical context about transactions and merchant records. context-builder
embedding-retrieval Retrieves similar or relevant merchant context for the classification decision. context-builder
classification-agent LLM-backed agent that decides whether the request is legitimate and what action to take. context-builder, guardrail-policy, merchant-database, rejection-explainer
guardrail-policy Limits what the LLM can change based on request and merchant characteristics. classification-agent
merchant-database Ramp merchant records and classification data updated by accepted actions. classification-agent, evaluation-loop
rejection-explainer Second LLM that rewrites rejected-request reasoning in plain language for users. classification-agent
evaluation-loop Manual review, follow-up requests, rejection rates, shadow mode, and LLM judge evaluation. classification-agent, merchant-database

Data flow

A user reports an incorrect merchant classification from a transaction. Ramp builds context from the card acceptor name, MCC, receipts, memos, embeddings, OLAP queries, and related merchant data. The LLM decides whether the requested correction is legitimate and safe under guardrails. Accepted actions update merchant classification data; rejected requests carry reasoning that another LLM rewrites for the frontend. Evaluation data comes from manual samples, repeated requests, rejection rates, shadow mode, and an LLM judge that scores whether changes improved the transaction classification or whether rejections were reasonable.

"The LLM uses three parts of its context to guide this decision:

— article, implied "Transaction card acceptor name and MCC.

“Extracted merchant names, addresses, and line items from related receipt images.”article, stated

Below is part of the rationale provided by our LLM for a user requesting to change a transaction from the "Four Points by Sheraton" hotel to the "Four Points Service Station" gas station."

“We take our primary LLM's rejection reasoning and then use a second LLM to rewrite it in plain language.”article, stated

Why this architecture

Ramp's agent needed more than text generation because merchant correction is an action against financial data. The context builder gives the LLM transaction, receipt, memo, and merchant signals that disambiguate vague card acceptors. Guardrails constrain actions that could corrupt merchant records. A second LLM improves rejected-request UX without changing the primary decision. The evaluation loop escalates from manual review to scalable LLM judging because production volume requires more than spot checks.

4 supporting quotes
“We intelligently build up context for our LLM so that it can make an informed decision.”article, implied
“We put guardrails around what the LLM can do based on the nature of the request and the merchant involved.”article, implied
“Human evaluation is necessary for this problem given its complexity and requirement of Ramp background knowledge.”article, implied
“By using an LLM for evaluation, we can scale to a high number of requests while providing a stronger signal of our agent's success”article, implied

Models used: large language model · LLM judge · second LLM for rejection rewriting · embeddings · multimodal RAG

Scale

Alternatives considered (roads not taken)

Manual customer-support, finance, and engineering handling

Rejected because: It consumed hours per request and scaled with transaction volume.

“In the past, these reports were serviced by a combination of customer support, finance, and engineering teams and would take hours of employee time.”article, stated
“A manual approach to handling these requests simply is not sustainable as we grow.”article, stated

Let the LLM freely update merchant records

Rejected because: Unconstrained actions could corrupt important merchant data.

“We must also limit what the LLM can do. For example, we do not want the LLM to change our Amazon merchant record to have the website www.google.com.”article, stated

Manual evaluation for all production requests

Rejected because: Manual review was useful early but did not scale after rollout.

“Once we started rolling out our agent to more users, we could no longer manually review every request.”article, stated

Show no explanation when the agent rejects a request

Rejected because: Users could not tell whether a request was rejected or failed, nor why it was rejected.

“Initially, we showed nothing, but users were rightfully confused: 1. They could not tell if their request was rejected or was accepted but the update failed.”article, stated

Patterns

tool-use-orchestration (orchestration)

The agent maps a user correction request to an action against merchant data after using contextual tools and guardrails.

“To map a request to an action, we must determine whether the user's request is reasonable.”article, stated
“We solve this problem using an AI agent consisting of a large language model (LLM) backed by embeddings and rapid online analytical processing (OLAP) queries”article, stated

rag-retrieval (retrieval)

Ramp builds multimodal context from receipts, memos, transaction fields, embeddings, and OLAP queries before the LLM decides.

“a large language model (LLM) backed by embeddings and rapid online analytical processing (OLAP) queries, multimodal retrieval augmented generation (RAG)”article, stated
“Extracted merchant names, addresses, and line items from related receipt images.”article, stated

guardrails-io-filtering (governance)

Guardrails limit what merchant-record changes the LLM may make based on request and merchant context.

“We put guardrails around what the LLM can do based on the nature of the request and the merchant involved.”article, stated

llm-as-judge (evaluation)

Ramp uses a judge LLM to evaluate whether accepted actions improved the classification and whether rejections were reasonable.

“In the event of a change, the LLM judge determines whether our agent's LLM action resulted in an improvement according to the user's request.”article, stated
“In the event of a rejection, the LLM judge determines whether the rejection was reasonable.”article, stated

canary-rollout (deployment)

Ramp ran shadow-mode evaluation before taking real actions for customers.

“By "shadow mode", we mean the agent just tells us what it would do instead of taking any action.”article, stated
“We used this to see how our agent would behave on customers' transactions before actually rolling it out to those customers.”article, stated

Tradeoffs

Automate merchant corrections with an agent.

Chose LLM agent with retrieval, OLAP, and guardrails over manual support/engineering process.

Rationale: Manual work took hours per request and could not scale with transaction volume.

“A manual approach to handling these requests simply is not sustainable as we grow.”article, stated
“Instead of waiting for hours for manual human intervention, our customers are unblocked by our agent in less than 10 seconds.”article, stated

Use rich multimodal context for legitimacy decisions.

Chose MCC, receipt image extraction, memos, embeddings, and OLAP over card acceptor name alone.

Rationale: The card acceptor is often too vague, while receipts and memos provide signals about the true merchant/category.

“Here we can see that the LLM uses the MCC, receipt information, and memos as strong signals that the user's request is legitimate.”article, stated

Use an LLM judge for scaled evaluation.

Chose judge model plus operational signals over manual review for every request.

Rationale: The judge provides stronger signal than simple rates and scales to production request volume.

“By using an LLM for evaluation, we can scale to a high number of requests while providing a stronger signal of our agent's success at acting on a user's request.”article, stated

Explain rejections with a second LLM.

Chose plain-language rejection rewriting over showing nothing or exposing raw reasoning.

Rationale: Users needed timely explanation when a request was rejected.

“This will soon be returned to the front end so users get a clear, timely explanation of why their request was rejected.”article, stated

Gotchas (what bit them)

Card acceptor data can be too vague to classify merchants correctly.

Root cause: Payment processors provide limited transaction data, and similar names can refer to different merchants.

Resolution: Add receipt image extraction, memos, MCC, embeddings, OLAP queries, and LLM reasoning over broader context.

“many times the matcher's input is simply not sufficient to make a perfect match.”article, stated
“The original merchant misclassification was likely caused by the acceptor name being (the vague) FOUR POINTS.”article, stated

A correction agent can corrupt merchant records if unconstrained.

Root cause: An LLM action can propose unsafe changes unrelated to the legitimate transaction correction.

Resolution: Put guardrails around allowed changes according to request and merchant context.

“We must also limit what the LLM can do. For example, we do not want the LLM to change our Amazon merchant record to have the website www.google.com.”article, stated

Rejected requests confused users when no explanation was shown.

Root cause: Users could not distinguish rejection from failed update and did not know the reason.

Resolution: Rewrite primary LLM rejection reasoning into plain language for the frontend.

“Initially, we showed nothing, but users were rightfully confused: 1. They could not tell if their request was rejected or was accepted but the update failed.”article, stated
“We take our primary LLM's rejection reasoning and then use a second LLM to rewrite it in plain language.”article, stated

Manual review could not keep up after rollout.

Root cause: The system needed a correctness signal over at least 100 requests per day.

Resolution: Use repeated-request rate, rejection rate, shadow mode, and LLM judge evaluations to scale quality assessment.

“Once we were confident with our agent and began to roll out to more and more customers, we needed an evaluation strategy that satisfied two requirements:”article, stated
“It can evaluate at least 100 requests a day.”article, stated

Evaluation

Ramp evaluated the agent in four stages: manual review, repeated correction requests, rejection rates, and an LLM judge. Shadow mode let the team score what the agent would do before taking real action.

Metrics: manual-review correctness on selected transactions · follow-up correction request rate · request rejection rate · LLM judge improvement/reasonable-rejection score · at least 100 requests per day evaluation capacity · nearly 99% classification improvement according to the judge

3 supporting quotes
“We have evaluated our agent in four phases during development and rollout:”article, stated
“According to our judge, our agent improves nearly 99% of transaction classifications and nearly two thirds of rejections are reasonable.”article, implied
“By "shadow mode", we mean the agent just tells us what it would do instead of taking any action.”article, stated

Outcomes

Ramp frames the system as enabling 100x transaction growth without 100x customer-support staffing, with evaluation designed for at least 100 requests per day.

4 supporting quotes
“Now:** Our agent handles close to 100% of requests”article, stated
“Now:** Our agent handles requests in under 10 seconds”article, stated
“According to our judge, our agent improves nearly 99% of transaction classifications and nearly two thirds of rejections are reasonable.”article, stated
“We have extended the RAG-plus-LLM flow to two other merchant mapping problems:”article, stated