AI Glossary · Letter R

Rejection Sampling.

A sampling technique that draws candidate samples from a proposal distribution and accepts or rejects each candidate based on a criterion that ensures the accepted samples come from a desired target distribution. Rejection sampling is used in generative AI to improve output quality, in probabilistic inference for Bayesian models, and in data pipeline design where only samples meeting quality or distributional criteria should be retained.

Also known as acceptance-rejection sampling, Monte Carlo rejection, sample filtering

What it is

A working definition of rejection sampling.

Rejection sampling addresses the problem of drawing samples from a target distribution that is difficult to sample from directly. The algorithm draws a candidate sample from a simpler proposal distribution, then accepts the candidate with a probability proportional to the ratio of the target distribution’s density to the proposal distribution’s density at that point. Candidates in high-density regions of the target are almost always accepted; candidates in low-density regions are usually rejected. The result is a set of accepted samples whose empirical distribution matches the target, achieved without needing to directly sample from the target.

In large language models and other generative AI systems, rejection sampling is applied to improve output quality through a technique called best-of-n sampling or rejection fine-tuning. The model generates multiple candidate outputs for a given prompt, and a reward model or quality classifier evaluates each candidate and accepts only those meeting a quality threshold. The accepted high-quality outputs are then used as training examples for fine-tuning, gradually shifting the model’s output distribution toward higher quality. This approach can improve model quality without requiring human raters to label new examples, instead using the reward model as an automated quality filter.

In Bayesian inference, rejection sampling generates samples from the posterior distribution by drawing candidates from the prior and accepting them with probability proportional to the likelihood of the observed data given the candidate parameter value. This is computationally feasible only when the prior is not too different from the posterior, meaning the acceptance rate is not too low. For complex models where the prior and posterior are very different, more efficient sampling algorithms such as Markov Chain Monte Carlo or variational inference are preferred over rejection sampling.

Why ad agencies care

Why rejection sampling principles appear in AI content generation pipelines and quality control workflows.

A working ad agency using generative AI for copy production, image generation, or content creation is implicitly applying a form of rejection sampling every time it reviews AI outputs and selects only those meeting quality standards. Formalizing this as systematic rejection sampling, with defined acceptance criteria and automated pre-screening, transforms an ad hoc review process into a quality-controlled production pipeline. Understanding rejection sampling also explains why generating multiple candidates and selecting the best one is a straightforward way to improve AI output quality without retraining the model.

Generating multiple AI copy variants and selecting the highest-quality subset is best-of-n sampling in practice. When a language model generates 5 copy variants for a given brief and a quality scorer selects the best 2 for human review, this is rejection sampling from the model’s output distribution using the quality score as the acceptance criterion. The expected quality of the best-of-n sample improves with n: generating 10 variants and selecting the top 2 typically produces better output than generating 2 variants and selecting both, because a larger candidate pool is more likely to contain at least one high-quality sample. The cost is n times the generation cost, which is often worthwhile when generation is cheap and human review is expensive.

Rejection sampling in synthetic data generation ensures that generated examples match the desired distribution for model training. A synthetic data generation process that produces examples from a broad generative model can use rejection sampling to filter the generated examples to match a specific distribution required for model training. For example, generating synthetic ad copy and rejecting examples that do not meet minimum quality standards, desired topic distributions, or brand voice criteria produces a training set that is representative of the target use case rather than the full generative model’s output distribution. This controlled synthetic data generation can supplement scarce labeled data for specialized training tasks.

Quality gate pipelines in AI-assisted production workflows implement rejection sampling at the process level. A content production pipeline that routes AI-generated copy through automated quality scoring, brand voice checking, and compliance screening before human review is implementing a multi-stage rejection sampling process. Each stage is an acceptance criterion: copy that passes the quality score threshold, matches the brand voice profile, and clears compliance checks advances to human review; copy that fails any stage is rejected and returned for revision. Designing these quality gates with well-calibrated acceptance thresholds is the operational challenge that determines whether the pipeline efficiently routes work to human review or generates excessive false positives and false negatives.

In practice

What rejection sampling looks like inside a working ad agency.

An agency builds an AI copy generation system for an insurance client that produces 200 to 300 email copy variants per campaign for testing and personalization. Each variant must pass three quality criteria before advancing to creative review: a readability score between Flesch-Kincaid grade 7 and 10, a compliance check verifying that no prohibited claims or unqualified superlatives are present, and a brand voice alignment score above 0.72 on a 0 to 1 scale from the client’s brand voice classifier. The generation pipeline requests 5 candidates per desired variant, applies the three quality filters in sequence (readability first as cheapest, compliance second, brand voice last as most expensive to compute), and accepts the first candidate passing all three filters. If no candidate passes, the pipeline generates 5 more and repeats up to 3 rounds before flagging the brief for human revision. The acceptance rate per candidate across all three filters is approximately 34%, meaning roughly 3 candidates must be generated per accepted variant. For 250 final variants, the system generates approximately 750 candidates in total. Over the course of the first quarter, the pre-screening eliminates 66% of AI-generated copy before human review, reducing the review queue from an estimated 750 items to 250 items. Human reviewers accept 87% of the pre-screened variants without substantive revision, compared to 52% acceptance when reviewing all generated output prior to the rejection sampling pipeline. The three-filter rejection sampling architecture delivers a 3.4x improvement in reviewer efficiency by concentrating human attention on the candidates most likely to meet the final quality bar.

Build the sampling and quality control expertise that turns AI content generation into reliable production pipelines through The Creative Cadence Workshop.

The generative AI foundations module covers sampling methods including rejection sampling and best-of-n generation, and how quality control gates in AI content pipelines apply these principles to maintain standards at scale.