Lesson 2 of 4 AI Governance and Compliance

Tracing Generated Answers Back to Their Sources

This lesson covers registering sources, carrying attribution through RAG and auditing with CloudTrail, so an organisation can show which data sources informed any generated answer and who changed the system.

Learning outcomes

After completing this lesson, you will be able to:

  • Register data sources in the Glue Data Catalog.
  • Carry attribution from ingestion metadata to citations.
  • Audit system changes with CloudTrail.

Registering data sources

Governance teams cannot approve or audit AI systems without knowing which data they use. The AWS Glue Data Catalog is a central registry of datasets, recording each one's location, schema, classification, owner and other properties. Crawlers can populate it automatically by scanning Amazon S3 locations and databases.

Registering every source used for retrieval, fine-tuning or analytics, with business metadata such as the data owner, sensitivity level and approved uses, lets governance teams see which data feeds which AI systems and check that each source is approved for that purpose. When a dataset is later found to be inaccurate or to contain data that should not have been used, the catalogue shows which knowledge bases and models are affected.

Attribution in generated content

Attribution flows from metadata. During ingestion, each document carries its source system, source URL or identifier, version, author and effective date as metadata, which Bedrock Knowledge Bases store with every chunk. At query time, RetrieveAndGenerate returns citations mapping parts of the answer to retrieved chunks and their metadata; with Retrieve, the application includes chunk identifiers in the prompt and asks the model to cite them. The application shows sources to users and stores them in decision logs. Generated content can also carry metadata, such as a tag that it was AI-generated and the model and prompt version that produced it.

The following diagram shows the trail from a disputed answer, given two months earlier, to its sources.

Tracing a disputed answer two months later. The decision log lists the citations, whose metadata gives document IDs and versions; the Glue Data Catalog shows each source system and owner; and CloudTrail shows the ingestion jobs and data source changes in the preceding weeks.
Metadata recorded at ingestion makes this trail possible.
Put in order

From source to citation

Exam skills 3.3.2

Put the steps that let an answer be traced back to its source in order.

Log in to try this activity Interactive activities are free with an account.

Audit logging with CloudTrail

Traceability also requires knowing who changed a generative AI system and when. AWS CloudTrail records API activity across the account: the creation and modification of knowledge bases, data sources and ingestion jobs; changes to guardrails, prompts, agents and flows; IAM changes; and, when data events are enabled, operations such as retrievals and agent invocations. If an assistant suddenly starts answering differently, CloudTrail shows whether someone changed its prompt, guardrail or data source beforehand.

Organisation trails deliver logs from every account to a central, protected S3 bucket with log file integrity validation, which proves the logs have not been altered, and Amazon Athena queries over the trail answer audit questions. CloudTrail shows who did what; invocation logs and decision logs show what the model received and produced. The following table summarises the traceability sources.

QuestionSource
Which datasets feed this AI system?Glue Data Catalog registrations
Which documents supported this answer?Citations and chunk metadata in decision logs
Who changed the knowledge base or guardrail?CloudTrail management events
What did the model receive and return?Model invocation logs
Scenario questions

Who changed what?

Exam skills 3.3.2 · 3.3.4

Choose the record that answers each traceability question.

Log in to try this activity Interactive activities are free with an account.
Worked example

A disputed answer

A customer disputes advice given by an assistant two months ago. Legal needs to know which policy documents supported it and whether the knowledge base had been changed recently.

The decision log for the request lists the citations, whose metadata gives document IDs and versions; the Glue Data Catalog shows the source system and owner; CloudTrail shows the ingestion jobs and data source changes in the preceding weeks and who started them.

Check yourself

Which service records who changed a knowledge base or guardrail?

Show answer

AWS CloudTrail.

Exam Tips

Remember for the exam

  • Register AI data sources in the Glue Data Catalog with owners and sensitivity.
  • Carry source metadata through ingestion; store citations with responses.
  • CloudTrail answers who changed knowledge bases, prompts and guardrails.