Home / AI & GenAI

AI & GenAI

LLM APIs, RAG pipelines, vector search and running GenAI in production. 189 posts.

AI & GenAI / Runbook

Sev1: an LLM API key leaked to a public repo and someone is burning your quota

A secret-scanning alert or a sudden token spike shows an Azure OpenAI, OpenAI or Bedrock credential is exposed. Revoke and rotate in minutes without a long outage, confirm abuse from usage logs, contain cost, purge the secret from Git history and move to keyless auth.

4 min readAdvanced

Vector Databases / Troubleshooting

Chroma \"database is locked\" and missing data with several workers: why PersistentClient isn't multi-process safe and how to fix it

A FastAPI app with four Gunicorn workers, or an ingestion job running beside the API, all open the same Chroma directory. Writes fail with "database is locked", some workers don't see new data, and the index occasionally corrupts. Find the processes sharing the directory and move to a single owner.

5 min readIntermediate

Vector Databases / How-to

Moving Chroma from an embedded notebook database to a server: Docker deployment, persistence, access control and health checks

The RAG prototype uses chromadb.PersistentClient inside the app, and now three app instances need the same data. Run Chroma as a server in Docker with persistent storage, connect with HttpClient, put authentication and TLS in front of it, add health checks and backups, and know when to move to something bigger.

5 min readIntermediate

Vector Databases / Runbook

Upgrading Chroma without losing your collections: version pinning, backups, compatibility checks and the export-import fallback

A routine pip install --upgrade moved Chroma across a major version and the app now fails to open its data or talks to the server with the wrong API. Plan Chroma upgrades like database upgrades - pin versions, back up, test on a copy, upgrade client and server together, and keep an export-import path when the on-disk format changes.

5 min readIntermediate

AI & GenAI / How-to

Lessons from the 29 September 2026 Azure OpenAI incident in Sweden Central - multi-region failover with API Management and sensible retries

For about six hours, Azure OpenAI and Foundry requests in Sweden Central failed intermittently. The incident review recommends retries with backoff, BCDR planning and granular monitoring. Put a second region behind API Management with a circuit breaker, keep retries bounded, and measure per-backend error rates.

4 min readAdvanced

Vector Databases / Runbook

Re-embedding a vector index when the embedding model retires - a zero-downtime switch with dual indexes and a recall check

Vectors from different embedding models can't be mixed, so when an embedding model retires (Cohere embed v3 on Foundry is deprecated in November 2026 and retires in February 2027) every document must be re-embedded. Build a second index in parallel, compare retrieval quality on a test set, then switch the query path in one step.

4 min readAdvanced

AI & GenAI / How-to

Stop surprise model upgrades in Azure OpenAI - versionUpgradeOption, the Models API lifecycle fields and a weekly retirement report

When gpt-4o 2024-05-13 retires on 9 December 2026, Standard deployments get auto-upgraded to gpt-5.6-sol. Decide per deployment whether that's what you want with versionUpgradeOption, and use the Models API's lifecycleStatus and deprecation fields to report what's coming - remembering the API's status names don't match the portal's.

3 min readIntermediate

AI & GenAI / How-to

Advisory: adopt an off-the-shelf copilot, extend it, or build your own assistant

Many assistant needs are covered by existing productivity copilots, low-code agent builders or features inside business applications. Compare adopting, extending and building on fit, data access, control, effort and running cost, and build custom only where the use case needs integration, control or behaviour others can't provide.

3 min readIntermediate

AI & GenAI / Checklist

Advisory: threat modelling a GenAI application with the OWASP Top 10 for LLM applications

GenAI apps add new attack paths on top of normal web risks. Draw the data flows, walk through LLM-specific threats such as prompt injection, sensitive data disclosure, excessive agency and supply chain risks, map each to controls, and revisit the model whenever tools, data sources or models change.

3 min readIntermediate

AI & GenAI / How-to

Advisory: which data may go to which model - a data classification policy for GenAI

People paste whatever they have into AI tools unless told clearly what's allowed. Map your data classification levels to approved model endpoints and conditions, enforce the mapping technically where you can, make the rules easy to understand, and review when providers, regions or contracts change.

2 min readIntermediate

AI & GenAI / Checklist

Checklist: testing AI kill switches with regular drills before you need them

An untested kill switch usually fails. Flags are cached for an hour, a background worker ignores them, or nobody has the permission to flip them. Here's a drill checklist to prove each switch works, measure how long it takes, and fix what the drill finds.

3 min readIntermediate

AI & GenAI / How-to

Optimization: getting more from GPUs when fine-tuning - mixed precision, batch sizing, data loading and checkpoints

Fine-tuning jobs often leave GPUs idle while waiting for data or wasting memory on full precision. Profile utilisation first, use bf16 mixed precision, size batches with gradient accumulation, enable gradient checkpointing and parameter-efficient methods when memory is tight, fix the data loader, and checkpoint so spot or preempted capacity is usable.

2 min readAdvanced

AI & GenAI / How-to

Optimization: provider prompt caching - structure prompts so the long, stable part is reused

Most LLM providers can reuse the processed start of a prompt when it repeats exactly, cutting input cost and time to first token. Put static content first and variable content last, keep the prefix byte-identical between calls, check cache hit fields in responses, and know each provider's rules for minimum length, lifetime and pricing.

2 min readIntermediate

AI & GenAI / How-to

Optimization: sharing GPUs on Kubernetes - MIG, time-slicing and bin packing for small models

Small models, embedding services and dev notebooks often use a fraction of a GPU while holding the whole device. Measure real GPU use, partition supported GPUs with MIG for isolation, use time-slicing where isolation isn't needed, pack workloads with node pools and autoscaling, and keep large models on dedicated GPUs.

2 min readAdvanced

AI & GenAI / Runbook

Sev1: a prompt injection worked in production. The incident response runbook

Someone got your assistant to reveal its system prompt, ignore its rules, leak data from retrieved documents or call tools it shouldn't. Contain it, find every conversation affected, judge what was exposed or done, then close the specific hole and the class of problem.

4 min readAdvanced

AI & GenAI / Runbook

Sev1: an AI agent is taking harmful actions. The emergency stop runbook

An autonomous agent is deleting records, sending emails or changing systems it shouldn't. Stop new runs, halt runs in progress, cut its tool credentials, contain the damage, then work out what happened from traces before anything is switched back on.

4 min readAdvanced

AI & GenAI / Troubleshooting

Sev1: apps can't reach Azure OpenAI after a network change. Private endpoint DNS fixes

After public network access was disabled, a hub-spoke change or a DNS server move, calls to Azure OpenAI fail with 403 "public access is disabled", timeouts or name resolution errors. Check what the name resolves to from the app's network, fix the private DNS zone links or forwarders, and test from each spoke.

3 min readIntermediate

AI & GenAI / Runbook

Sev1: Azure AI Search index is full. Indexers fail and new documents never appear

Indexer runs fail with storage or quota errors, vector uploads are rejected, and the RAG assistant stops learning new content. Confirm which limit you hit (total storage, vector index size or document count), buy time, then add partitions, shrink the vector footprint or move to a bigger tier.

3 min readIntermediate

AI & GenAI / Troubleshooting

Sev1: inference pods stuck Pending with 'Insufficient nvidia.com/gpu'

New model replicas never start and the scheduler says no node has GPUs, even though GPU nodes exist. Check whether GPUs are advertised, whether taints and selectors match, whether the device plugin or GPU operator is broken, and whether the node pool can scale at all.

3 min readIntermediate

AI & GenAI / Runbook

Sev1: LLM calls fail after a model version was retired or auto-upgraded

Production calls suddenly return deployment or model-not-found errors, or behave differently overnight. The model version reached its retirement date or was auto-upgraded. Restore service on a supported version fast, then put lifecycle tracking in place so it doesn't surprise you again.

3 min readIntermediate

AI & GenAI / Troubleshooting

Sev1: managed model endpoint times out after idle periods or scale-out (Azure ML, SageMaker)

Requests to a custom model endpoint fail with 408/504 or upstream timeouts in the morning or during traffic spikes, then recover. New instances are loading a large model while traffic is already routed to them, or the endpoint scaled in too far. Fix minimum capacity, timeouts, readiness checks and autoscale rules.

3 min readIntermediate

AI & GenAI / Runbook

Sev1: passwords, keys or personal data found in LLM prompts, logs and traces

Someone notices API keys, passwords or customer personal data in prompt logs, tracing tools or evaluation datasets. Stop new capture, rotate exposed secrets, find and purge every copy (logs, traces, caches, evaluation sets, provider-side storage), and fix the pipeline so sensitive data is redacted before it's written.

4 min readAdvanced

Vector Databases / Runbook

Sev1: RAG answers got much worse after a re-index. Finding what changed and rolling back

After a re-index, pipeline change or data refresh, the assistant says "I don't know" far more often or cites the wrong documents. Compare retrieval before and after, find the change (chunking, embeddings, filters, missing documents), roll back with an index alias, and add a retrieval gate to the pipeline.

4 min readAdvanced

AI & GenAI / Troubleshooting

Sev1: the LLM step in a production workflow starts returning invalid JSON

A pipeline that parses model output (ticket classification, extraction, routing) starts failing on JSON parse or schema validation errors. Find whether it's truncation, model change, prompt drift or input size, switch to schema-enforced output, and add validation, retries and a dead-letter path.

3 min readIntermediate

AI & GenAI / Troubleshooting

Sev1: time to first token jumps from 300 ms to 20 seconds on self-hosted LLM inference

Users wait seconds for the first word, the request queue grows, and GPU utilisation looks fine. Separate queueing from prefill cost from KV cache pressure using vLLM metrics, then apply the fix that matches, whether that's scaling out, limiting long prompts, chunked prefill or prefix caching.

3 min readAdvanced

Vector Databases / Runbook

Sev1: vector database pods OOMKilled and search is down

Qdrant, Milvus or Weaviate pods restart with OOMKilled after the collection grew or a bulk load ran. Get search back by adding memory or moving vectors to disk, slow the ingestion down, then size memory properly with quantization and on-disk indexes.

3 min readAdvanced

Vector Databases / Runbook

Sev1: vector search fails or returns nonsense after an embedding model change

Search throws dimension errors, or still works but returns irrelevant results, after someone changed the embedding deployment, model version or dimensions setting. Find which side changed, restore matching query and document embeddings, and lock the embedding config to the index.

3 min readIntermediate

Vector Databases / Runbook

Transformation: consolidating a standalone vector database into PostgreSQL with pgvector

Small and medium RAG workloads often run a separate vector database next to a PostgreSQL that already holds the metadata. Moving vectors into pgvector removes a system to operate and enables joins and transactional updates. Check the fit, design the table and HNSW index, bulk load, verify recall and switch reads.

4 min readAdvanced

AI & GenAI / How-to

Transformation: extending an existing MLOps platform to support LLM applications

Teams with a working MLOps platform for classic models don't need a second platform for LLM apps. Reuse the registry, pipelines and monitoring, and add what's missing - prompt versioning, evaluation datasets and judges, tracing, and token cost tracking - with a release gate that works for both.

3 min readAdvanced

AI & GenAI / How-to

Transformation: from a single-prompt workflow to a bounded agent using MCP tools

An incident-summary script that pastes logs into one prompt hits limits fast. Turn it into a bounded agent that fetches what it needs through MCP tools. Start read-only, cap steps and tokens, log every tool call, require approval for actions, and compare results against the old workflow.

3 min readAdvanced

Vector Databases / How-to

Transformation: from keyword search to hybrid search with a semantic reranker

Upgrade an intranet, help-centre or ticket search from BM25 keyword matching to hybrid search. Add vector fields, run keyword and vector queries together with rank fusion, rerank the top results, and prove the gain with a relevance test set before switching.

3 min readIntermediate

AI & GenAI / How-to

Transformation: from long prompts to a LoRA fine-tuned small model for a narrow task

When a high-volume task needs a long prompt full of rules and examples on a large model, a small model fine-tuned with LoRA can match quality at lower latency and cost. Decide if fine-tuning is the right fix, build a training set from logged outputs, train with PEFT, evaluate against the prompt baseline and serve adapters with vLLM.

3 min readAdvanced

AI & GenAI / How-to

Transformation: from manual ticket triage to LLM-assisted classification and routing

Service desks spend hours reading, categorising and assigning tickets. Use historical tickets to define labels and measure accuracy, classify with schema-enforced LLM output, keep humans in the loop for low-confidence cases, and move from suggest mode to automatic routing step by step.

3 min readIntermediate

AI & GenAI / Runbook

Transformation: migrating from the Assistants API to the Responses API

OpenAI has deprecated the Assistants API in favour of the Responses API with Conversations. Map assistants, threads, runs and vector stores to the new model, rewrite the call path, move conversation state, re-test tool use and file search, and remove the old polling code.

3 min readIntermediate

AI & GenAI / How-to

Transformation: moving bulk LLM jobs from synchronous calls to batch inference

Nightly summarisation, re-classification and embedding backfills often run as loops of synchronous API calls that fight production for quota. Batch inference endpoints take a file of requests and return results within a completion window, at a discount and with separate capacity. Identify candidates, build the JSONL, submit, track, merge results and handle failures.

3 min readIntermediate

AI & GenAI / Runbook

Transformation: moving models from hand-built GPU VMs to managed inference endpoints

Models served from a GPU VM with a Flask app and a cron restart are fragile and hard to scale. Move them to managed online endpoints for health checks, autoscaling, blue/green deployments and built-in monitoring. Package the model, define the deployment, test, shift traffic gradually and retire the VMs.

3 min readAdvanced

AI & GenAI / How-to

Transformation: moving self-hosted LLM inference from FP16 to FP8 or INT4 quantized models

Serving open-weight models at FP16/BF16 uses the most GPU memory per request. Quantizing weights (and optionally the KV cache) to FP8 or INT4 can fit a model on fewer GPUs or serve more concurrent users. Pick the scheme your GPUs support, quantize or use a pre-quantized checkpoint, evaluate quality, load test and roll out behind the gateway.

3 min readAdvanced

AI & GenAI / How-to

Transformation: turning scattered ops runbooks into an on-call knowledge assistant

Runbooks live in wikis, Git repos, old tickets and people's heads. Collect and tag them, index them for retrieval with service and freshness metadata, answer with links to the exact runbook step, surface stale content, and keep the assistant read-only so it guides engineers instead of acting for them.

3 min readIntermediate

AI & GenAI / How-to

Redact PII from LLM prompts and logs with Presidio

Detect and mask names, emails, phone numbers and internal IDs before text reaches an LLM API or your trace store, with reversible placeholders when the answer needs the real values.

6 min readIntermediate

AI & GenAI / How-to

GPU capacity and model quota planning: sizing, reservations and headroom

Plan capacity for GenAI before it becomes an outage. Covers estimating tokens per minute from user numbers, sizing pay-as-you-go quota versus provisioned throughput, sizing self-hosted GPUs from memory and throughput, cloud GPU quotas and reservations, and monitoring headroom.

3 min readAdvanced

AI & GenAI / How-to

Highly available self-hosted LLM inference on Kubernetes

Run vLLM model servers on Kubernetes without single points of failure. Covers multiple replicas across zones, readiness probes that wait for the model to load, PodDisruptionBudgets, autoscaling on queue depth, fast model loading, and rolling updates that keep capacity.

4 min readAdvanced

AI & GenAI / How-to

LLM fallback models and circuit breakers in application code

Keep GenAI features working when a model or provider has problems. Covers a fallback chain of models, circuit breakers, timeouts per stage, which errors to retry, keeping prompts compatible across models, and graceful degradation for users.

3 min readIntermediate

Vector Databases / How-to

Single-VM RAG proof of concept with Ollama and pgvector

Build a private RAG proof of concept on one VM, with a local model served by Ollama and an embedding model, document chunks in PostgreSQL with pgvector, and a small Python script for ingesting and answering questions. Ends with what to change before production.

3 min readBeginner

AI & GenAI / How-to

Standalone LLM server on one GPU with vLLM: install, serve, secure and measure

Stand up a production-minded single-GPU inference server with vLLM. Covers choosing a model that fits, installing drivers and the container, the OpenAI-compatible server, memory flags, a reverse proxy with authentication, systemd, monitoring and load testing.

3 min readIntermediate

Vector Databases / How-to

Vector index DR: rebuild from source, restore a snapshot, or replicate?

Choose a DR strategy for vector indexes by comparing rebuild time, snapshot restore and continuous replication. Includes how to estimate rebuild time from embedding throughput, snapshot commands for common engines, and keeping the embedding model version consistent.

3 min readAdvanced

AI & GenAI / How-to

Handling 429s and latency spikes from LLM APIs

Why token-per-minute quotas trip before request limits do, how to retry with Retry-After and jitter, and when to spread load across regions or move to provisioned throughput.

3 min readIntermediate