Dev.to AI ๐Ÿค– Ai ๐Ÿ‘ 0 ๐Ÿ“– 6 min read

Securing Golden Data for AI Governance Metrics on Databricks

AI governance dashboards report accuracy, groundedness and safety scores. Every one of those scores is a comparison against golden data: the eval sets, expected answers and reference data your team has agreed to treat as

Securing Golden Data for AI Governance Metrics on Databricks

AI governance dashboards report accuracy, groundedness and safety scores. Every one of those scores is a comparison against golden data: the eval sets, expected answers and reference data your team has agreed to treat as truth.

If that data can be quietly edited, leaked into prompts or lost to retention, the dashboard still shows numbers. They just stop meaning anything.

This post walks through the controls I use to secure golden data on Databricks, with SQL you can adapt. Everything here uses native Unity Catalog features.

1. Give golden data its own home, with few writers

Put golden data in a dedicated schema so you can govern it as one unit. Readers get SELECT. A small owners group gets MODIFY.

CREATE SCHEMA IF NOT EXISTS ai_gov.golden
  COMMENT 'Golden eval sets and reference data. Changes need review.';

GRANT USE CATALOG ON CATALOG ai_gov TO `eval-readers`;
GRANT USE SCHEMA, SELECT ON SCHEMA ai_gov.golden TO `eval-readers`;

GRANT USE CATALOG ON CATALOG ai_gov TO `golden-data-owners`;
GRANT USE SCHEMA, SELECT, MODIFY ON SCHEMA ai_gov.golden TO `golden-data-owners`;

Then measure it. The number of principals that can change the answer key is a governance metric in its own right.

SELECT grantee, privilege_type
FROM system.information_schema.schema_privileges
WHERE catalog_name = 'ai_gov'
  AND schema_name = 'golden'
  AND privilege_type IN ('MODIFY', 'ALL PRIVILEGES');

This query only covers schema-level grants. Also check table-level grants, catalog-level grants and object owners, because owners and admins can change data too.

2. Prove nothing else reads it

Leakage is the quiet killer. Someone pastes eval questions into a prompt, or a pipeline copies the set into a retrieval index. Scores go up, and the model has effectively seen the answers.

Unity Catalog writes table lineage to system.access.table_lineage, kept for 395 days by default. Each row records the entity (notebook, job, pipeline, query or dashboard), who generated it, and the source and target. A row with a source and no target is a read.

This query lists every read of the golden schema in the last 30 days by anyone other than your evaluation service principal:

SELECT event_time,
       created_by,
       entity_type,
       entity_id,
       source_table_full_name,
       target_table_full_name
FROM system.access.table_lineage
WHERE source_table_catalog = 'ai_gov'
  AND source_table_schema = 'golden'
  AND event_date >= date_sub(current_date(), 30)
  AND coalesce(created_by, '') <> '<your-eval-service-principal-id>'
ORDER BY event_time DESC;

Two rows deserve special attention: any read from an interactive notebook, and any row where target_table_full_name is outside your evaluation results schema. The second one means the golden data was copied somewhere.

Run it as a scheduled query with an alert. One caveat from the docs: lineage is only recorded when it can be inferred from the event, so treat this as strong evidence, not a perfect seal.

3. Log every permission change

Grants drift over time. Someone adds a group "temporarily" and never removes it. The audit system table, system.access.audit, keeps 395 days and records Unity Catalog actions.

SELECT event_time,
       user_identity.email AS changed_by,
       action_name,
       request_params
FROM system.access.audit
WHERE service_name = 'unityCatalog'
  AND action_name = 'updatePermissions'
  AND event_date >= date_sub(current_date(), 30)
  AND to_json(request_params) LIKE '%ai_gov.golden%'
ORDER BY event_time DESC;

Check the exact action names and request parameter keys in the audit log reference for your cloud before you depend on this.

4. Pin every score to a version, and freeze releases

A score without a data version can't be reproduced. Delta records every version of a table:

DESCRIBE HISTORY ai_gov.golden.qa_eval;

Have your evaluation job read a specific version and write that version number next to every metric it produces:

SELECT * FROM ai_gov.golden.qa_eval VERSION AS OF 42;

Watch the retention trap. By default, Delta keeps 30 days of table history (delta.logRetentionDuration) but only 7 days of removed data files (delta.deletedFileRetentionDuration), and VACUUM deletes older files. After that, older versions can't be queried. If an auditor asks you to reproduce a number from March, time travel won't help.

So freeze a snapshot for each release:

CREATE TABLE ai_gov.golden_releases.qa_eval_2026_11
  DEEP CLONE ai_gov.golden.qa_eval VERSION AS OF 42;

Grant SELECT only on the releases schema, and don't let anyone modify it.

5. Mask sensitive fields with a policy, not with copies

Golden sets built from real cases often carry personal or health data. The tempting fix is a "safe" copy, which then drifts from the real one.

Attribute-based access control (ABAC), governed tags and automated data classification in Unity Catalog have been generally available since May 2026. Classification can flag likely sensitive columns. You tag them, and one policy masks every tagged column in the schema:

CREATE FUNCTION ai_gov.policies.redact(v STRING)
  RETURNS STRING
  RETURN '[REDACTED]';

CREATE POLICY mask_sensitive_in_golden
ON SCHEMA ai_gov.golden
COMMENT 'Mask tagged sensitive columns for everyone except owners'
COLUMN MASK ai_gov.policies.redact
TO `account users` EXCEPT `golden-data-owners`
FOR TABLES
MATCH COLUMNS has_tag('sensitive') AS sensitive_col
ON COLUMN sensitive_col;

New tables in the schema are covered as soon as their columns carry the tag. Reviewers can still label cases. The raw values never leave the platform.

6. Watch freshness, keep the judge honest, define metrics once

Freshness. Truth changes, and a golden set nobody has touched in a year is probably wrong somewhere. Data quality monitoring (formerly Lakehouse Monitoring) can learn each table's normal commit timing and row volume and mark it stale or incomplete when that breaks. Results land in system.data_quality_monitoring.table_results.

The judge. If you grade with an LLM, use a different model family from the one you're grading. Research presented at NeurIPS 2024 showed LLM evaluators can recognize and favor their own outputs. Check judge agreement with human labels on a sample every release. MLflow 3 stores evaluation datasets as Unity Catalog tables and records the source of each record, a person, a document or a trace, which helps when someone challenges an expected answer.

One definition per metric. If groundedness is computed three ways in three notebooks, people will quote the one they like. Unity Catalog metric views let you define a measure once and reuse it across dashboards.

7. Put the golden data's health on the dashboard

The final step is to make all of this visible next to the model metrics:

Metric Source
Principals who can write to the golden schema information_schema privileges, plus owners
Reads of golden data outside evaluation jobs (30 days) system.access.table_lineage
Permission changes on the golden schema (30 days) system.access.audit
Golden sets past their review date your review log, data quality monitoring
Sensitive columns covered by a masking policy governed tags and policies
Judge agreement with human labels your evaluation runs

When these look healthy, people trust the model metrics beside them. When they don't, you find out before an auditor does.

Why bother now

The EU AI Act asks providers of high-risk systems to govern their training, validation and testing data (Article 10). The AI Omnibus, published in July 2026, moved the Annex III high-risk deadline to December 2, 2027. That's time to build this properly, not a reason to skip it.

Sources

About the author

I'm Anil Prasad. I lead software, data and AI engineering in healthcare, life sciences, energy and finance, with a focus on AI that holds up in regulated environments. I write Field Notes: Production AI on LinkedIn and post here about the engineering behind it.

anilsprasad.com | linkedin.com/in/anilsprasad | github.com/anilatambharii

๐Ÿ“ฐ Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes โ€” full credit and traffic to the original publisher.