Practical Lessons from Deploying LLMs in Production at Scale

mercado_libre · E-commerce · 2024 · source Agentic: no · promotional bias: low · source-backed · extracted with prompt 0.5.6 (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: Enterprise LLM applications for developer documentation, data documentation, and structured extraction

Mercado Libre needed to move LLM applications from impressive prototypes into production use across internal documentation, data-catalog documentation, and natural-language input interpretation, while avoiding hallucinations, poor documentation quality, vague prompts, and overuse of raw LLM calls where structured outputs or simpler preprocessing were better.

Constraints:

Architecture

Mercado Libre explored a portfolio of LLM production applications. For developer documentation, it used Llama Index to build a RAG pipeline that constructs and stores knowledge indexes, retrieves relevant context, and generates answers with source links. For data documentation, it generated table descriptions from table names, field names, field types, and existing technical documentation, then iterated prompts and QA based on table-owner feedback. For natural-language input interpretation, it used function calling so LLMs could extract dates, product quantities, and booking intents into predefined structured outputs instead of prose.

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

flowchart LR
  Internal_documentation_corpus["Internal documentation corpus"] --> Llama_Index_RAG_pipeline["Llama Index RAG pipeline"]
  Llama_Index_RAG_pipeline --> Knowledge_index["Knowledge index"]
  Knowledge_index --> Context_retriever["Context retriever"]
  Context_retriever --> LLM_answer_generator["LLM answer generator"]
  LLM_answer_generator --> Test_query_suite["Test query suite"]
  Test_query_suite --> Documentation_improvement_loop["Documentation improvement loop"]
  Documentation_improvement_loop --> Internal_documentation_corpus
  Data_catalog_metadata["Data catalog metadata"] --> Documentation_generation_prompt["Documentation generation prompt"]
  Documentation_generation_prompt --> Table_owner_QA_workflow["Table-owner QA workflow"]
  Table_owner_QA_workflow --> Prompt_iteration_process["Prompt iteration process"]
  Prompt_iteration_process --> Documentation_generation_prompt
  Natural_language_input["Natural language input"] --> Function_calling_extractor["Function-calling extractor"]
  Function_calling_extractor --> Booking_and_product_workflows["Booking and product workflows"]
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Internal documentation corpus Contains documentation for external tools and Mercado Libre proprietary tools. Llama Index RAG pipeline
Llama Index RAG pipeline Builds indexes, retrieves context, and generates documentation answers with source links. Knowledge index, LLM answer generator, Test query suite
Knowledge index Stores indexed documentation used for context retrieval. Context retriever
Context retriever Retrieves relevant internal documentation for a user question. LLM answer generator
LLM answer generator Generates developer answers from retrieved context and source material. Test query suite, Documentation improvement loop
Test query suite Includes questions the system should answer and questions it should decline or redirect. Documentation improvement loop
Documentation improvement loop Adds or rewrites documentation when testing exposes missing or problem-misaligned source material. Internal documentation corpus
Data catalog metadata Provides table names, field names, field types, and existing technical documentation. Documentation generation prompt
Documentation generation prompt Generates structured table documentation and dynamically adapts to available inputs. Table-owner QA workflow
Table-owner QA workflow Reviews generated documentation, identifies structure/acronym/value issues, and drives prompt iteration. Prompt iteration process
Prompt iteration process Refines prompts into guided, flexible schemas for desired output. Documentation generation prompt
Natural language input Contains product labels, dates, topics, or booking requests expressed by users. Function-calling extractor
Function-calling extractor Maps raw language into structured fields already contained in the input text. Booking and product workflows
Booking and product workflows Use extracted structured values such as expert topic, availability date, or product quantity. Function-calling extractor

Data flow

Internal documentation and tool knowledge are indexed by Llama Index, retrieved in response to developer questions, and passed to the LLM to generate sourced answers. Table metadata and technical documentation feed a documentation-generation prompt that produces draft descriptions for owners to review. Raw user text for products or bookings is passed through function-calling schemas so the model returns structured fields such as item counts, requested topics, and date values. Across these flows, test queries, stakeholder feedback, prompt iteration, and QA loops refine the data and prompts.

4 supporting quotes
“an open-source tool that handles everything from constructing and storing knowledge indexes to providing a primary pipeline for context retrieval and answer generation.”article, stated
“users could pose questions and instantly receive answers, complete with links to source materials for further exploration.”article, stated
“we leveraged the existing documentation of tables, including information about all their fields and technical documentation.”article, stated
“we leveraged the concept of Function Calling, which was first introduced in GPT-3.5 and is also available in many other LLMs”article, stated

Why this architecture

The architecture separates use cases because each LLM failure had a different root. Developer Q&A needed retrieval over proprietary context; table documentation needed better source data and prompt QA; and raw natural language extraction needed structured function-calling outputs. The article repeatedly emphasizes preparing data, narrowing the task, using clear schemas, and iterating prompts and QA rather than treating raw LLMs as a universal solution.

4 supporting quotes
“expecting an LLM to possess intrinsic knowledge about a specific company’s internal matters is not feasible.”article, stated
“The root cause? Our existing table documentation was cursory and lacked depth.”article, stated
“Function Calling provides a great option when you need to use an LLM to extract specific information which is already contained in some text.”article, stated
“It is important to optimize processes, carefully prepare the data, and assess whether simpler and less expensive models can meet the requirements.”article, stated

Models used: GPT-3.5-turbo · GPT-4V · LLaMA 2 · LLMs

Scale

Alternatives considered (roads not taken)

Expect the base LLM to know Mercado Libre internal tools

Rejected because: The article states that company-specific internal knowledge is not available to general LLMs without retrieval context.

“these models typically lack access to proprietary knowledge or internal company data.”article, stated
“expecting an LLM to possess intrinsic knowledge about a specific company’s internal matters is not feasible.”article, stated

Let the RAG system answer even when documentation is missing

Rejected because: User adoption exposed hallucinated or inaccurate responses when the documentation lacked the needed information.

“When the system came across questions without available information, the model often provided answers based on its general knowledge”article, stated
“which sometimes led to inaccuracies or hallucinated responses.”article, stated

Manually document thousands of tables

Rejected because: The scope made manual documentation infeasible and not cost-effective, so the team used LLMs to enrich documentation.

“we had thousands of tables needing documentation.”article, stated
“Tackling this task manually was neither feasible nor cost-effective.”article, stated

Use a static generic documentation prompt

Rejected because: The 10% rejection group showed the need for clearer structure, acronym handling, and conditional behavior based on available inputs.

“Using a generic prompt such as “You’re an expert documenter, please create documentation for table {TABLE_NAME} based on the following elements,””article, stated
“we identified the need to create more guided and flexible prompts, allowing for different levels of information availability”article, stated

Use normal prose generation for extraction tasks

Rejected because: The Data Doctors and product examples needed structured values such as dates, quantities, topics, and agendas, so function calling was better suited.

“How can we manage to make the LLM understand and format the date to use in a query without generating a long sentence explaining the date”article, stated
“Function Calling provides a great option when you need to use an LLM to extract specific information which is already contained in some text.”article, stated

Patterns

rag-retrieval (architecture)

Mercado Libre used Llama Index to retrieve relevant internal documentation and generate sourced answers for developers.

“One common application of Large Language Models (LLMs) is Retrieval-Augmented Generation (RAG). This involves providing a Question-Answering system that generates personalized answers by retrieving and combining information from relevant documents.”article, stated
“It effectively navigates through an index of knowledge based on a user’s query.”article, stated

eval-driven-development (quality)

The team built test queries for answers the system should provide and questions it should avoid, using failures to reveal documentation gaps.

“we started testing the model’s responses to specific queries that we needed to answer accurately, as well as queries we preferred not to respond to.”article, stated
“To address this, we started testing the model’s responses to specific queries that we needed to answer accurately, as well as queries we preferred not to respond to. This process revealed shortcomings in our documentation — certain actions or tools that users inquired about were not covered.”article, stated

data-quality-loop (operations)

RAG failures led the team to improve the underlying documentation rather than only tuning prompts or models.

“This process revealed shortcomings in our documentation — certain actions or tools that users inquired about were not covered.”article, stated
“So, what was the solution? Enhancing our documentation. In some cases, even when the information was present, it lacked direct relevance to the user’s problem.”article, stated

prompt-versioning (operations)

Documentation generation improved through iterative prompt engineering and QA of generated outputs.

“we realized the importance of iterating over them and conducting quality assurance (QA) on the generated outputs”article, stated
“Through this analysis, we identified the need to create more guided and flexible prompts, allowing for different levels of information availability, and following a predefined format on what a good description should look like.”article, stated

structured-output-contract (quality)

Function calling was used to force natural-language extraction into predefined structured fields rather than free-form explanations.

“Function Calling provides a great option when you need to use an LLM to extract specific information which is already contained in some text.”article, stated
“By leveraging this functionality, you can interpret raw text and understand the underlying meaning behind words or numbers, which are retrieved in a more structured manner.”article, stated

context-engineering (architecture)

The team repeatedly narrows and improves model context through retrieval, better documentation, dynamic prompts, and structured inputs.

“for the model to provide accurate answers, the necessary information had to be within its knowledge domain.”article, stated
“By carefully evaluating input and output, providing better context, and using higher-cost models when necessary, companies can optimize the performance of LLMs.”article, stated

cost-aware-routing (operations)

The final guidance explicitly recommends testing whether simpler and less expensive models can satisfy the task before escalating.

“It is important to optimize processes, carefully prepare the data, and assess whether simpler and less expensive models can meet the requirements. If they cannot, then simplify the task for the LLM as much as possible by being clear and handling the intensive data processing outside the model.”article, stated
“By carefully evaluating input and output, providing better context, and using higher-cost models when necessary, companies can optimize the performance of LLMs.”article, stated

Tradeoffs

Use RAG for company-specific developer questions

Chose retrieval over internal documentation over expecting a general LLM to know proprietary tools.

Rationale: RAG bridges the gap between general language ability and Mercado Libre-specific information.

“By retrieving relevant context or information and then generating a response, RAG enables the LLM to provide accurate and pertinent answers to user inquiries, bridging the gap between general knowledge and company-specific information.”article, stated
“By retrieving relevant context or information and then generating a response, RAG enables the LLM to provide accurate and pertinent answers to user inquiries, bridging the gap between general knowledge and company-specific information.”article, stated

Improve documentation after RAG failures

Chose documentation enhancement over only prompt or model tuning.

Rationale: The failures revealed missing or problem-misaligned source data, so better documentation was the real fix.

“This process revealed shortcomings in our documentation — certain actions or tools that users inquired about were not covered.”article, stated
“So, what was the solution? Enhancing our documentation. In some cases, even when the information was present, it lacked direct relevance to the user’s problem.”article, stated

Generate table documentation with LLMs

Chose automated documentation drafts over manual documentation for thousands of tables.

Rationale: The scale was too large for cost-effective manual work, and 90% stakeholder acceptance made automation useful.

“Tackling this task manually was neither feasible nor cost-effective. Our objective was clear: to devise a method for creating accurate, useful, and coherent documentation for each data product, in the most efficient and budget-friendly way possible.”article, stated
“well-received by 90% of our stakeholders.”article, stated

Use function calling for extraction

Chose structured function outputs over free-form text explanations.

Rationale: Operational workflows needed concrete values such as dates and counts, not long natural-language reasoning about them.

“Yet, “next thursday” cannot be directly entered into a calendar; we need a date! How can we manage to make the LLM understand and format the date to use in a query without generating a long sentence explaining the date and its context?”article, stated
“By leveraging this functionality, you can interpret raw text and understand the underlying meaning behind words or numbers, which are retrieved in a more structured manner.”article, stated

Simplify tasks before using expensive models

Chose preprocessing and clear task design over raw high-cost LLM calls for every problem.

Rationale: The final guidance is to prepare data and test simpler options first, escalating only when needed.

“It is important to optimize processes, carefully prepare the data, and assess whether simpler and less expensive models can meet the requirements. If they cannot, then simplify the task for the LLM as much as possible by being clear and handling the intensive data processing outside the model.”article, stated
“simplify the task for the LLM as much as possible by being clear and handling the intensive data processing outside the model.”article, stated

Gotchas (what bit them)

A good RAG prototype hid missing documentation until broader adoption.

Root cause: Early demo queries had enough source context, but users asked about topics not covered in the knowledge base.

Resolution: Build explicit test sets for answerable and non-answerable questions and improve documentation when gaps appear.

“The prototype we developed using Llama Index was initially a resounding success, impressing everyone who saw it.”article, stated
“As we encouraged more users to try the system, we noticed gaps in the documentation. When the system came across questions without available information, the model often provided answers based on its general knowledge, which sometimes led to inaccuracies or hallucinated responses.”article, stated

The model hallucinated when the knowledge base lacked the answer.

Root cause: Without adequate retrieved context, the LLM fell back to general pretraining knowledge for Mercado Libre-specific questions.

Resolution: Constrain answers to contextual knowledge and improve the underlying documentation.

“When the system came across questions without available information, the model often provided answers based on its general knowledge, which sometimes led to inaccuracies or hallucinated responses.”article, stated
“This was our first major learning, albeit an obvious one: the model cannot reliably answer questions beyond its contextual knowledge base. We realized that for the model to provide accurate answers, the necessary information had to be within its knowledge domain.”article, stated

Procedure-oriented documentation did not match problem-oriented user queries.

Root cause: Some documents described processes without explaining why a user would need them.

Resolution: Rewrite documentation so it connects procedures to user problems and contexts.

“Parts of the documentation described processes without explaining why a user might need to perform them, complicating the retrieval process for the RAG system.”article, stated
“Parts of the documentation described processes without explaining why a user might need to perform them, complicating the retrieval process for the RAG system.”article, stated

Table descriptions could not be added to RAG effectively while catalog metadata was shallow.

Root cause: Existing data-catalog documentation lacked depth, relationships, and use cases.

Resolution: Generate richer table documentation from metadata and technical docs, then review it with table owners.

“The responses we received fell short of our expectations. The root cause? Our existing table documentation was cursory and lacked depth.”article, stated
“Only a select few tables had comprehensive documentation detailing their contents, use cases, and inter-table relationships.”article, stated

A generic documentation prompt was not enough for the last 10% of stakeholders.

Root cause: Rejected outputs lacked structure, missed internal acronyms, or worsened already-good documentation.

Resolution: Use guided, flexible prompts with a clear schema and QA questions about behavior and information use.

“it lacked a clear structure for easy understanding, 2) it didn’t include any technical and internal acronyms”article, stated
“Therefore, it is important to have a clear objective and also a clear schema for desired output.”article, stated

Raw text contains values that are semantically obvious to people but ambiguous to simpler parsers.

Root cause: Product labels and booking requests contain dates, quantities, abbreviations, and units that vary in form.

Resolution: Use LLM reasoning with function calling to extract structured values from the text.

“There could be a lot of numbers that might be mistaken for the units of the product. The units might not be standardized, and the label “ct.c/” gives away the amount, but it could also be “pcs” referring to pieces, “u”, “unts”, “amt”, and so on.”article, stated
“The units might not be standardized, and the label “ct.c/” gives away the amount, but it could also be “pcs” referring to pieces, “u”, “unts”, “amt”, and so on.”article, stated

Evaluation

Mercado Libre used practical QA loops rather than a single offline benchmark: RAG was tested against specific queries it should answer and queries it should not answer; generated documentation was reviewed by table owners and then improved based on rejection reasons; and natural-language extraction was framed around whether function-calling outputs matched the structured fields needed by downstream workflows.

Metrics: Answer accuracy on required RAG queries · Correct refusal or non-response on unsupported RAG queries · Documentation coverage and depth · Stakeholder/table-owner acceptance rate · Prompt QA questions about intended behavior and information use · Correct structured extraction of quantities, dates, topics, and agenda values

4 supporting quotes
“To address this, we started testing the model’s responses to specific queries that we needed to answer accurately, as well as queries we preferred not to respond to.”article, stated
“To address this, we started testing the model’s responses to specific queries that we needed to answer accurately, as well as queries we preferred not to respond to. This process revealed shortcomings in our documentation — certain actions or tools that users inquired about were not covered.”article, stated
“Does the generated text behave as intended? Is it using all the information you want it to use? Are we lacking in information for the LLM to create an accurate response?”article, stated
“we were able to generate documentation that was well-received by 90% of our stakeholders.”article, stated

Outcomes

The article reports production-scale context including tools used across Mercado Libre, 4,000 production tables with half inadequately documented, 90% initial table-owner acceptance for generated documentation, and natural-language extraction tasks involving product quantities and Data Doctors booking requests.

6 supporting quotes
“It functioned as an easy-to-use search engine for documentation. However, the initial excitement was short-lived.”article, stated
“This process revealed shortcomings in our documentation — certain actions or tools that users inquired about were not covered. So, what was the solution?”article, stated
“well-received by 90% of our stakeholders.”article, stated
“we found that the 10% who didn’t like our documentation had three main concerns”article, stated
“Function Calling provides a great option when you need to use an LLM to extract specific information which is already contained in some text.”article, stated
“Finally, we would like to emphasize that “raw” LLMs are not a definitive solution for every problem. It is important to optimize processes, carefully prepare the data, and assess whether simpler and less expensive models can meet the requirements.”article, stated