---
title: "Optimizing LLM prompts for low latency"
description: "incident.io cut latency of an LLM prompt that plans Grafana dashboards for incident investigations from 11s to under 2.3s without changing its behaviour, mainly by shrinking output tokens."
url: "https://swe.quest/articles/optimizing-llm-prompts-for-low-latency-a98e3093827ae50c"
canonical: "https://incident.io/blog/optimizing-llm-prompts"
source: "incident.io"
published: "2025-03-25"
difficulty: "medium"
kind: "Case study"
reading_minutes: 9
tags: ["llms","performance","inference"]
---

# Optimizing LLM prompts for low latency

A post on [incident.io](https://swe.quest/sources/incident-io.md), published 2025-03-25, 9 min read, Case study. Original: [https://incident.io/blog/optimizing-llm-prompts](https://incident.io/blog/optimizing-llm-prompts)

## Summary

incident.io cut latency of an LLM prompt that plans Grafana dashboards for incident investigations from 11s to under 2.3s without changing its behaviour, mainly by shrinking output tokens. Dropping JSON reasoning fields halved output tokens (315 to 170) and saved about 40% latency. Replacing JSON dashboard definitions with a compact custom format cut input from 15k to 2k tokens but saved only about 20%. A terse non-JSON output format cut output tokens by a further 70% and latency by 60%, though the team held back from shipping it because models are more familiar with JSON and quality could suffer in subtle ways.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [Inference & serving](https://swe.quest/tags/inference.md) (AI & ML)

## Prerequisites

- LLM API usage ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))
- tokens and tokenization
- structured JSON output

## Keywords

OpenAI, Grafana, incident.io Investigations, structured outputs, JSON

## Related posts

- [We used GPT-4 during a hackathon—here's what we learned](https://swe.quest/articles/we-used-gpt-4-during-a-hackathon-here-s-what-we-learned-8311f49bf32b65c6.md): incident.io · 2023-07-25 · Medium · 9 min read · LLMs, Product engineering
  A two-day hackathon at incident.io prototyped GPT-3.5/GPT-4 features: incident handover summaries generated from full Slack channels, a reply-with-❓ jargon explainer, and natural-language incident filters.
- [Lessons learned from building our first AI product](https://swe.quest/articles/lessons-learned-from-building-our-first-ai-product-85b401bfcc88ff2c.md): incident.io · 2024-01-17 · Medium · 12 min read · LLMs, Product engineering, Evaluation
  incident.io built suggested incident summaries with OpenAI: each time a responder posts an update, GPT proposes a new summary from the update, the Slack conversation and the previous summary, and a human accepts, edits or rejects it.
- [Break chatbot speed limits with speculative tool calls](https://swe.quest/articles/break-chatbot-speed-limits-with-speculative-tool-calls-83dbf2c2a180290f.md): incident.io · 2025-03-25 · Medium · 10 min read · AI agents, LLMs, Performance engineering, Go
  incident.io cut its incident chatbot's response latency by about 50% (saving 2-3s per interaction) by speculatively executing LLM tool calls in both directions.
- [Benchmarking Text Generation Inference](https://swe.quest/articles/benchmarking-text-generation-inference-6c04e8c47131c2d4.md): Hugging Face · 2024-05-29 · Medium · 10 min read · Inference & serving, Performance engineering, LLMs
  Text Generation Inference ships a benchmarking tool that profiles LLM serving across batch sizes, plotting throughput against latency separately for prefill and decode so deployments can be tuned for a workload such as RAG or chat.
- [LLM Cost Optimization: 3 Patterns to Cut LLM Token Spend](https://swe.quest/articles/llm-cost-optimization-3-patterns-to-cut-llm-token-spend-f19f5dd3713227bf.md): Honeycomb · 2026-11-05 · Medium · 9 min read · LLMs, Cost optimization, Observability, AI agents
  LLM token spend is best reduced by using traces to find three waste patterns: repeated input context that doesn't improve results, retry storms and runaway agent loops, and output tokens that don't lift outcomes.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
