Book a free call

LLMOps Best Practices: Run LLM Apps Without Surprises

LLMOps covers the unglamorous work that keeps LLM apps running: versioned prompts, tested releases, live monitoring, cost control and guardrails on every output.

Hertiv engineering teamReviewed by a senior engineer
6 min read
LLMOps Best Practices: Run LLM Apps Without Surprises
On this page

Short answer

LLMOps is the set of practices for running large language model applications in production: versioning prompts and models, testing releases before they ship, monitoring answers and costs, and guarding outputs. It turns a demo that works once into a system that behaves the same way every day, with a clear owner when something changes.

What is LLMOps?

LLMOps is the set of practices for running large language model applications in production. It covers versioning prompts and models, testing releases, monitoring answers and costs, and guarding outputs, so the app behaves the same way every day.

It differs from traditional MLOps because the model is often an external service, and the prompt is part of the product. A change to a prompt can change behaviour as much as a change to code, so prompts need the same discipline as code: versions, reviews and tests.

LLMOps matters because LLM apps fail in ways that are hard to see. A model update, a prompt edit or a change in the data can quietly change answers, and without monitoring nobody notices until a customer complains. For the basics, see what LLMOps is.

How do you version prompts and models?

You version prompts and models the same way you version code: every change gets a version number, a review and a test run. A prompt stored in a chat message or a spreadsheet is not versioned, and it will be changed without anyone knowing.

Keep prompts in the same repository as the code, with a version tag on each release. Record which model version each prompt version was tested against, because the same prompt can behave differently on a new model version.

When a model provider releases a new version, treat it as a release, not a patch. Test the current prompts against it, and roll back to the old version if the results are worse. Pin the model version in production so it cannot change under you.

How do you test an LLM app before you deploy it?

You test an LLM app with a fixed set of real prompts and expected answers, run on every release. The test set should cover the prompts users actually send, including the awkward ones, not just the easy cases.

TestWhat it catchesWhen to run it
Golden promptsWrong answers on known casesEvery release
Edge casesBreaks on unusual inputEvery release
Regression setOld behaviour that got worseEvery release
Cost checkToken spend that jumpedEvery release
Guardrail testOutputs that should be blockedEvery release
Human reviewTone and subtle errorsWeekly, on a sample

Automate the tests, but keep a person in the loop. A human reading a sample of outputs each week catches tone and judgement problems that no automatic score shows. For the build steps, see how to implement LLMOps.

How do you monitor an LLM app in production?

You monitor an LLM app by watching its answers, its costs and its failures, not just its uptime. A service can be up and still give wrong answers, so uptime alone tells you almost nothing.

Log every request and response, with the prompt version, the model version and the token counts. Sample the logs daily and read a share of the answers. Track the share of requests that fail, the share that escalate to a person, and the cost per request.

Set alerts on the numbers that matter: a rise in failures, a rise in cost per request, or a rise in escalations. An alert that fires on a real problem is worth more than a dashboard nobody opens. Keep the review short and regular: a daily sample of answers and a weekly look at the numbers is enough for most teams.

How do you control LLM costs?

You control LLM costs by measuring cost per request, then cutting the tokens that add no value. Most teams are surprised by how much spend comes from prompts that are longer than they need to be, or from retries that repeat the same call.

Start with the prompt. Shorten the instructions, drop the examples that do not change the answer, and send only the context the model needs. Then cache repeated prompts, so the same question does not pay for the same answer twice.

Route by difficulty. A small model can handle the easy cases, and only the hard ones need the large model. A router that sends 70 percent of requests to the small model cuts the bill without changing the answers users see.

What guardrails should an LLM app have?

An LLM app should have guardrails on its inputs and its outputs. Input guardrails block prompt injection, abusive content and requests outside the app's scope. Output guardrails check the answer before the user sees it.

Output checks should cover the things that matter for your app: personal data that must not leak, claims that need a source, and answers that should be refused. A check that runs after the model answers is cheaper than a fix after a customer sees a bad answer.

Guardrails need owners and tests. Someone must own the rules, and the test set should include prompts designed to break them. A guardrail that is never tested is a hope, not a control. When a guardrail blocks a request, log the reason, so the team can tell a real attack from a rule that is too strict.

Example (hypothetical): a support bot that stopped surprising its team

Example (hypothetical): a support team runs a bot that answers 1,000 questions a day. Each question takes a person 6 minutes to answer by hand. The bot handles most of them, but 15 percent, or 150 a day, escalate to a person.

The team versions its prompts and adds a test set of 200 real questions. After two weeks of testing, a new prompt version cuts escalations from 15 percent to 8 percent, or 80 a day. That is 70 fewer escalations a day, and at 6 minutes each it saves 420 minutes, or 7 hours a day.

The team also pins the model version and logs every request. When the provider ships a new model version, the tests catch a drop in answer quality before it reaches users, and the team stays on the old version until the prompts are re-tested.

What are the common mistakes?

The most common LLMOps mistakes are unversioned prompts, no test set, and monitoring uptime instead of answers.

  • Unversioned prompts. A prompt changed in a chat message cannot be reviewed, tested or rolled back. Keep prompts in the repository.
  • No test set. Without a fixed set of real prompts, every release is a guess. Build the test set before the first release.
  • Monitoring uptime only. A service can be up and still give wrong answers. Watch answers, costs and escalations.
  • Unpinned model versions. A provider update can change behaviour overnight. Pin the version and test updates first.
  • No cost owner. Token spend grows quietly. Someone must own the cost per request and review it weekly.

If the tooling needs a review, compare the options in the best LLMOps tools for startups.

For the wider picture, see LLMOps vs MLOps.

When the platform needs outside help, talk to a partner for MLOps consulting.

Key takeaways

  • LLMOps is the discipline of running LLM apps in production, not just building them
  • Version prompts like code and pin the model version so nothing changes silently
  • Test every release on a fixed set of real prompts, including edge cases
  • Monitor answers, costs and escalations, not just uptime
  • Guardrails need an owner and a test set, or they are only a hope

Frequently asked questions

What is the difference between LLMOps and MLOps?

MLOps covers the full lifecycle of machine learning models that a team trains and hosts. LLMOps covers LLM applications, where the model is often an external service and the prompt is part of the product. The two overlap on monitoring and testing, but LLMOps adds prompt versioning and guardrails.

Do I need LLMOps for a small LLM app?

Yes, but a light version. Versioned prompts, a small test set and a weekly review of costs and answers is enough for a small app. The practices scale up as the app grows, and starting early is cheaper than adding them later.

How do I test an LLM app when answers vary?

Test with a fixed set of prompts and check the answers against expected outcomes, not exact text. Use a mix of automatic checks, such as format and source checks, and human review on a sample. A test that only checks exact matches will fail on good answers.

What should I monitor in production?

Monitor the share of failed requests, the share that escalate to a person, the cost per request and the token counts. Sample the logs daily and read a share of the answers. Set alerts on the numbers that matter, not on every small change.

How do I keep LLM costs under control?

Shorten prompts, cache repeated questions and route easy cases to a smaller model. Measure cost per request and review it weekly. Most teams find that prompt length and retries are the largest costs, not the model itself.

Who should own LLMOps in a team?

The engineer who owns the app should own LLMOps, with the product owner owning the test set and the guardrail rules. One owner for the whole practice works better than splitting it across teams, because failures cross those lines.

Found this useful? Share it.
Hertiv engineering team

Written from projects we build for clients: AI and agent systems in production. Every post is reviewed by a senior engineer before publishing and updated when practice changes.

About HertivHow we work

Running an LLM app in production and need it steady? Talk to Hertiv.

A senior engineer replies within one business day. Or see our MLOps service.

Book a free call

Keep reading

All posts

Tell us what you want to build

A senior engineer reads every request and replies within one business day with questions, a rough range, or a call link.

  • NDA on request before any details
  • You own all code, models and IP
  • US, UK and EU time-zone overlap

Your email app should open with your message ready to send. If it does not, write to contact@hertiv.com.

Prefer email? Write to contact@hertiv.com
Estimate costBook a call