Building AI Assist: LLM Integration for E-commerce Product Listings

mercari · E-commerce · 2023 · source Agentic: no · 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: Consumer marketplace listing assistance

Mercari wanted to use LLMs to improve seller listing titles while handling user-generated content, substantial live traffic, model cost/latency, inconsistent outputs, hallucination risk, and third-party API behavior.

Constraints:

Architecture

Mercari AI Assist separates title suggestion into an offline GPT-4 attribute extraction path and a real-time GPT-3.5-turbo suggestion path. The team evaluates prompts offline and online, stores key title attributes in a database, preprocesses user-generated prompts, and post-processes model responses before returning output to the client.

Diagram confidence: explicit (topology described by the source).

flowchart LR
  seller[Seller] --> mercari-app[Mercari App]
  mercari-app --> ai-assist-service[AI Assist Service]
  gpt-4-offline-extractor[GPT-4 Offline Extractor] --> title-attribute-database[Title Attribute Database]
  gpt-4-offline-extractor --> offline-evaluation[Offline Evaluation]
  title-attribute-database --> ai-assist-service
  ai-assist-service --> prompt-preprocessor[Prompt Preprocessor]
  prompt-preprocessor --> gpt-3-5-turbo-runtime[GPT-3.5 Turbo Runtime]
  gpt-3-5-turbo-runtime --> response-postprocessor[Response Postprocessor]
  response-postprocessor --> ai-assist-service
  offline-evaluation --> online-evaluation[Online Evaluation]
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Seller Mercari customer creating or improving an item listing. Mercari App
Mercari App Client application that collects listing data and displays AI Assist suggestions. Seller, AI Assist Service
AI Assist Service Backend feature orchestration for title suggestions. Mercari App, Prompt Preprocessor, Title Attribute Database, GPT-3.5 Turbo Runtime, Response Postprocessor
GPT-4 Offline Extractor Higher-quality offline model path that extracts key title attributes from historical data. Title Attribute Database, Offline Evaluation
Title Attribute Database Stores key title attributes identified offline and used during live suggestion generation. GPT-4 Offline Extractor, AI Assist Service
Prompt Preprocessor Prepares prompts containing user-generated content to reduce incorrect or undesired model responses. AI Assist Service, GPT-3.5 Turbo Runtime
GPT-3.5 Turbo Runtime Lower-cost real-time model path that identifies attributes and generates title suggestions. Prompt Preprocessor, Response Postprocessor
Response Postprocessor Ensures only expected output formats reach the client application. GPT-3.5 Turbo Runtime, AI Assist Service
Offline Evaluation Manual and automated evaluation for prompt quality, response quality, token usage, and cost estimates. GPT-4 Offline Extractor, Online Evaluation
Online Evaluation Partial-release live validation for performance and LLM API behavior under traffic. Offline Evaluation

Data flow

Domain experts define what makes a good listing title, GPT-4 distills key title attributes from existing data for storage, the live listing flow sends new user-generated content to GPT-3.5-turbo to identify those attributes and generate title suggestions, and pre/post-processing protects the client from bad prompts and malformed responses.

3 supporting quotes
“The first part, highlighted in blue, involves defining “what makes a good title” for a Mercari listing. This is accomplished with assistance from other teams that possess diverse domain expertise.”article, stated
“utilize GPT-4 to distill the key attributes of an effective title. These key attributes are subsequently stored in a database.”article, stated
“We employ GPT-3.5-turbo to identify key attributes (defined by the previous step) from a specific listing as it is created”article, stated

Why this architecture

The split architecture uses GPT-4 where quality matters and latency is less critical, while using GPT-3.5-turbo for real-time suggestions to balance cost and performance.

“our experiments, we observed that GPT-4 outperforms GPT-3.5-turbo in terms of quality, but it incurs greater costs and latency. Consequently, we found an optimal balance between quality and cost-efficiency by utilizing GPT-4 exclusively for the initial, offline extraction of key attributes,”article, stated
“we found an optimal balance between quality and cost-efficiency by utilizing GPT-4 exclusively for the initial, offline extraction”article, stated

Models used: GPT-4 · GPT-3.5-turbo · commercial LLM APIs

Scale

Alternatives considered (roads not taken)

Use GPT-4 for all real-time operations.

Rejected because: GPT-4 had better quality but higher latency and cost, so Mercari limited it to offline attribute extraction.

“our experiments, we observed that GPT-4 outperforms GPT-3.5-turbo in terms of quality, but it incurs greater costs and latency. Consequently, we found an optimal balance between quality and cost-efficiency by utilizing GPT-4 exclusively for the initial, offline extraction of key attributes,”article, stated

Release the complete feature without a preliminary online LLM test.

Rejected because: The team needed to observe live API behavior and confirm readiness under user-generated traffic.

“partial release, only implementing a small segment of Mercari AI Assist that calls the LLM API, to assess performance and confirm that the complete feature is ready”article, stated

Trust raw LLM output formatting.

Rejected because: Inconsistent response formats increased with request volume, requiring post-processing before client delivery.

“preliminary online test period, we observed that even though we instructed GPT to provide outputs in a straightforward format (YES or NO), the number of inconsistently formatted responses increased along with the number of requests. The table below presents a sampled result from this”article, stated

Patterns

model-routing (model-selection)

Mercari routes quality-sensitive offline extraction to GPT-4 and real-time title suggestion to GPT-3.5-turbo.

“utilizing GPT-4 exclusively for the initial, offline extraction of key attributes, and employing GPT-3.5-turbo for real-time, online operations.”article, stated

cost-aware-routing (model-selection)

The architecture explicitly balances quality, cost, latency, and token usage before release.

“After experimenting with several methods of leveraging LLMs and taking both cost and performance into account”article, stated
“We focus on two main aspects: token usage (length) and response quality. Striking the right balance between these two aspects is crucial.”article, stated

eval-driven-development (evaluation)

Offline and online evaluations gate prompt selection, cost estimation, and live readiness.

“We primarily conduct two types of evaluations to ensure that the quality of outputs returned by the models meets our expectations: offline and online evaluations.”article, stated

structured-output-contract (reliability)

The team tests and enforces simple output contracts such as YES/NO extraction, then adds post-processing when the contract fails.

“we tasked GPT with extracting a single key attribute from an item’s description and to respond simply with “YES” if the attribute is present, or “NO” if it is not.”article, stated

guardrails-io-filtering (safety)

Mercari uses prompt preprocessing and response post-processing around user-generated content and malformed model output.

“preprocess prompts that contain user-generated content to minimize the likelihood of GPT generating incorrect responses.”article, stated
“post-processing logic should be implemented to ensure that only the expected output format is relayed to the client application.”article, stated

Tradeoffs

Model split

Chose GPT-4 offline plus GPT-3.5-turbo online over One model for every step.

Rationale: The split preserves GPT-4 quality where latency matters less and uses GPT-3.5-turbo for the live path.

“we found an optimal balance between quality and cost-efficiency by utilizing GPT-4 exclusively for the initial, offline extraction”article, stated

Feature rollout

Chose Partial preliminary release of the LLM API path over Full release without live API validation.

Rationale: The partial release exposed response-format inconsistency before broad release.

“We found that it is very useful for teams who are not familiar with using LLM in production to perform these kinds of partial preliminary releases”article, stated

Output handling

Chose Preprocessing and post-processing around LLM calls over Directly trusting prompts and model responses.

Rationale: User-generated content and output inconsistencies make raw model interaction unsafe for a client-facing feature.

“It’s essential to preprocess prompts that contain user-generated content to minimize the likelihood of GPT generating incorrect responses.”article, stated
“post-processing logic should be implemented to ensure that only the expected output format is relayed to the client application.”article, stated

Whether to use LLMs at all

Chose Use LLMs for unstructured listing text understanding over Applying LLMs indiscriminately to every task.

Rationale: Mercari explicitly frames LLM use as task-dependent based on cost, objectives, and expertise.

“not everything requires the use of LLMs. Some tasks may be more effectively addressed without them, depending on factors such as cost, objectives”article, stated

Gotchas (what bit them)

Output format drift increased with request volume.

Root cause: Commercial LLMs did not reliably follow the simple YES/NO contract under live traffic.

Resolution: Detect inconsistencies and enforce expected formats with post-processing before sending results to the client.

“even though we instructed GPT to provide outputs in a straightforward format (YES or NO), the number of inconsistently formatted responses increased”article, stated

Hallucinations become harder to detect as output complexity increases.

Root cause: More complex LLM outputs make both inconsistency and hallucination detection harder than simple format checks.

Resolution: Use preprocessing, post-processing, and evaluation as outputs become more complex.

“as we require more complex outputs from LLMs, detecting inconsistencies—as well as hallucinations, a well-known issue with large language models—becomes increasingly challenging.”article, stated

Third-party content moderation can conflict with the product's own moderation system.

Root cause: Provider policy filters may trigger differently from Mercari's internal moderation rules.

Resolution: Understand provider-specific error modes and prepare prompts to avoid undesired outcomes.

“At Mercari, we have our own content moderation system; however, the filtering policy of a third-party API might differ.”article, stated

Token cost depends on language.

Root cause: Japanese prompts and outputs can consume more costly tokenization than English.

Resolution: Include language-dependent token cost in model and prompt design decisions.

“the average cost of prompt and generated tokens in Japanese can exceed that of English by more than double.”article, stated

Evaluation

Mercari combines offline evaluation for prompts, token usage, response quality, manual/automated review, and cost estimation with online partial-release evaluation under live user-generated traffic.

Metrics: Token usage · Response quality · Estimated cost for all users · Live output-format consistency · API performance under traffic

3 supporting quotes
“Offline evaluation serves several purposes, but it mostly helps us to determine the most effective prompt for the task at hand.”article, stated
“Through a combination of manual review and automated evaluation, we ensure that the model’s responses meet our requirements.”article, stated
“This step also allows us to estimate the total cost of deploying the feature to all of our users.”article, stated

Outcomes

The article emphasizes substantial real-time traffic, all-user cost estimation, and Japanese token cost potentially more than double English.

“The design and development of Mercari AI Assist has offered us valuable perspectives on working with prompt engineering and integrating commercially available Large Language Models”article, stated
“dealing with LLM’s stability when used in a live environment, and addressing unique challenges of LLM, such as hallucination and content moderation.”article, stated