Flaky tests against a model
Telling a flaky test from a real regression, and what to do with the ones you cannot make deterministic.
A test suite that calls a model is flaky by construction. Sampling is random unless you turn it off, and turning it off does not make the provider’s serving stack, its routing, its rate limiter or its model version hold still. So the usual instinct — find the source of nondeterminism and remove it — runs out early here, and what is left is a suite that sometimes goes red for no reason anyone changed.
These pages are about the part after that. How to write an assertion that does not depend on the sampler, how to tell one bad run from a real regression without arguing about it in a pull request, how to price the retries that hide the difference, and what to do with the tests you genuinely cannot make deterministic. Where a page needs a flake rate, it defines the statistic and gives you the query that computes it from your own CI history, because yours is the only one that means anything.
Quarantining a Flaky LLM Test Without Deleting It
A marker convention that keeps a known-flaky model test running and visible while removing its power to block a merge.
9 min read
Retrying a Flaky LLM Test the Right Number of Times
What a retry count actually buys, and the arithmetic showing how quickly it starts hiding a genuine regression rather than noise.
9 min read
Telling a Flaky Test Apart From a Real Regression
A short decision procedure for the judgment call teams make under pressure, using reruns on two commits and evidence from outside your repository.
9 min read
Setting an Acceptable Flake Rate for a Prompt Test Suite
Why a published per-test tolerance is worth more than an argument, and the suite-level arithmetic that shows why the number has to be small.
9 min read
Why the Same Prompt Test Passes Locally and Fails in CI
Six specific causes of a prompt test that is green on your machine and red in the pipeline, and the check that tells you which one you have.
10 min read
Deduplicating Flaky Failures Across a Large Prompt Test Suite
Grouping failures by a normalised root-cause signature instead of by test name, so one provider incident stops looking like forty unrelated bugs.
10 min read
A Flakiness Score for Ranking Which Prompt Tests to Fix First
A derived score that ranks a backlog of unreliable tests by how much trouble each one actually causes, and survives small sample counts.
9 min read
Reducing Flakiness by Testing Properties Instead of Exact Text
The families of assertion that hold across every valid sampling of a model, and what you give up by moving to them.
10 min read
Running a Flaky Test N Times and Requiring K Passes
The majority-vote pattern for a nondeterministic assertion, with the binomial arithmetic for choosing N and K and an implementation in two runners.
10 min read
Isolating Flakiness Caused by the Provider From Flakiness Caused by Your Code
A two-replay diagnostic at the HTTP boundary that tells you which side of the API to debug, and the third category both replays miss.
10 min read
A Dashboard for Tracking Flaky Prompt Tests Over Time
The one table and three queries that turn CI artifacts you already produce into a usable view of which tests are unstable.
9 min read
Bisecting a Prompt Change That Introduced Flakiness
How to run git bisect against a stochastic test without converging on the wrong commit, including the probe arithmetic and the exit codes that matter.
10 min read
Other topics
- LLM fundamentals & architecture
- Tokens, tokenization & context windows
- Prompt engineering
- Reasoning models & test-time compute
- Multimodal AI: vision, audio, video
- RAG & retrieval
- Embeddings & vector search
- AI agents & tool use
- Structured output & function calling
- Fine-tuning & post-training
- Local inference errors, string by string
- Running local models day to day
- Testing code that calls an LLM
- Snapshot and property testing for model output
- Regression suites for prompts
- Eval gates in CI
- Determinism and the cost of testing
- Contract and streaming tests
- Testing tool calls and retrieval
- Inference, serving & latency
- Rolling out a prompt change
- Testing AI systems in practice
- Forecasting a time series
- Machine learning on tabular data
- Geospatial data and models
- Understanding audio that is not speech
- Understanding video
- Core computer vision tasks
- Machine learning on graphs
- Point clouds and 3D
- Evaluation, benchmarks & LLM-as-judge
- Sensor and IoT data
- Logs and event streams
- Models over biological sequences
- Machine learning on molecules
- Embedding and searching code
- Extracting invoices and purchase orders
- Receipts, statements and tax forms
- Insurance policies and contracts
- Deeds, court filings and patents
- Extracting from medical records
- Observability & LLMOps
- CVs, certificates and identity documents
- Shipping, customs and technical documents
- Meetings, email, chat and filled-in forms
- Building an extraction pipeline
- Business, property and inspection documents
- Contract clauses and insurance claims
- Regulated and compliance documents
- Consumer, travel and closing documents
- Mapping one chat API onto another
- SDK and framework migrations
- Hallucination & failure modes
- Re-embedding and model deprecation
- Cutting over between providers
- Parity gaps, shims and legacy endpoints
- Moving between model versions
- Migrating vector stores and caches
- Mapping capabilities and parameters
- Migrating pipelines and agents
- Contracts, runbooks and rollback
- Auditing a codebase before a cutover
- Compliance and fine-tune migration
- LLM cost engineering
- Routing, cost tracking and multi-tenancy
- What a migration does to your prompts
- AI security & prompt injection
- Privacy, compliance & data residency
- AI governance, policy & society
- Building reliable AI applications
- AI hardware, GPUs & compute
- Open-weight models & local inference
- AI for developers & coding agents
- AI in industry: vertical playbooks
- AGI, superintelligence, alignment & the long future
- Machine learning foundations
- NLP fundamentals & classical tasks
- Data engineering for AI
- Synthetic data & dataset curation
- AI product design & UX
- Search, ranking & recommendation
- Enterprise adoption & change management
- AI careers, skills & teams
- Reading AI research
- AI in science & discovery
- Robotics & embodied AI
- AI economics, markets & business models
- AI myths, hype & media literacy
- Context engineering
- Shipping AI features: patterns & anti-patterns
- Build it: end-to-end AI tutorials
- Python for AI: hands-on recipes
- TypeScript, React and the web
- Frameworks and SDKs
- Errors and troubleshooting
- AI facts, numbers and statistics
- The history of AI
- The maths behind AI
- Architectures beyond the transformer
- Reinforcement learning
- Diffusion and generative media
- Speech, audio and voice engineering
- Benchmarks, one at a time
- AI search visibility
- Infrastructure and operations
- Databases and storage for AI
- Knowledge graphs and structured knowledge
- Classical ML in production
- Regulation, jurisdiction by jurisdiction
- Prompt recipes and pattern library
- AI for people who do not write code
- Writing, media and creative work
- Edge and on-device AI
- Interpretability and model internals
- Field notes
- OpenAI model behaviour
- Claude model behaviour
- Gemini model behaviour
- Llama model behaviour
- Mistral model behaviour
- Qwen model behaviour
- DeepSeek model behaviour
- Cohere model behaviour
- Grok model behaviour
- Small model behaviour
- Hybrid model architectures
- Token cost by language and script
- Transliteration, romanization and script handling
- Locale-correct output
- Multilingual generation quality
- Multilingual pipelines
- The EU AI Act, article by article
- AI under the GDPR and EU data law
- US AI regulation, state and sector
- International AI governance and standards
- AI litigation and enforcement
- Running AI workloads on AWS
- Running AI workloads on Google Cloud
- Running AI workloads on Azure
- AI at the edge: Workers, Vercel and Netlify
- Serving models on Kubernetes
- Operating AI infrastructure
- Quantization formats and what they cost
- llama.cpp, flag by flag
- Ollama and the desktop local-model runtimes
- Local models on Apple Silicon
- Hardware for local inference
- Running speech and embedding models locally
- Model files, adapters and conversion
- VRAM arithmetic for local models