CT-GenAI: Hallucinations, Reasoning Errors and Bias in LLM Testing
Hallucinations, reasoning errors and biases are the three defects that make LLM output on test tasks unreliable: a hallucination invents or misstates content, a reasoning error draws a wrong conclusion from correct inputs, and a bias skews output towards what the training data favoured. This lesson covers CT-GenAI syllabus section 3.1: the definitions and causes of each defect, how to identify them in generated test cases, scripts, data and plans, the detection approaches for each type and why their depth follows risk, the five mitigation techniques, and how non-deterministic output makes these defects reappear and what temperature, seeds and automated verification can and cannot do about it.
On this page9 sections
- Three defect types: hallucinations, reasoning errors and biases
- Hallucinations: invented or irrelevant content
- Reasoning errors: wrong conclusions from correct inputs
- Bias: a systematic skew inherited from training data
- Identifying the defects in a given LLM output
- Detection approaches for each defect type
- Five mitigation techniques
- Why a fixed defect can come back: non-determinism
- Reducing non-deterministic behaviour: temperature, seeds and automated checks
- Define hallucinations, reasoning errors and biases in LLM output and state the cause of each
- Identify which defect a given LLM output for a test task shows, element by element
- Match each defect type to its detection approaches and scale detection to the estimated risk
- Summarize the five mitigation techniques and choose the one that addresses a given cause
- Explain why non-deterministic output lets a fixed defect reappear
- Recall how lowering temperature, setting a seed and automating verification reduce variability, and their limits
Three defect types: hallucinations, reasoning errors and biases
Hallucinations, reasoning errors and biases are the three defect types the CT-GenAI syllabus names for LLM output, and each has a different cause, a different symptom in testware and a different way of being caught. They reduce the quality of generated test cases, scripts, data and plans, so testers must identify them in the output and take measures to reduce them. The syllabus traces all three to the nature of the training data and the inherent limitations of the transformer model.
| Defect | Definition | Cause or typical trigger | Typical test tasks affected |
|---|---|---|---|
| Hallucination | Output that appears factually incorrect or irrelevant to the given task | Typically triggered when relevant context is missing from the prompt or the prompt is poorly designed | Test case design, test script generation, expected results |
| Reasoning error | Misinterpreting logical structures (cause and effect, conditional logic, step-by-step processes), leading to incorrect conclusions | LLMs rely on pattern matching, not true logical reasoning | Test planning (e.g. effort estimation), test case prioritization, anything with arithmetic |
| Bias | Output that favours certain types of information, approaches or assumptions | Skews in the data the model was trained on | Generating test data, refining acceptance criteria |
A useful way to keep them apart: a hallucination adds something that is not true or not there; a reasoning error takes correct inputs and draws the wrong conclusion from them; a bias produces output where each item may be fine but the set as a whole is skewed. Non-deterministic output, where the same prompt gives different responses, is not a fourth defect type: it is a property of LLMs that makes the three defects harder to fix (covered at the end of this lesson).
Hallucinations: invented or irrelevant content
A hallucination is LLM output that appears factually incorrect or irrelevant to the task it was given. The output usually reads fluently and confidently, which is what makes it misleading: it can compromise the validity of test outputs if a tester takes it at face value.
The syllabus lists three ways hallucinations show up in software testing:
- Fictitious or irrelevant test cases, such as tests for a feature that is not in the release or not in the product at all.
- Incorrect or non-functioning test scripts, such as a script that calls a method, endpoint or library function that does not exist.
- Test cases that verify non-existent acceptance criteria, such as a test traced to a criterion number the user story never had, or one checking a rule nobody specified.
The test for "is this a hallucination?" is a comparison with the test basis and known system behaviour: does this element exist in the requirements, the specification, the API, the framework? If the element is invented, it is a hallucination. If every element exists but they have been combined or concluded wrongly, look at reasoning errors instead.
The syllabus hands-on exercise for hallucinations (HO-3.1.2a) has learners confront at least two LLMs with a situation where they invent irrelevant elements, such as unrelated criteria that are not in the given contextual data, and vary the prompt to see how prompting influences hallucinations.
Reasoning errors: wrong conclusions from correct inputs
A reasoning error occurs when an LLM misinterprets a logical structure, such as a cause-and-effect relationship, conditional logic or a step-by-step problem-solving process, and reaches an incorrect conclusion. The syllabus explains why: unlike humans, LLMs lack true logical reasoning and rely on pattern matching, which leads to faulty logic in tasks such as mathematical reasoning.
Typical forms in test work:
- Misapplied conditions: an exception introduced by "unless" ignored, an exclusive boundary ("more than") handled as inclusive, a rule applied to cases its condition excludes.
- Wrong ordering: a priority list that does not follow the risk levels the tester supplied.
- Arithmetic and step errors: a percentage applied to the wrong base, a unit conversion slipped in one step, or a later step built on a figure the earlier step never produced.
The syllabus names test planning and test case prioritization as test tasks that require logical reasoning and where LLMs make reasoning errors. Its hands-on exercise (HO-3.1.2b) uses a test planning problem, such as estimating test effort or prioritizing test cases, with input data complex enough to need real problem solving. The LLM's result is compared with the exact correct result, three model types are tried (an LLM, a small language model and a reasoning model), and prompt variations are used to try to improve the outcome.
The key signal of a reasoning error is that nothing has been invented. Every ID, risk level, criterion and number comes from the input; what is wrong is the logic applied to them.
Bias: a systematic skew inherited from training data
LLM bias originates from the data the model was trained on, and it makes output favour certain types of information, approaches or assumptions. The syllabus example is a model trained mainly on English-language data, which may underrepresent non-English perspectives.
In software testing the syllabus names two tasks where bias influences the response: generating test data and refining acceptance criteria for test cases. Bias also shows up as a skew in the test types an LLM produces, for example mostly functional tests with non-functional types such as performance, security or accessibility underrepresented or missing.
Bias is a property of the set, not of a single item. One generated hotel guest who is a single adult is not bias; a set of guest profiles in which every booking is one adult in one standard room, with no families, groups or guests needing an accessible room, is. Inspect any single profile and nothing is wrong; only the set as a whole fails to represent the guests the test strategy says must be covered. That is why checks that look at items one by one miss it.
Because the cause is in the training data, rewording a prompt can reduce a skew in one response but does not remove its source, so the skew can return in later output.
Identifying the defects in a given LLM output
To identify which defect an output shows, compare each element with the test basis and ask three questions in order: is anything invented (hallucination), is anything concluded wrongly from real inputs (reasoning error), and is the output as a whole skewed against what the strategy needs (bias)? One response can contain more than one defect, so classify each element separately.
Consider a hotel booking service with two rules: R1, a cancellation made more than 48 hours before check-in is free; R2, a later cancellation is charged 20% of the first night's rate. The booking screen offers Book, Modify and Cancel for a single booking. An LLM returns:
T1 (R1): cancel 72 h before check-in -> no charge
T2 (R1): cancel exactly 48 h before -> no charge
T3 (R2): 3 nights at 100/night, cancel 12 h before
-> charge 60
T4: select several bookings, press "Cancel all"
-> all cancelled, no charge
- T1 is correct.
- T2 treats "more than 48 hours" as if 48 hours itself qualified: the boundary is on the wrong side, a reasoning error.
- T3 uses the real rule and the real rate but takes 20% of the whole stay (300) instead of the first night (100), so the expected charge should be 20: another reasoning error.
- T4 tests a bulk-cancel function the screen does not have: a fictitious test case, so a hallucination.
If the same service's generated guest profiles were all single adults paying by card when the strategy required families, groups and several payment methods, that would be a bias: nothing invented, nothing miscalculated, but the coverage the strategy asks for is not represented. Arithmetic deserves its own check: recompute any figure the model derives rather than trusting a plausible-looking number.
Detection approaches for each defect type
Each defect type has its own detection approaches, applied through review or a combination of review and automated verification. Choosing the wrong approach means the defect is simply not looked for.
| Defect | Approach | What it does |
|---|---|---|
| Hallucination | Cross-verification | Compare the output with existing documentation, requirements and known system behaviour; automated tools can cross-reference established data sources and flag discrepancies (for example, matching every requirement ID a generated test cites against the requirements repository) |
| Hallucination | Domain expertise consultation | Subject matter experts validate the accuracy of the content; they catch nuanced errors that automated checks miss |
| Hallucination | Consistency checks | Verify that outputs are consistent with each other and with known information, for example checking that an expected result in one test agrees with the same rule as applied in the other tests of the output; automation can help find patterns |
| Reasoning error | Logical validation | Evaluate the logical flow (consistency, coherence, structured reasoning) of the content through review cycles; tools can help, but complex cases may need human judgment |
| Reasoning error | Output testing | Run the generated test cases or scripts against the test object and verify the results; partly or fully automatable depending on the testware |
| Bias | Strategy and coverage review | Review whether generated testware (test code, synthetic test data) fairly and accurately represents the defined test strategy and coverage requirements |
| Bias | Test type assessment | Assess biases related to test types, such as underrepresented non-functional tests |
Two distinctions matter. First, cross-verification and output testing check items that exist; they cannot reveal categories of tests or groups of data that were never generated, so a skew passes them. Only a review against the strategy's coverage finds bias. Second, output testing judges the testware by running it, while logical validation examines the reasoning itself in review, so the two suit different kinds of output.
Depth follows risk. The syllabus states that the actual implementation of these methods depends on the estimated risk of hallucinations, reasoning errors or biases in the test task. Generated test data for a payment-settlement interface whose figures feed regulatory reports warrants deep, layered checking; a list of suggested names for test data files warrants a quick look. A uniform level of checking across all tasks, whether heavy or light, ignores this rule.
Five mitigation techniques
The syllabus gives five key techniques to reduce hallucinations, reasoning errors and biases, noting that these defects are more likely when prompts are not properly designed or relevant contextual input data is missing. Grouping them helps: three act on the prompt and two on the choice of model (a convenient grouping, not syllabus wording).
| Technique | Acts on | Fits when |
|---|---|---|
| Provide complete context: all relevant information in the prompt | Prompt | The prompt leaves out information the task depends on, so the model fills the gap with assumptions |
| Divide prompts into manageable segments: prompt chaining, verifying each output before the next step | Prompt | The task has several dependent steps, and an error in an early step would carry into every later one |
| Use clear, interpretable data formats | Prompt | The input is hard to interpret even for a person, for example long free-form notes where a structured list or table would be unambiguous |
| Select the appropriate model: an LLM specifically trained for the task | Model | The task needs specialised knowledge that general-purpose models handle poorly |
| Compare results across models: evaluate the prompt with several LLMs | Model | You want to detect output errors and select the most reliable result |
Match the technique to the cause: information gaps are closed in the prompt, ambiguous inputs are restructured, multi-step tasks are chained with a check after each step, and knowledge gaps call for a better-suited model. Changing an inference setting such as temperature addresses none of these causes; it affects how much output varies, not whether it is right.
Model comparison is a detection signal, not a vote. When models disagree, at least one is wrong, so the disagreement flags the item for cross-verification against the test basis. Agreement is weaker evidence than a check against the test basis, because models trained on similar data can make the same mistake.
The syllabus also mentions Retrieval-Augmented Generation and fine-tuning as complementary techniques for improving LLM results; they belong to chapter 4 and are covered in that lesson.
Why a fixed defect can come back: non-determinism
A hallucination, reasoning error or bias that seems fixed can reappear because LLMs are non-deterministic: the same input can produce different output. The variation comes from the probabilistic sampling used during inference, as the model chooses each next token from a probability distribution.
The syllabus draws the consequence directly: these defects are difficult to fix, because they may appear to be fixed for one LLM output and then reappear in another conversation with the same LLM. This applies to all three defect types. A refined prompt that removed an invented rule, or that produced a varied data set once, has shown that the fix can work, not that it always will.
Two practical conclusions follow. Earlier clean results do not certify later ones, so verification applies to each output. And reproducibility gets harder with length: long outputs carry a higher risk of variability than short ones.
Reducing non-deterministic behaviour: temperature, seeds and automated checks
Non-deterministic behaviour is reduced, never eliminated, by lowering the temperature and setting a random seed, and its remaining risk is managed by automating parts of output verification. The syllabus is explicit that complete reproducibility cannot be guaranteed.
| Strategy | How it works | Trade-off or limit |
|---|---|---|
| Lower the temperature | Narrows the probability distribution at inference, reducing randomness so outputs are more consistent | Less creativity and diversity; outputs become repetitive or overly deterministic. It makes output more consistent, not more accurate |
| Set a random seed | Where the implementation supports it, fixes the seed of the random number generator so the same pseudo-random sequence is used, improving reproducibility | Not available everywhere; output can still vary, especially long output |
| Automate output verification | Builds structured, consistent evaluation of every output, so a defect that reappears is caught | Needs a reference to check against (test basis, schemas, execution) |
Temperature is a choice per task. Tasks that need the same answer each time, such as expected results checked into a regression suite, suit a low temperature; tasks that value variety, such as ideas for usability sessions, suit a higher one. Using a low temperature everywhere trades away the variety such tasks need.
Keep the mechanisms apart: temperature shapes the distribution, a seed fixes the random sequence used to sample from it. Even with both set, the syllabus notes that long outputs carry a higher risk of variability, and consistent output is not the same as correct output, which is why verification stays in place.
Tip. Questions on this topic range from recall to applying the definitions to a given output. Recall items ask for the definition or cause of a defect type, which test tasks the syllabus links to reasoning errors or to bias, which detection approaches belong to which defect, or what temperature and seed settings do. Identification items show a short LLM output (test cases traced to acceptance criteria, a prioritized list, an effort calculation, a synthetic data set) and ask which defect it shows, sometimes classifying two elements of one output. Understanding items describe a situation and ask for the most suitable detection approach given a constraint (nothing to execute, expert knowledge needed, maximum automation), the mitigation that addresses the stated cause, how detection depth should follow risk, or what to conclude when a fixed defect reappears or models disagree. A few items are multiple-response.
- Hallucination: output that appears factually incorrect or irrelevant to the task, such as fictitious test cases, non-functioning scripts or tests for non-existent acceptance criteria
- Reasoning error: misreading cause and effect, conditional logic or step-by-step processes, because LLMs pattern-match rather than reason; test planning and prioritization are prone
- Bias comes from the training data and shows as a skew across the output, for example in generated test data, refined acceptance criteria or the mix of test types
- Detect hallucinations by cross-verification, domain expert consultation and consistency checks; reasoning errors by logical validation and output testing; bias by reviewing output against the test strategy and coverage
- How much detection to apply depends on the estimated risk of these defects in the test task
- Mitigate with complete context, verified prompt chains, clear data formats, a model trained for the task and comparison across models; disagreement between models flags an item to verify against the test basis
- Non-determinism means a defect fixed in one output can return in another conversation, so outputs need checking every time
- Lower temperature and a fixed seed reduce variability but cannot guarantee reproducibility, especially for long outputs; automate output verification for consistent evaluation
Frequently asked questions
What is the difference between a hallucination and a reasoning error in CT-GenAI?
A hallucination is output that appears factually incorrect or irrelevant to the task, such as a test case for an acceptance criterion that does not exist or a script that calls a non-existent function. A reasoning error uses correct inputs but reaches a wrong conclusion by misreading cause and effect, conditional logic or a step-by-step process, such as placing a boundary on the wrong side or applying a percentage to the wrong base. If something is invented, it is a hallucination; if real inputs are combined wrongly, it is a reasoning error.
Where does LLM bias come from according to the CT-GenAI syllabus?
LLM bias originates from the data the model was trained on, which makes output favour certain types of information, approaches or assumptions. For example, a model trained mainly on English-language data may underrepresent non-English perspectives. In testing the syllabus names generating test data and refining acceptance criteria as tasks where bias can influence the response.
How do you detect bias in LLM-generated testware?
Review whether the generated testware, such as test code or synthetic test data, fairly and accurately represents the defined test strategy and coverage requirements, and assess biases related to test types, such as underrepresented non-functional tests. Checks of individual items, such as cross-verification or running the tests, do not find bias, because every item can be valid while the set as a whole is skewed.
What are the five mitigation techniques for hallucinations, reasoning errors and biases?
The CT-GenAI syllabus lists providing complete context in the prompt, dividing complex prompts into chained steps and verifying each output before the next, using clear and interpretable data formats, selecting an LLM specifically trained for the task, and comparing results across several LLMs to detect errors and select the most reliable output.
Why can a hallucination come back after the prompt has been fixed?
LLMs are non-deterministic: probabilistic sampling during inference means the same prompt can give different responses. A prompt change that removes a hallucination, reasoning error or bias in one output does not guarantee it is gone in the next conversation with the same LLM, so outputs still need verifying each time they are used.
Does lowering the temperature make LLM output reproducible?
Lowering the temperature narrows the probability distribution and makes outputs more consistent, but it does not guarantee reproducibility, and it reduces creativity and diversity. Setting a random seed, where supported, also improves reproducibility. The CT-GenAI syllabus states that complete reproducibility cannot be guaranteed, especially for long outputs, and recommends automating parts of output verification.
How much hallucination and bias checking should a test team do?
The CT-GenAI syllabus says the implementation of detection methods depends on the estimated risk of hallucinations, reasoning errors or biases in the test task. High-risk work, where a wrong output could cause serious harm or cost, warrants deeper and layered checking, while low-risk work needs only a light review.
Source
This lesson covers the "Managing Risks of Generative AI in Software Testing" domain of the official CT-GenAI exam guide. Vendors revise their guides — check the source for the current version.
Sign up free to mark lessons complete, bookmark topics and track your exam readiness.