Automating hallucination detection with chain-of-thought reasoning

Novel three-pronged approach combines claim-level evaluations, chain-of-thought reasoning, and classification of hallucination error types.

When a large language model (LLM) is prompted with a request such as Which medications are likely to interact with St. John's wort?, it doesn’t search a medically validated list of drug interactions (unless it's been trained to do so). Instead, it generates a list based on the distribution of words associated with St. John’s wort.

The result will likely be a mix of real and potentially fictional medications with varying degrees of interaction risk. These types of LLM hallucinations — assertions or claims that sound plausible but are verifiably incorrect — still impede LLMs’ commercial implementation. And while there are ways to reduce hallucinations in domains such as health care, the need to identify and measure hallucinations remains key to the safe use of generative AI.

Related content
Representing facts using knowledge triplets rather than natural language enables finer-grained judgments.

In a paper we presented at the last Conference on Empirical Methods in Natural Language Processing (EMNLP), we describe HalluMeasure, an approach to hallucination measurement that employs a novel combination of three techniques: claim-level evaluations, chain-of-thought reasoning, and linguistic classification of hallucinations into error types.

HalluMeasure first uses a claim extraction model to decompose the LLM response into a set of claims. Using a separate claim classification model, it then sorts the claims into five key classes (supported, absent, contradicted, partially supported, and unevaluatable) by comparing them to the context — retrieved text relevant to the request, which are also fed to the classification model.

Additionally, HalluMeasure classifies the claims into 10 distinct linguistic-error types (e.g., entity, temporal, and overgeneralization) that provide a fine-grained analysis of hallucination errors. Finally, we produce an aggregated hallucination score by measuring the rate of unsupported claims (i.e., those assigned classes other than supported) and calculate the distribution of fine-grained error types. This distribution provides LLM builders with valuable insights into the nature of the errors their LLMs are making, facilitating targeted improvements.

HalluMeasure process.png
The HalluMeasure process for automatically identifying LLM hallucinations.

Decomposing responses into claims

The first step in our approach is to decompose an LLM response into a set of claims. An intuitive definition of “claim” is the smallest unit of information that can be evaluated against the context; typically, it’s a single predicate with a subject and (optionally) an object.

Related content
Dependency graphs of business processes with constrained decoding can reduce API hallucinations and out-of-order executions.

We chose to evaluate at the claim level because classification of individual claims improves hallucination detection accuracy, and the higher atomicity of claims allows for more precise measurement and localization of hallucinations. We deviate from existing approaches by directly extracting a list of claims from the full response text.

Our claim extraction model uses few-shot prompting and begins with an initial instruction, followed by a set of rules outlining the task requirements. It also includes a selection of example responses accompanied by their manually extracted claims. This comprehensive prompt effectively teaches the LLM (without updating model weights) to accurately extract claims from any given response. Once the claims have been extracted, we classify them by hallucination type.

Advanced reasoning in claim classification

We initially followed the traditional method of directly prompting an LLM to classify the extracted claims, but this did not meet our performance standards. So we turned to chain-of-thought (CoT) reasoning, in which an LLM is asked not only to perform a task but to justify each action it takes. This has been shown to improve not only LLM performance but also model explainability.

Related content
“Best-fit packing” adapts bin-packing to avoid unnecessary truncation of training documents, improving LLM performance across a wide range of tasks and reducing hallucination.

We developed a five-step CoT prompt that combines curated examples of claim classification (few-shot prompting) with steps that instruct our claim classification LLM to thoroughly examine each claim’s faithfulness to the reference context and document the reasoning behind each examination.

Once implemented, we compared HalluMeasure’s performance against other available solutions on the popular SummEval benchmark dataset. The results clearly demonstrate improved performance with few-shot CoT prompting (2 percentage points, from 0.78 to 0.8), taking us one step closer to the automated identification of LLM hallucinations at scale.

AUC ROC performance.png
Area under the receiver-operating-characteristic curve across hallucination identification solutions on the SummEval dataset.

Fine-grained error classification

HalluMeasure enables more-targeted solutions that enhance LLM reliability by providing deeper insights into the types of hallucinations produced. Beyond binary classifications or the commonly used natural-language-inference (NLI) categories of support, refute, and not enough information, we propose a novel set of error types developed through analyzing linguistic patterns in common LLM hallucinations. For example, one proposed label type is temporal reasoning, which would apply to, say, a response stating that a new innovation is in use, when the context claims that the new innovation will be used in the future.

Hallucination examples.png
Examples of hallucinations and their linguistic-error types.

Additionally, understanding the distribution of error types across an LLM’s responses allows more-targeted hallucination mitigation. For example, if a majority of wrong claims contradict a particular assertion in the context, a common cause — say, allowing a large number (e.g., >10) of turns in a dialogue — could be explored. If fewer turns decrease this error type, restricting the number of turns or using summaries of previous turns could mitigate hallucination.

While HalluMeasure can provide scientists with insights into the source of a model’s hallucinations, there is still evolving risk for generative AI. As a consequence, we continue to drive innovation in the space of responsible AI by exploring reference-free detection, employing dynamic few-shot prompting techniques tailored to specific use cases, and incorporating agentic AI frameworks.

Research areas

Related content

US, CA, Sunnyvale
We are seeking an Applied Scientist II to work on development of an AI-based data intelligence and classification platform that will redefine how security and privacy assessments and enforcement are conducted at scale. This mission-critical platform will leverage AI-driven autonomous agents to conduct proactive, intelligent security operations across the company. The platform will integrate deeply with internal security, privacy, engineering, and cloud-native tools to provide self-serve, automated insights, verifications, and enforcement mechanisms. This role requires strong technical expertise in AI/ML, LLMs, and distributed cloud infrastructure, as well as thought leadership to drive alignment across multiple teams, customers, and business units. This is an opportunity to shape the future of AI-driven security and privacy assurance at an enterprise scale, defining standards, influencing company-wide security posture, and leading technical innovation at the highest level. Key job responsibilities * Architect and define the next-generation data classification and search matching platform, leading the technical strategy for AI-driven security automation across applied science and engineering teams * Build on multi-agent LLM framework, and influence your organizations in adopting the promising approaches * Develop a highly scalable, traditional ML-based as well as LLM-based intelligent security agent framework that enables internal teams to automate processing of structured and unstructured data * Combine depth and breadth of domain expertise and provide technical leadership to the entire team while also doing hands-on work by diving deep into details to diagnose complex system performance problems. About the team The Data Categorization team helps Amazonians understand their data and govern it at scale and ensures experiences delivered by Amazon to our customers uphold our high security and privacy standards. The science team harnesses AI to strengthen Amazon’s privacy and security posture more efficiently and effectively.
GB, London
Applied Scientists in AWS Automated Reasoning are dedicated to making AWS the best computing service in the world for customers who require advanced and rigorous solutions for automated reasoning, privacy, and sovereignty. Key job responsibilities The successful candidate will: - Solve large or significantly complex problems that require deep knowledge and understanding of your domain and scientific innovation. - Own strategic problem solving, and take the lead on the design, implementation, and delivery for solutions that have a long-term quantifiable impact. - Provide cross-organizational technical influence, increasing productivity and effectiveness by sharing your deep knowledge and experience. - Develop strategic plans to identify fundamentally new solutions for business problems. - Assist in the career development of others, actively mentoring individuals and the community on advanced technical issues. A day in the life This is a unique and rare opportunity to get in early on a fast-growing segment of AWS and help shape the technology, product and the business. You will have a chance to utilize your deep technical experience within a fast moving, start-up environment and make a large business and customer impact. About the team Diverse Experiences Amazon Automated Reasoning values diverse experiences. Even if you do not meet all of the qualifications and skills listed in the job description, we encourage candidates to apply. If your career is just starting, hasn't followed a traditional path, or includes alternative experiences, don't let it stop you from applying. Why Amazon Automated Reasoning? At Amazon, automated reasoning is central to maintaining customer trust and delivering delightful customer experiences. Our organization is responsible for creating and maintaining a high bar for automated reasoning across all of Amazon's products and services. We offer talented automated reasoning professionals the chance to accelerate their careers with opportunities to build experience in a wide variety of areas including cloud, devices, retail, entertainment, healthcare, operations, and physical stores. Inclusive Team Culture In Amazon Automated Reasoning, it's in our nature to learn and be curious. Ongoing DEI events and learning experiences inspire us to continue learning and to embrace our uniqueness. Addressing the toughest automated reasoning challenges requires that we seek out and celebrate a diversity of ideas, perspectives, and voices. Training & Career Growth We're continuously raising our performance bar as we strive to become Earth's Best Employer. That's why you'll find endless knowledge-sharing, training, and other career-advancing resources here to help you develop into a better-rounded professional. Work/Life Balance We value work-life harmony. Achieving success at work should never come at the expense of sacrifices at home, which is why flexible work hours and arrangements are part of our culture. When we feel supported in the workplace and at home, there's nothing we can't achieve.
US, CA, Sunnyvale
Are you excited about developing state-of-the-art Machine Learning, Natural Language Processing, Deep Learning and Computer Vision algorithms and designs using large data sets to solve real world problems? Do you have proven analytical capabilities and can multi-task and thrive in a fast-paced environment? Do you want to build a foundation for your career after your Master's or Ph.D program at an industry-leading company? You enjoy the prospect of solving real-world problems that, quite frankly, have not been solved at scale anywhere before. Along the way, you’ll get opportunities to be a disruptor, prolific innovator, and a reputed problem solver—someone who truly enables machine learning to create significant impacts. As an Applied Scientist, you will bring statistical modeling and machine learning advancements to data analytics for customer-facing solutions in complex industrial settings. You will be working in a fast-paced, cross-disciplinary team of researchers who are leaders in the field. You will take on challenging problems, distill real requirements, and then deliver solutions that either leverage existing academic and industrial research, or utilize your own out-of-the-box pragmatic thinking. In addition to coming up with novel solutions and prototypes, you may even need to deliver these to production in customer facing products
US, WA, Seattle
We are seeking a senior Applied Scientist to join a science team within Amazon Customer Service that is reimagining how customers are connected with the right support experience. This is a senior technical leadership role where you will drive scientific strategy, mentor junior scientists, and deliver foundational models that power real-time personalization at scale. Key job responsibilities - Lead the science for understanding the demand side of customer service interactions - Characterize who is contacting us, what they need, and how complex their situation is - Invent novel representation learning approaches that encode customer interactions - Directly inform intelligent routing decisions across hundreds of millions of annual contacts
US, WA, Seattle
We are seeking an Applied Scientist to join a science team within Amazon Customer Service that is reimagining how customers are connected with the right support experience. This is a role at the intersection of representation learning, behavioral modeling, and large-scale experimentation where you will see your science deployed in production systems serving real-time decisions. Key job responsibilities - Develop machine learning models that capture how service associates perform across different problem types and how their capabilities evolve over time - Power intelligent routing decisions across hundreds of millions of annual customer contacts - Directly improve both customer experience and associate satisfaction through model-driven decisions - Work at the intersection of representation learning, behavioral modeling, and large-scale experimentation - Deploy science into production systems serving real-time decisions
US, CA, Sunnyvale
Amazon's PRISM team is seeking an innovative Applied Scientist to build the intelligence layer powering the Catalog Diagnostic Assistant — a conversational AI agent that unifies Amazon's fragmented catalog diagnostic experience into a single natural-language interface. Rather than switching between legacy tools, internal users ask CDA a question in plain language and CDA coordinates across data sources, reasons through complex diagnostic workflows, and returns a combined answer with source citations. This role sits at the intersection of Generative AI, agentic architectures, and large-scale information retrieval applied to the world's largest product catalog. You will design and build the scientific core of an agent that autonomously investigates catalog anomalies — diagnosing why products aren't live, why attributes aren't publishing, or why matching decisions went wrong — across billions of products, petabytes of multimodal data, and dozens of marketplaces. You will be the founding scientist for the CDA product, defining the research agenda for agentic diagnostics, developing novel approaches to skill-based reasoning and tool orchestration, and owning the full lifecycle from problem formulation through production deployment at Amazon scale. You will pioneer advanced GenAI solutions that power next-generation agentic experiences, working in a collaborative environment where you can experiment with massive data from the world's largest product catalog and tackle problems at the frontier of AI research. Key job responsibilities - Formulate open research problems at the intersection of GenAI, agentic reasoning, and large-scale catalog diagnostics — defining how an autonomous agent should decompose, investigate, and explain complex catalog issues - Design and develop novel agentic architectures (skill planning, tool selection, multi-step reasoning, chain-of-thought verification) that enable CDA to autonomously resolve diagnostic workflows that traditionally required manual expert investigation - Build and optimize retrieval-augmented generation (RAG) systems over Amazon's catalog data, ensuring the agent retrieves the right evidence from the right data sources to ground its diagnostic answers - Advance the science of efficient model deployment — developing distillation, compression, and LLM serving optimization strategies that preserve diagnostic reasoning quality in production-grade architectures while reducing latency and cost - Make frontier models reliable for autonomous decisions — advancing uncertainty calibration, confidence estimation, and interpretability methods so CDA's agentic diagnoses can be trusted at scale - Own the full research lifecycle from problem formulation through production deployment — designing rigorous experiments, iterating rapidly, and seeing your research directly improve diagnostic accuracy and coverage - Partner closely with CDA engineers to translate research prototypes into production systems serving thousands of daily diagnostic sessions - Shape the team's research vision by defining technical roadmaps that balance foundational scientific inquiry with measurable product impact - Mentor engineers on advanced ML/GenAI techniques, experimental design, and scientific rigor About the team We are a GenAI science team within Amazon's Selection and Catalog Systems (ASCS) organization. Our mission is to advance state-of-the-art Generative AI to deeply understand, uniquely identify, and intelligently diagnose every product at Amazon scale. We push the boundaries of multimodal LLMs, agentic systems, and generative AI to solve foundational catalog challenges — from product identity and semantic matching to automated catalog diagnostics and intelligent catalog analytics. Our scientists work across multiple high-impact problem spaces: establishing canonical product identity across billions of items, powering next-generation agentic experiences for catalog operations, and building AI systems that make Amazon's catalog self-diagnosing and self-healing. We operate at the frontier of AI research applied at unprecedented scale — petabytes of multimodal data, millions of sellers, dozens of languages, and infinite product diversity. This is a collaborative, fast-moving environment where you can experiment with massive data from the world's largest product catalog, tackle problems at the frontier of AI research, rapidly implement and deploy your ideas at scale, and publish your findings at top venues.
US, CA, San Francisco
We are seeking a Member of Technical Staff — Mechanical Engineer to lead the structural and electromechanical design of advanced high degree-of-freedom robotic systems within a frontier AI and robotics research lab. You will own the mechanical architecture of our robotics platform end-to-end: actuator selection, joint design, thermal management, cable routing, sensing integration, and structural optimization — all under the demanding constraints of a high-DoF system that must be lightweight, robust, and production-viable. This is a unique opportunity to define the physical design direction of a next-generation robotics platform from first principles. The ideal candidate has deep experience designing complex robotic systems and scaling hardware from concept through prototyping to production. You thrive on analytical problem solving, possess strong intuition for structural and electromechanical tradeoffs, and are equally comfortable in CAD and on the shop floor. You will be the technical lead of a small team of talented mechanical engineers while collaborating closely with electrical, firmware, controls, and AI research teams to set the mechanical and structural direction of the platform. Beyond core platform development, this role offers real latitude to push into novel territory — novel actuation methods, advanced sensor integration, or new approaches to mechatronic packaging. If you have research instincts alongside shipping discipline, you'll find an environment that rewards both. We're looking for someone who wants to be the technical authority on how a high-performance robot is physically built, not just a contributor to the effort. What You Bring: - A systems-thinking mindset with a strong grasp of cross-domain engineering tradeoffs. - A bias toward action: comfortable building, testing, and iterating rapidly. - A collaborative and communicative working style — especially in multi-disciplinary research environments. - A passion for robotics and advancing the state of the art in intelligent, capable machines. Key job responsibilities - Lead mechanical design of robotic subsystems and full platforms, including structures, joints, enclosures, and mechanisms for a research environment. - Own kinematic, dynamic, and structural analyses to guide the design and optimization of full systems and subsystems of high-DoF robots - Specify and integrate actuators and motors for high-torque density applications in high-degree-of-freedom systems. - Drive rapid iteration and prototyping cycles — from concept sketches through functional hardware — to accelerate learning and compress development timelines in a fast-paced R&D environment. - Partner with the AI research team to establish simulation pipelines that enable rapid exploration of mechanical design space, informing actuator choices, structural topology, and system-level tradeoffs before committing to physical builds. - Contribute to thermal management strategies for motors, sensors, and embedded compute hardware. - Integrate sensors such as lidar, stereo cameras, IMUs, tactile sensors, and compute modules into compact, functional assemblies. - Design and route cabling and wire harnesses, ensuring reliability, serviceability, and thermal/electrical integrity. - Prototype and test mechanical systems; support hands-on builds, debug sessions, and field testing. - Conduct root cause analysis on system-level failures or performance issues and implement design improvements. - Apply Design for Manufacturing (DFM) and Design for Assembly (DFA) principles to transition prototypes into scalable builds (10s–100s of units). - Collaborate with cross-functional teams in electrical engineering, controls, perception, and research to meet research and product goals. About the team Frontier AI & Robotics (FAR) is the team at Amazon building the next generation of embodied intelligence. FAR drives the development and implementation of advanced AI models within Amazon’s operations that enable robots to see, reason, and act on the world around them, supporting a number of different warehouse automation tasks.
IN, KA, Bengaluru
Do you want to join an innovative team of scientists who use machine learning and statistical techniques to create state-of-the-art solutions for providing better value to Amazon’s customers? Do you want to build and deploy advanced algorithmic systems that help optimize millions of transactions every day? Are you excited by the prospect of analyzing and modeling terabytes of data to solve real world problems? Do you like to own end-to-end business problems/metrics and directly impact the profitability of the company? Do you like to innovate and simplify? If yes, then you may be a great fit to join the Machine Learning and Data Sciences team for India Consumer Businesses. If you have an entrepreneurial spirit, know how to deliver, love to work with data, are deeply technical, highly innovative and long for the opportunity to build solutions to challenging problems that directly impact the company's bottom-line, we want to talk to you. Major responsibilities - Use machine learning and analytical techniques to create scalable solutions for business problems - Analyze and extract relevant information from large amounts of Amazon’s historical business data to help automate and optimize key processes - Design, development, evaluate and deploy innovative and highly scalable models for predictive learning - Research and implement novel machine learning and statistical approaches - Work closely with software engineering teams to drive real-time model implementations and new feature creations - Work closely with business owners and operations staff to optimize various business operations - Establish scalable, efficient, automated processes for large scale data analyses, model development, model validation and model implementation - Mentor other scientists and engineers in the use of ML techniques Key job responsibilities Use machine learning and analytical techniques to create scalable solutions for business problems Analyze and extract relevant information from large amounts of Amazon’s historical business data to help automate and optimize key processes Design, develop, evaluate and deploy, innovative and highly scalable ML models Work closely with software engineering teams to drive real-time model implementations Work closely with business partners to identify problems and propose machine learning solutions Establish scalable, efficient, automated processes for large scale data analyses, model development, model validation and model maintenance Work proactively with engineering teams and product managers to evangelize new algorithms and drive the implementation of large-scale complex ML models in production Leading projects and mentoring other scientists, engineers in the use of ML techniques About the team International Machine Learning Team is responsible for building novel ML solutions that attack India first (and other Emerging Markets across MENA and LatAm) problems and impact the bottom-line and top-line of India business. Learn more about our team from https://www.amazon.science/working-at-amazon/how-rajeev-rastogis-machine-learning-team-in-india-develops-innovations-for-customers-worldwide
IN, KA, Bengaluru
RBS (Retail Business Services) Tech team works towards enhancing the customer experience (CX) and their trust in product data by providing technologies to find and fix Amazon CX defects at scale. Our platforms help in improving the CX in all phases of customer journey, including selection, discoverability & fulfilment, buying experience and post-buying experience (product quality and customer returns). As a Sciences team in RBS Tech, we focus on foundational ML research and develop scalable state-of-the-art ML solutions to solve the problems covering customer experience (CX) and Selling partner experience (SPX). We work to solve problems related to multi-modal understanding (text and visual), supervised and unsupervised techniques, multi-task learning, multi-label classification, aspect and topic extraction for Customer Anecdote Mining, product similarity, using GenAI, LLMs, NLP and Computer Vision. Key job responsibilities As an Applied Science Manager, you will be responsible to design and deploy scalable GenAI, NLP and Computer Vision solutions that will impact the content visible to millions of customer and solve key customer experience issues. You will Lead scientists on the team and oversee research and development projects at various stages ranging from initial exploration to deployment into production systems. You will partner with business and engineering teams to identify and solve large and significantly complex problems that require scientific innovation. You will help the team leverage your expertise, by coaching and mentoring. You will contribute to the professional development of colleagues, improving their technical knowledge and the engineering practices. You will create the environment in the team to file for patents and/or publish research work where opportunities arise. You will impact the large product strategy, identifies new business opportunities and provides strategic direction to the team.
US, WA, Seattle
Are you passionate about leveraging your applied science skills to deliver actionable insights that impact daily business decisions? Do you like using ML, GenAI, Causal Inference, Reinforcement Learning and Experimentation to answer challenging product and customer behavior questions? Do you want to be a technical leader and build flexible and global solutions for complex financial services/payments, risk, and causal problems? If so, here is a great opportunity to consider! Amazon B2B Payments & Lending is seeking an Applied Scientist II who will combine their technical expertise with business acumen to generate critical insights that will set the strategic direction of the business. You will be a thought leader on the team, help set the team's strategic focus and roadmaps, and design and build systems/solutions that support financial products, working closely with business/product partners and engineers. You will utilize ML/GenAI/Causal Inference/Reinforcement Learning/Experimentation methodologies, data and coding skills, problem solving and analytical skills, and excellent communication to deliver customer value. Amazon offers a full range of benefits that support you and eligible family members, including domestic partners and their children. Benefits can vary by location, the number of regularly scheduled hours you work, length of employment, and job status such as seasonal or temporary employment. The benefits that generally apply to regular, full-time employees include: 1. Medical, Dental, and Vision Coverage 2. Maternity and Parental Leave Options 3. Paid Time Off (PTO) 4. 401(k) Plan. If you are not sure that every qualification on the list above describes you exactly, we'd still love to hear from you! At Amazon, we value people with unique backgrounds, experiences, and skillsets. If you’re passionate about this role and want to make an impact on a global scale, please apply!