AI Agent for Automated Merchant Classification Correction
ramp · Finance · 2025 · source Agentic: yes · promotional bias: med · source-backed · extracted with prompt 0.5.2 (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: Merchant classification correction
Ramp needed a scalable correction workflow for user-reported merchant classification errors that affected expense policies and analytics.
Constraints:
- same source as transaction matching record
- ambiguous merchant identity
- accuracy expectations
- cost pressure
Architecture
Ramp built a merchant-classification correction agent around user-supplied correction requests. A context builder combines card-acceptor fields, MCCs, receipt-derived merchant names/addresses/line items, user memos, and related merchants retrieved by embeddings plus name matching. The primary LLM maps the request to one of a small set of actions, guardrails reject hallucinated or unsafe actions and force retries, a second LLM can rewrite rejection reasoning for users, and evaluation progresses from manual review to follow-up/rejection signals, LLM judging, and shadow-mode testing.
Diagram confidence: explicit (topology described by the source).
flowchart LR correction-request-ui[Correction request UI] --> context-builder[Context builder] context-builder --> related-merchant-retriever[Related merchant retriever] related-merchant-retriever --> merchant-database[Merchant database] context-builder --> primary-llm-decision-agent[Primary LLM decision agent] primary-llm-decision-agent --> guardrail-validator[Guardrail validator] guardrail-validator --> primary-llm-decision-agent primary-llm-decision-agent --> merchant-action-executor[Merchant action executor] merchant-action-executor --> merchant-database merchant-action-executor --> correction-request-ui primary-llm-decision-agent --> rejection-explanation-llm[Rejection explanation LLM] evaluation-harness[Evaluation harness] --> primary-llm-decision-agent
Components
| Component | Role | Interacts with |
|---|---|---|
Correction request UI |
Lets users submit the proposed merchant name, website, and category for a misclassified transaction. | Context builder, Merchant action executor |
Context builder |
Assembles card acceptor data, MCC, receipts, memos, user-supplied correction details, and related merchants for the LLM. | Correction request UI, Related merchant retriever, Primary LLM decision agent |
Related merchant retriever |
Fetches related existing merchants via transaction/merchant embeddings and requested-name matching instead of loading every merchant. | Context builder, Merchant database |
Merchant database |
Stores Ramp merchant records, mapped card acceptors, categories, websites, and logos. | Related merchant retriever, Merchant action executor |
Primary LLM decision agent |
Maps the request and context to create/update/reassign/reject decisions and produces reasoning. | Context builder, Guardrail validator, Rejection explanation LLM, Merchant action executor |
Guardrail validator |
Constrains the LLM to allowed actions and supplied targets, catches hallucinations, and triggers retry. | Primary LLM decision agent |
Merchant action executor |
Applies valid low-impact merchant updates and exposes changes to the front end. | Primary LLM decision agent, Merchant database, Correction request UI |
Rejection explanation LLM |
Rewrites rejection reasoning into clear user-facing language. | Primary LLM decision agent |
Evaluation harness |
Uses manual reviews, follow-up and rejection rates, LLM-as-judge, and shadow mode to evaluate agent success. | Primary LLM decision agent |
Data flow
A user reports a wrong merchant by giving a proposed merchant name, website, and category. Ramp builds LLM context from transaction card-acceptor metadata, receipt/memo evidence, and related merchants fetched by vector and name search. The LLM decides whether to create, update, reassign, or reject; guardrails ensure the selected action and target are allowed, retrying hallucinated responses. If the action changes the merchant classification, the UI updates within seconds; if rejected, another LLM rewrites the reason for user-facing explanation. Evaluation uses manual review early, weak production signals, and an LLM judge at rollout scale.
5 supporting quotes
Why this architecture
Ramp needed more than name matching because payment-processor data is cryptic and user context may be the only disambiguating signal. The architecture keeps the LLM useful by giving it targeted merchant context rather than every record, then boxing actions inside guardrails because changing merchant records incorrectly can affect policy enforcement and customer workflows.
3 supporting quotes
K related merchants.”article, statedModels used: LLM · second LLM for rejection explanation · LLM judge
Scale
- Manual correction time was hours, while the agent unblocks customers in less than 10 seconds.“Instead of waiting for hours for manual human intervention, our customers are unblocked by our agent in less than 10 seconds.”article, stated
- Manual teams handled only 3% of requests in 2023 and 1.5% in 2024, while the agent handles close to 100%.“Before: Customer support and engineering teams were able to service only 3% of requests in 2023 and 1.5% in 2024. As Ramp grows, these percents will only go down.”article, stated
- The LLM judge reports nearly 99% transaction-classification improvement and nearly two-thirds reasonable rejections.“According to our judge, our agent improves nearly 99% of transaction classifications and nearly two thirds of rejections are reasonable.”article, stated
- The LLM-judge evaluation phase was chosen because rollout required evaluating at least 100 requests per day.“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
Alternatives considered (roads not taken)
Manual support/finance/engineering correction for most requests
Rejected because: The workload scales with card transactions and hours-long manual handling could not keep up with growth.
Use only the user-submitted merchant information
Rejected because: The LLM would not know whether an existing merchant record already exists or whether the requested category is reasonable.
Put every Ramp merchant into the prompt
Rejected because: It would not scale and would overload the LLM context window, so Ramp retrieves K related merchants instead.
K related merchants.”article, statedUnconstrained free-form LLM actions
Rejected because: Guardrails require the LLM to choose only supplied actions/targets and retry when hallucinating.
Patterns
human-in-the-loop-gate (workflow)
Users supply corrected merchant information that becomes context for the automated decision.
cost-aware-routing (operations)
The automation replaces expensive manual support with cents-per-request agent execution.
Tradeoffs
Whether to automate near all requests.
Chose agent handling of nearly all reports over servicing only a small percentage manually.
Rationale: Ramp traded manual precision work for an automated path with monitoring and guardrails.
Merchant context retrieval.
Chose two retrieval strategies: embedding similarity plus requested-name matching over only searching by card-acceptor embeddings.
Rationale: Card-acceptor names may differ from actual merchant names, so name matching covers cases embeddings alone would miss.
Evaluation strategy at rollout scale.
Chose LLM-as-judge plus shadow-mode evaluation over manual review of every request.
Rationale: Manual review helped early, but rollout required at least 100 evaluations per day and stronger success signals.
Gotchas (what bit them)
Even knowledgeable humans can struggle with merchant matching.
Root cause: The same text label may correspond to multiple government or local merchants without enough context.
Resolution: Blend user context with model retrieval and guardrails so corrections are not based on name matching alone.
Evaluation
Ramp reports monitoring plus LLM-based assessment of correction quality.
Metrics: 99% improvement rate · under 10 seconds · near 100% request coverage
Outcomes
- Correction handling moved from hours and sparse coverage to near-universal low-latency automation.
Duplicate source URL with the transaction-matching record; framing here emphasizes the correction workflow.