CCAR-F practice question 7 of 10

You are building a structured data extraction system using Claude. The system extracts information from unstructured documents, validates the output…

Full set: 191 questions
You are building a structured data extraction system using Claude. The system extracts information from unstructured documents, validates the output using JavaScript Object Notation (JSON) schemas, and maintains high accuracy. It must handle edge cases gracefully and integrate with downstream systems. Testing reveals that when source documents are missing certain specifications, the model fabricates plausible-sounding values to satisfy your schema’s required fields. For example, a document mentioning only dimensions receives a fabricated “weight: 2.3 kg” in the extraction output. What schema design change most effectively addresses this hallucination behavior?
Answer options
A: Add explicit instructions to the prompt stating “only extract information explicitly stated in the document; use placeholder text for missing values.”
B: Change fields that may not exist in source documents from required to optional, allowing the model to omit them. Correct answer
C: Add a “confidence” field alongside each specification where the model self-reports its certainty, then filter out low-confidence extractions.
D: Implement semantic validation that verifies each extracted value appears in or can be inferred from the source document text.
Correct Answer:
B. Change fields that may not exist in source documents from required to optional, allowing the model to omit them.
Explanation

The root cause of the issue is a schema constraint forcing the model to provide a value for a required field, even when the information is absent in the source document. This structural requirement compels the model to hallucinate a plausible value. By changing the field's status from required to optional within the JSON schema, you remove this compulsion. The model is then free to omit the key-value pair from the output if the corresponding data is not found in the text. This is the most direct and effective schema design change to prevent this specific fabrication behavior.

Why Incorrect

A. This is a prompt engineering technique, not a schema design change as the question specifically asks for.
C. This adds a layer of post-processing complexity and does not prevent the initial hallucination; it only asks the model to report on it.
D. This describes an external, post-processing validation system, not a preventative change to the schema design itself.

References

1. Anthropic Documentation

"Tool use": The documentation on defining tools for Claude specifies the use of a JSON schema structure for the inputschema. Within this schema

the required array lists all properties that the model must provide values for. By omitting a property from this required array

it becomes optional

allowing the model to exclude it from the output if the information is not present. This directly supports making fields optional to handle missing data.

Reference: Anthropic Claude Documentation

"Concepts > Tool use"

Section: "How to define tools".

2. Anthropic Cookbook

"Prompting for structured data": This guide provides best practices for extracting data into formats like JSON. The examples illustrate that the schema dictates the output structure. A schema that requires a field will force an output for that field

whereas a more flexible schema with optional fields is necessary when the source data is variable and may not contain all possible data points.

Reference: Anthropic Cookbook

"Guides > Prompting for structured data"

Section: "Example: Extracting entities from text".

3. JSON Schema Core Specification (as interpreted by Anthropic): The behavior is rooted in the JSON Schema standard that Anthropic models adhere to for structured outputs. The required keyword is a validation assertion meaning an instance is valid only if it has a value for that property. Removing a property name from the required array makes its presence non-mandatory.

Reference: IETF RFC Draft

"JSON Schema: A Media Type for Describing JSON Documents"

Section 6.5.3: "required". (Note: This is a foundational standard referenced and implemented by Anthropic's tooling).

Scroll to Top