Active learning for LLM training, evaluation, and inference
Which examples should an LLM learn from next?
In this tutorial, I use active learning to choose training examples for a support assistant, then extend the idea to reviewing its answers. The aim is to improve both what it says and when it asks for more information.
Choose the next questions ↗The full active-learning loop
Training, evaluation,
and grounded responses.
- 01 / SelectChoose examplesQuestions and drafts worth reviewing
- 02 / AnnotateGet human feedbackApproved answers and evidence checks
- 03 / UpdateTrain the modelsThe assistant and its evaluator
- 04 / EvaluateMeasure reliabilityAnswer coverage and unsupported claims
- 05 / RespondUse the evidenceAnswer, clarify, or abstain
- 06 / ReviewAudit new draftsFind cases for the next round
Human reviews guide the next update. New development examples feed the loop; the final test stays separate.
01 / One task throughout the essay
The task: improve a support assistant’s answers.
I use a decoder-only language model as a support assistant for a fictional service. Its task is to answer customer questions about refunds and cancellations using the supplied policy. Each reply should apply the relevant rules, give a clear next step, and ask for any missing information.
I include the policy in every prompt and fine-tune the model on examples of good replies. The behavior I want to improve is how it applies the supplied rules, including when to ask a follow-up question. The assistant should also be clear about what it can do: it can explain how to request a refund, but it cannot process one.
The example starts with four reviewed answers about cancellations and renewals. The remaining questions cover refund conditions, missing dates, and duplicate charges. For the first round, I set a budget of two new answers.
To test whether selection helps, I compare uncertainty sampling with uniform random sampling. Both start from the same model and seed examples, receive the same annotation budget, and use the same training procedure. Evaluation uses separate questions that neither strategy can select for training.
Active learning would be useful if it improved the assistant’s answers more than random sampling for the same annotation effort, or reached a quality target with less annotation. That has to be measured after training.
I created the browser examples to explain selection and annotation. Their drafts and token probabilities are illustrative; no LLM runs in the browser. The walkthrough follows selection, annotation, training, and evaluation without running a model in the browser.
The second part extends this workflow to reviewing generated answers and deciding what to release. I use the same policy task to examine when the assistant has enough evidence to answer, when it should ask a question, and when it should abstain.
02 / The policy and example data
What should a correct answer say?
I use the same fictional policy throughout so that each answer can be checked against a clear set of rules. Some questions require the assistant to combine several conditions or recognize an exception.
Lumen service policy
- You may cancel at any time. Cancellation stops the next renewal; access continues until the end of the paid period.
- A normal refund requires a request within 14 calendar days of the initial purchase and no export use. Both conditions must hold.
- Normal renewals are not refundable.
- A confirmed duplicate charge is refunded regardless of age or export use.
- Ask for missing facts. Do not invent exceptions or claim to have processed a refund. Tell eligible customers to contact support with charge details.
“I bought the initial plan eight days ago and have not exported anything. Can I get a refund?”
“Yes. Your initial purchase is within 14 days and you have made no exports, so you are eligible. Contact support with the charge details to request the refund.”
Change one fact, and the answer changes. If an export has been used, the normal refund is unavailable. If the purchase date is missing, the assistant should ask. If the payment is a confirmed duplicate, a separate rule applies.
The seed contains four approved demonstrations: two about cancellation and two about renewals. The eight-question pool is separate. Human-written validation and test cases are also kept apart. These small datasets illustrate the steps. A reliable performance comparison would require more varied, independent examples.
03 / This is the active-learning step
Choose two questions to annotate.
Look through the questions, choose a selection rule, and review the batch it selects. Then write an answer for each selected question. The active-learning step happens before those answers are available.
Experiment 01 / Pool → selection → human answers
Which questions should the reviewer answer?
Write the answers for training.
Write a complete answer using the policy above, or load one of the example answers I prepared. You can edit each answer before approving it for training.
The approved answers join the training set.
Inspect the approved records
Next, train on the expanded dataset. Update the adapter using the expanded training set, then generate new drafts and scores for the remaining questions. This browser exercise ends at annotation; measuring improvement requires training and evaluating the model.
Follow the next training steps ↗What this exercise illustrates
- Each selected question needs a reviewed answer. That answer becomes the training target. The model’s draft is available for inspection, but it is not treated as ground truth.
- Both strategies have the same budget. Both strategies can acquire the same number of answers. They start with the same four demonstrations.
- Uncertainty can miss mistakes. I made P5 a confident error to illustrate this limitation. Its low entropy is a reason to inspect some unselected questions as well.
- Selection changes after training. I score the remaining questions again with the updated model. A question that was uncertain in one round may be easier in the next.
For a study, repeat the comparison across several random seeds and use enough held-out questions to assess whether any improvement is consistent. Report every run and the time spent annotating, since a single favorable comparison can be misleading.
04 / Where does an LLM acquisition score come from?
From token probabilities
to an uncertainty score.
A decoder-only model reads the prompt, then predicts response tokens one at a time. Each new prediction depends on the policy, the question, and the response prefix already generated. The probability of a response is the product of those conditional token probabilities.
Autoregressive response probability
x is the system instruction, policy, and question. y is the response; y<t is its already-generated prefix. T includes the end-of-turn token when emitted.
I use Qwen3-0.6B, a compact causal language model, with thinking disabled for this task. Its size makes it a manageable starting point for trying the loop. Its model card documents the chat-template setting and requires Transformers 4.51 or later.
For each pool question, generate a draft and calculate entropy over the full vocabulary at each response step. Average those entropies to obtain one score per question. I use this average as a simple rule for ranking the questions.
Raw logits → next-token probabilities
Entropy at one response position
Acquisition score for one question
V is the full token vocabulary. Each distribution conditions on x and the generated prefix. Entropy is in bits. The score averages over response positions; it does not use a human answer.
I calculate this from raw next-token logits before temperature, top-k, or top-p transformations. Greedy decoding and the maximum response length stay fixed across rounds and during evaluation of both strategies. The mean includes the end-of-turn prediction if emitted. Capped generations are flagged because different response paths and lengths can change the score.
Experiment 02 / One decoder step
Look at the alternatives before choosing a token.
Question: initial purchase eight days ago, no exports.
Response prefix: “Under the policy, you are…”
Move these illustrative logits. Softmax converts them to a distribution over four hypothetical next tokens. A real model uses its full tokenizer vocabulary.
Next-token distribution
Greedy choice:
What does high entropy tell me?
A model can be uncertain about “eligible” versus “ineligible,” which may reveal a useful policy distinction. It can also be uncertain about “Hello” versus “Hi,” which may have little value for the task. Conversely, a confidently wrong answer can have low entropy. The token lab lets you create both patterns.
Mean token entropy mixes uncertainty about the answer with variation in how it could be phrased. It does not give a calibrated probability of error or predict how much an example will improve the model. I therefore keep a random baseline, check selected batches for similar questions, and evaluate the model after each update. Settles’ survey explains the acquisition perspective; Houlsby and colleagues’ BALD formulation makes the distinction from plain predictive entropy explicit.
Why not just use a chat API’s confidence score?
The reference experiment needs the complete next-token distribution. Text-only responses or a few top-token log probabilities are not enough to compute full-vocabulary entropy exactly. A restricted list changes the calculation unless the missing probability mass and its internal distribution are accounted for. Running an open-weight model provides direct access to its logits.
05 / Prepare the training examples
Here, a label is a complete answer.
In a classification project, a label might be “billing.” Here it is an entire approved response. The reviewer checks policy eligibility, asks for missing facts when necessary, and removes unsupported promises. Some answers take longer to review than others, especially when the question is ambiguous. I therefore track annotation time as well as the number of answers.
Each training example contains the system instruction, policy, customer question, and approved response. The model sees the whole sequence, but the loss is computed only on the response tokens. The prompt provides context and is excluded from the training loss.
Response-only supervised loss
Probability of the human target token
Natural logarithms give loss in nats. The loss is averaged over response tokens for each example, then examples are averaged within an update. System, policy, and question tokens are context, not targets.
The starred response is the human target. Training conditions on its preceding target tokens, not on the model’s earlier draft. The causal-language-model loss shifts predictions by one position, so the last prompt position predicts the first response token.
Use the model’s chat template so roles and turn boundaries are represented consistently. Keep the complete reviewed answer and its end-of-turn marker in the training target. Examples that exceed the model’s context limit need to be handled explicitly so the answer is not silently cut off.
For updates, I use LoRA adapters on the query and value projections, leaving the base model weights frozen. To keep the comparison simple, each round starts a fresh adapter from the same base checkpoint and initialization seed, and trains it on all approved examples acquired so far. This is a full refit of the adapter, not continual training on only the latest batch.
06 / Follow a complete training round
Train on the reviewed answers,
then select the next batch.
I keep two versions of the experiment: one selects questions by uncertainty, and the other selects them at random. Both begin with the same model and reviewed examples. The comparison follows five steps.
- Establish the starting point. Evaluate the base model with the policy in its prompt, then train the initial adapter on the four seed answers. If the base model already meets the task’s requirements, further annotation may not be worthwhile.
- Select questions before collecting answers. Score the unanswered pool for uncertainty sampling. For the random comparison, sample from the same pool without scoring. Give both strategies the same annotation budget.
- Write and review the answers. Give the reviewer the policy and selected questions. Keep the model drafts separate to reduce their influence on the reviewer. Record the time spent and check each answer against the policy before using it for training.
- Update the model. Add the approved answers to that strategy’s training set and remove their questions from its pool. Train a fresh adapter on all approved examples, keeping the base checkpoint, initialization seed, and training settings fixed across strategies.
- Evaluate and select again. Check the updated model on validation questions, then use it to score the remaining pool. Continue the random comparison from its own remaining questions. The next selection must reflect what the updated model has learned.
I would set the annotation budget in advance and keep the final test separate from training, model selection, and stopping decisions. Related conversations and paraphrases should stay in the same data split so that evaluation does not reward memorizing a closely related example.
The small authored datasets explain the workflow. I have not run the full Qwen training experiment for this article, so they do not establish a performance improvement. A study would need representative questions, several runs, and enough independent evaluation cases to assess the result.
07 / Did the selected answers actually help?
Did the assistant’s answers improve?
Evaluate generated replies against three questions: does the answer apply the policy correctly, does it stay within the supplied facts, and does it give the right next step without claiming to have taken an action? Count a reply as a pass only when all three checks pass.
Training loss measures how well the model predicts the approved wording. It is useful for debugging training, but lower loss is not a substitute for a policy-correct answer. Exact string matching is also too strict: several phrasings can satisfy the same policy.
Experiment 03 / Practice the evaluation rubric
Which answer passes all three checks?
Held-out question: “My first payment was ten days ago. I have made zero exports. What should I do to get a refund?”
These responses illustrate the rubric; they are not measured before-and-after model outputs.
For generated replies, have reviewers assess all three criteria and record the results for each answer.
Complete every review before calculating the results. Use a shared rubric and, where practical, have reviewers assess responses without knowing the acquisition strategy or round. Record disagreements and adjudicate them consistently.
At equal effort
Compare held-out pass counts at the same number of newly written answers. Also report annotation minutes when examples differ in difficulty.
At equal quality
Compare how much annotation effort each strategy needs to reach a prespecified validation target. Freeze the decision before the final test.
Plot the actual pass rate against cumulative annotation effort for each run. Include the starting model, per-policy-case results, and the variation across seeds. Keep the final test out of acquisition, adapter selection, and stopping decisions. If uncertainty sampling does not help, inspect redundant selections, confident errors, score sensitivity to wording, and whether the model can learn from the corrections.
08 / Choose which answers to review
Active learning also belongs
on the evaluation side.
So far, I have used active learning to choose questions for training. There is another expensive part of the process: checking the answers the assistant already gives. A fluent reply can misread the policy, overlook a missing fact, or cite a passage that does not support its claim.
For this extension, I keep the same support task and change what the reviewer labels. Each example now contains a question, the available evidence, and a draft answer. The reviewer marks unsupported claims, identifies the relevant evidence, and decides whether the assistant should answer, ask for clarification, or abstain.
Find and learn from failures
Select informative drafts for review, use the labels to improve an evaluator or the assistant, then score the remaining review pool again. This is an active-learning loop.
Estimate performance
Keep the system fixed and select reviews to estimate a metric efficiently. This is active testing. Its selection rule and statistical correction serve a different objective.
If I review only suspicious answers, the fraction that fail is not the assistant’s overall error rate. I use a separate representative sample for that estimate. Kossen and colleagues’ active-testing framework instead accounts for the selection process when estimating performance.
What should the reviewer check?
I separate the answer into factual claims and check each against the supplied evidence. “Supported,” “contradicted,” and “not established” are different labels. A statement can be unsupported here even if it happens to be true elsewhere. A citation is useful only if the cited passage supports the claim.
“You qualify for a refund, and it will arrive tomorrow.”
The eligibility claim may follow from the purchase date and export history. The promised arrival date has no support in the policy. The corrected answer should explain eligibility and the next step without inventing a processing time.
Experiment 04 / Select a review batch
Which two drafts would you check?
The scores below are illustrative evaluator outputs between 0 and 1. Higher means stronger predicted support. They are not calibrated probabilities. Human judgments remain hidden until you select a batch.
The boundary rule selects scores nearest 0.80. The risk rule looks for likely failures. Both use only the scores, not the hidden labels. Random review can expose mistakes neither rule prioritizes.
These labels can train an evaluator to recognize unsupported drafts. A reviewed correction can also join the assistant’s training set. After either model changes, generate fresh scores before selecting another batch. This exercise stops at review; it does not simulate a trained evaluator or a quality gain.
Make the selection match the purpose.
Low support scores may help find failures quickly. Scores near the release threshold may help improve the answer decision. Neither rule guarantees the most useful training examples. In a larger study, I would compare these rules with random selection, check for repetitive cases, and reserve some reviews for random audits.
A confidently wrong draft is particularly useful to study because an uncertainty rule may never select it. I would record the failure type and look for related cases in the development pool, while keeping the final test separate. Xia and colleagues study diverse hallucination selection for summarization; the support-assistant exercise here is a separate construction.
To train a support evaluator, I would give it the question, evidence, and draft as input, with the human support judgment as the target. The target must never appear in its input. For the assistant itself, I would use the reviewer’s corrected answer as the response target, including examples of clarification and abstention. The response-only loss from the earlier section still applies.
What should a human review record contain?
Keep the question, evidence, and original draft together. For each factual claim, record whether it is supported, contradicted, or not established, and identify any supporting passage. Then record the appropriate action, the corrected response, and the time spent reviewing.
For the refund example, the reviewer can mark eligibility as supported and the promised arrival date as not established. The question is still answerable: the correction should explain eligibility and acknowledge that the policy gives no processing time. An answerable question and a supported draft are different things.
09 / Decide what reaches the user
Answer, ask for clarification,
or explain what is missing.
A better evaluator helps only if its judgment changes the response. At inference time, I put a decision step between the draft and the user. It checks the available evidence, any detected conflict, missing customer details, and an evaluator’s support score.
The goal is a specific explanation of the limitation. If the purchase date is missing, the assistant should ask for it. If the documents disagree, it should identify the conflict. If no supplied policy covers the question, it should say so and suggest where to confirm the answer.
Sufficient supporting evidence
Give the answer and connect its claims to the relevant policy passages and customer details.
A necessary fact is missing
Ask a focused question, such as the purchase date or whether an export was used.
The evidence is insufficient or conflicting
Explain the limit and suggest checking an authoritative source or contacting support.
This is a decision about evidence, not a measure of how confident the sentence sounds. Token entropy from the earlier lab describes uncertainty over possible wording. The support score here estimates a different target: whether the particular draft is justified by its evidence. A score of 0.90 should not be called “90% correct” unless calibration has been established on representative data.
Kapoor and colleagues study learning uncertainty estimates from graded answers. Kamath and colleagues study when a question-answering system should abstain, including when questions differ from its training distribution. Both motivate checking the decision empirically.
Experiment 05 / Inspect an answer gate
What changes when the threshold rises?
These eight examples are separate from the review pool above. Change the threshold, then inspect a case. The evidence flags and scores are illustrative detector outputs, including a missed error. Human labels are used only to calculate the metrics and explain failures.
See every decision in this validation exercise
| Case | Score | Decision | Human assessment of draft |
|---|
Try these three cases.
- Start at 0.80 and inspect “A promise the policy never made.” The evaluator gives the draft a high score even though the policy says nothing about a refund arriving tomorrow. The gate releases it. This is an evaluator failure.
- Raise the threshold to 0.95. That draft is now blocked, but several supported answers are also withheld. The threshold changes the balance between coverage and errors.
- Inspect “A missing purchase date.” Lowering the score threshold does not release the draft because a required fact is flagged as missing. A clarification is more useful than guessing.
Can this force the model to admit uncertainty?
The application can enforce a fallback when its checks fail: withhold the draft and return a clarification or abstention. Fine-tuning can also teach the assistant to explain uncertainty naturally. Neither makes the checks infallible. A missed contradiction or a confidently wrong evaluator can still lead to an unsupported answer.
I would train with supported answers, focused clarification questions, and evidence-specific abstentions. Adding “I might be wrong” to an unsupported claim leaves the claim in place. The useful behavior is to withhold it, state what the evidence establishes, and explain what remains unresolved.
Evaluate reliability and usefulness together.
Answer coverage
Unsupported-answer rate
Here, “unsupported” means at least one factual claim is contradicted or not established by the supplied evidence. With no answers released, the unsupported-answer rate is undefined, not zero. I also count answerable questions that receive a clarification or abstention, and separately review whether those fallbacks are appropriate.
The sliders are for exploring a small validation example. For a study, I would choose the evaluator and threshold using development and validation data, freeze them, and report coverage, unsupported-answer rate, unnecessary deferrals, and review time on an untouched representative test set. A small observed error rate needs an uncertainty interval; it is not a reliability guarantee. Results should also be checked across policy cases and new question types.
10 / Connect review to the next update
Keep the draft separate
from the released response.
The assistant can generate a draft internally without showing it to the user. The evidence checks then determine whether to release it, ask for a missing detail, or explain why the available information is insufficient. A withheld draft should stay out of the final response.
- Retain the evidence. Store the question, draft, policy version, and relevant passages together. In this example, the supplied Lumen policy provides the evidence.
- Check the claims. An evaluator compares each factual claim with the evidence and flags contradictions or missing information. I would validate its judgments against human reviews before relying on its scores.
- Select a review batch. Choose drafts from the development pool. Reviewers label unsupported claims, identify supporting passages, and write corrections. Remove reviewed examples before selecting another batch.
- Use the feedback. Support judgments can train the evaluator. Corrected answers, clarification questions, and appropriate abstentions can train the assistant through the same LoRA workflow described earlier.
- Rescore and evaluate. After either model changes, refresh the affected drafts and scores. Choose the answer threshold on validation data, then freeze the generator, evaluator, evidence retrieval, and threshold before the final test.
Human judgments belong in the training targets or evaluation records. They must not be available to the selection rule or answer gate as if they were predictions. I keep evaluator-training, threshold-validation, and final-test examples separate.
The active-learning comparison is whether targeted reviews improve this system more than random reviews at the same human effort. I would compare unsupported-answer rates at matched coverage, or coverage at a prespecified error target, across multiple runs. Simply making the gate more restrictive does not demonstrate a learning benefit.
11 / Count more than the answers
Include the cost of scoring the pool.
To score the pool, the model reads each prompt and decodes a draft. This takes compute before any new answers are written or used for training. Longer policies increase prompt-prefill cost; longer replies add decode steps and change the acquisition score.
Planning calculator / Separate from the eight-question walkthrough
Estimate the effort for one round.
Decode steps are not seconds or FLOPs. EOS can end a draft before the cap. The numbers do not include batching effects, KV-cache memory, hardware throughput, training, or evaluation.
I would record the time spent scoring, annotating, training, and evaluating, along with generated and training token counts. These measurements help explain whether a reduction in annotation effort also reduces the total cost of a round.
The evaluation and inference extension adds retrieval, evidence checking, and claim-review time. Repeated drafts or multiple evaluators add further cost. I would record these separately from generator training and include them when comparing targeted review with random review.
For a larger pool, consider a candidate shortlist, batch diversity, or a cheaper scoring model. Each changes the acquisition policy and needs its own comparison. The connection to the earlier compute essay is direct: reducing annotation effort does not automatically reduce total learning cost.
12 / What the full experiment can answer
Does selecting questions carefully
reduce annotation effort?
That is the question I want this experiment to answer. I use the model’s token probabilities to select questions, collect reviewed answers, and train the adapter on the expanded dataset. I then evaluate the updated assistant on separate questions and repeat the process with the remaining pool.
Careful selection may help cover missing policy cases with fewer annotations. Whether it does depends on the questions selected, the quality of the reviewed answers, and what the model learns from them. Comparing against random sampling at the same budget makes that question testable.
The evaluation extension adds another question: can those reviews improve when the assistant answers? I would look for fewer unsupported replies at comparable coverage, or more useful answers at the same error target. That requires testing the whole system, including the evaluator and its fallbacks.
Then return to the stopping decision: does the next round still justify its human effort and compute?
Reading behind this essay
Ideas to follow further.
The policy, questions, score traces, and browser exercises are original teaching constructions. The support scores are authored examples, not calibrated model probabilities. These exercises do not reproduce the papers’ experiments or claim measured model improvements.
- Settles. Active Learning Literature Survey (2009; revised 2010). Pool-based acquisition and the distinction between selecting supervision and learning from it.
- Houlsby, Huszár, Ghahramani, and Lengyel (2011). Bayesian Active Learning for Classification and Preference Learning. Information gain and why predictive entropy is not the same acquisition objective as BALD.
- Qwen3-0.6B model card. The causal-language-model checkpoint, supported Transformers interface, and non-thinking chat-template setting used in this example.
- Hugging Face Transformers: Chat templates. Consistent role formatting and generation prefixes for instruction-tuned causal models.
- Hu et al. (2021). LoRA: Low-Rank Adaptation of Large Language Models. The adapter approach behind parameter-efficient updates. See the PEFT implementation documentation for configuration details.
- Dossou, Arous, and Cheung (2025). Rethinking Full Finetuning from Pretraining Checkpoints in Active Learning for African Languages. The question of repeated update cost. This essay’s decoder-only assistant and LoRA procedure are a separate teaching setup.
- Kossen, Farquhar, Gal, and Rainforth (2021). Active Testing: Sample-Efficient Model Evaluation. Selecting evaluation labels while accounting for the bias introduced by selection.
- Xia et al. (2024). Hallucination Diversity-Aware Active Learning for Text Summarization. Active selection of diverse hallucinations for annotation. The review exercise here is not a reproduction of HADAS.
- Kamath, Jia, and Liang (2020). Selective Question Answering under Domain Shift. Learning when to abstain and measuring the tradeoff between answered questions and errors.
- Kapoor et al. (2024). Large Language Models Must Be Taught to Know What They Don’t Know. Learning uncertainty estimates from graded answers, rather than assuming a prompted confidence statement is calibrated.