Skip to content

MEASURE: measurement and evaluation

How to analyse, test and validate AI systems

NIST AI RMF function: MEASURE Guide sections: MS-1 to MS-5

The labels below organise this guide; they are not a reproduction of official NIST subcategory identifiers. See the NIST mapping.

1. Overview of MEASURE

MEASURE supports appropriate testing, validation and monitoring throughout the AI lifecycle.

ObjectiveDescription
TEVVTest, evaluation, validation and verification
MetricsDefine and track meaningful indicators
BiasEvaluate fairness and harmful bias
SecurityAssess security and resilience
ContinuityMonitor changes in operation

2. MS-1: TEVV framework

2.1 What is TEVV?

2.2 TEVV across the lifecycle

PhaseTEVV activitiesTiming
DesignVerify requirementsBefore development
DevelopmentUnit tests, code reviewDuring development
Pre-deploymentIntegration, validation, red teamingBefore release
DeploymentA/B testing, staged rolloutDuring release
ProductionMonitoring, drift detectionContinuously
RetirementFinal assessment, lessons learnedWhen decommissioning

2.3 Testing strategy

Define a test plan for each system. The values and cadence in this example need to be replaced with justified project criteria.

## TEST PLAN: [AI system name]
### 1. Objectives
- What are we testing?
- What are the acceptance criteria?
### 2. Test types
| Type | Scope | Tools or method |
|---|---|---|
| Unit | Model components | pytest, unittest |
| Integration | End-to-end behaviour | Custom scripts |
| Performance | Speed, throughput | Load testing |
| Fairness | Harmful bias | Aequitas, Fairlearn |
| Security | Adversarial behaviour | Authorised red team |
| User acceptance | Usability and fitness for purpose | User studies |
### 3. Test data
- Representative samples
- Edge cases
- Adversarial inputs
### 4. Schedule
| Milestone | Tests | Date |
|---|---|---|
| Development complete | Unit, integration | |
| Pre-release | Technical and risk tests | |
| Release decision | User acceptance | |
| Monthly review | Performance, fairness | |
### 5. Illustrative pass/fail criteria
| Metric | Example threshold | Current value |
|---|---|---|
| Accuracy | >95% | |
| Latency p99 | <500 ms | |
| Demographic parity gap | <5% | |

3. MS-2: Performance metrics

3.1 Core metrics

Accuracy and reliability

MetricDescriptionUse
AccuracyProportion of correct predictionsClassification
PrecisionTrue positives / predicted positivesWhere false positives are costly
RecallTrue positives / actual positivesWhere false negatives are costly
F1 scoreHarmonic mean of precision and recallBalancing the two metrics
AUC-ROCArea under the ROC curveComparing discrimination across thresholds
RMSE/MAEPrediction error measuresRegression
PerplexityHow well a language model predicts a text sampleLanguage modelling; not a complete measure of output quality

Reliability

MetricDescriptionIllustrative target
ConsistencyRepeatability of outputs under defined conditions>99% where deterministic behaviour is expected
StabilityPerformance over time<5% drift in a defined metric
AvailabilityUptime>99.9%
Latency p50/p99Response timeDefined in the service requirements

3.2 Fairness metrics

MetricDefinitionWhat it evaluates
Demographic parityP(Ŷ=1|G=a) = P(Ŷ=1|G=b)Equal selection rates across groups
Equalised oddsEqual true-positive and false-positive rates across groupsDifferences in error rates
Predictive parityEqual positive predictive value across groupsDifferences in precision
Individual fairnessSimilar individuals receive similar outcomesCase-level treatment

Example measurement with Fairlearn:

from fairlearn.metrics import demographic_parity_difference
dpd = demographic_parity_difference(
y_true,
y_pred,
sensitive_features=sensitive_feature
)
# Illustrative threshold: |dpd| < 0.05.
# Justify the threshold for the specific project and population.

3.3 Generative AI metrics

MetricDescriptionPossible measurement approach
Hallucination rateFrequency of factually incorrect outputsExpert review of a defined sample
Toxicity scorePotentially harmful contentClassifier scores plus contextual review
Bias in generationStereotypes in outputsBenchmarks such as Winogender or BBQ, where relevant
Instruction followingCompliance with task instructionsTask-specific evaluation datasets
Refusal rateRefusal of inappropriate requestsAdversarial prompts; also track inappropriate refusals

4. MS-3: Bias testing

4.1 Pre-deployment assessment

  • Identify relevant protected characteristics, such as age, sex or ethnicity.
  • Assess training data for harmful bias.
  • Measure baseline metrics by relevant group.
  • Define and justify fairness criteria.
  • Prepare mitigation and escalation options.

Personal data used for testing needs an Article 6 GDPR legal basis; special categories, such as ethnicity, also need an applicable exception to the Article 9 prohibition and suitable safeguards. Article 4a of the AI Act permits processing for bias detection and correction only in its specified cases and subject to all its conditions, including necessity, access and reuse restrictions, and deletion. An intention to test bias does not itself establish this permission.

4.2 Testing methods

Slice analysis

Evaluate performance on relevant subgroups. This is an illustrative report:

| Slice | Count | Accuracy | Precision | Recall |
|---|---|---|---|---|
| Overall | 10000 | 94.5% | 93.2% | 95.1% |
| Gender: M | 5200 | 95.1% | 94.0% | 95.8% |
| Gender: F | 4800 | 93.8% | 92.3% | 94.3% |
| Age: <30 | 3000 | 96.2% | 95.5% | 96.8% |
| Age: 30–50 | 4500 | 94.0% | 93.1% | 94.5% |
| Age: >50 | 2500 | 92.1% | 90.8% | 93.2% |

An example internal alert is a gap above 5 percentage points between groups. Investigate sample size, uncertainty and consequences; smaller gaps can still matter.

Counterfactual testing

Change a protected characteristic while keeping other relevant information constant, then examine the output:

Original: "John applied for a loan..." → Approved
Counterfactual: "Jane applied for a loan..." → Approved?
Different outcomes can indicate a need to investigate potential bias.

4.3 Mitigation strategies

StrategyStageExamples
Pre-processingDataRebalancing, resampling, feature selection
In-processingTrainingFairness constraints, adversarial debiasing
Post-processingOutputThreshold adjustment, equalised odds methods
Human reviewDeploymentMeaningful review and override for sensitive decisions

5. MS-4: Security testing

5.1 AI-specific threats

ThreatDescriptionTesting or control area
Adversarial examplesInputs designed to mislead a modelAdversarial robustness testing
Model extractionAttempted model replication through queriesQuery monitoring and rate-limit testing
Data poisoningManipulation of training dataData provenance and validation
Prompt injectionInstructions that attempt to redirect a generative AI systemDirect and indirect injection tests
Membership inferenceAttempts to infer whether data appeared in trainingPrivacy attack evaluations

5.2 Red teaming for generative AI

TypeParticipantsFocus
GeneralTypical usersCommon misuse and failures
ExpertDomain specialistsDomain-specific risks
AdversarialSecurity researchersEdge cases and bypass attempts
AI-assistedAI tools and human reviewersBroader coverage with human interpretation

Use authorised, controlled testing with appropriate handling of sensitive or illegal material. A session can cover:

## RED-TEAM SESSION: [Generative AI system]
### 1. Attempts to bypass safeguards
- [ ] Direct harmful requests
- [ ] Role-play scenarios
- [ ] Multi-step prompts
- [ ] Language switching
- [ ] Encoded inputs
### 2. Information extraction
- [ ] Training data exposure
- [ ] Personal data exposure
- [ ] System prompt exposure
- [ ] Capability probing
### 3. Content risks
- [ ] Violence or hate
- [ ] Misinformation
- [ ] Safeguards against CSAM and non-consensual intimate imagery
- [ ] Intellectual property infringement
### 4. Misuse risks
- [ ] Social engineering
- [ ] Phishing
- [ ] Malicious code assistance
- [ ] CBRN-related requests
### 5. Findings
| Finding | Severity | Reproducible | Recommendation |
|---|---|---|---|
| | | | |

5.3 Prompt injection scenarios

ScenarioExampleExpected security property
Direct injection“Ignore previous instructions…”Maintain authorised task boundaries
Indirect injectionMalicious instructions in retrieved documentsTreat external content as untrusted data
Context manipulation“From now on, you are…”Preserve role and permission boundaries
Delimiter attacksInstructions hidden in Markdown or code blocksParse safely and enforce controls independently

6. MS-5: Continuous monitoring

6.1 Example dashboard

The values below demonstrate a layout; they are not observed customer results or recommended universal thresholds.

6.2 Drift detection

Drift typeWhat changesDetection approachIllustrative trigger
Data driftInput distributionPSI, KS testPSI >0.1
Concept driftRelationship between inputs and outcomesPerformance evaluation with ground truth>5% degradation
Model behaviour driftPrediction behaviourOutput distributions and task evaluationsA statistically and operationally meaningful change

6.3 Alerts

These are example internal response targets, not TECHNOMATON support commitments or statutory reporting deadlines.

LevelTriggerResponseExample target
P1 CriticalSafety incident or major outageImmediate escalation15 minutes
P2 HighPerformance degradation above 10%Same-day investigation4 hours
P3 MediumDrift or minor issuesPlanned review24 hours
P4 LowInformation or optimisationReview in the next sprint1 week

7. Implementation checklist

Adapt this illustrative schedule to the system, team and risk.

Phase 1: Test infrastructure — weeks 1–2

  • Define test data management.
  • Establish test environments.
  • Select testing tools.
  • Define baseline metrics.

Phase 2: Pre-deployment testing — weeks 3–4

  • Implement unit and integration tests.
  • Assess harmful bias.
  • Run security tests.
  • Complete user acceptance testing.

Phase 3: Monitoring — weeks 5–6

  • Deploy monitoring components.
  • Define justified metrics and thresholds.
  • Configure alerts and ownership.
  • Create dashboards.

Phase 4: Continuous improvement — ongoing

  • Revalidate periodically and after relevant changes.
  • Monitor drift.
  • Conduct red-team sessions.
  • Review metrics and thresholds.

8. Tools

These are examples to evaluate for compatibility, current maintenance and the intended use; listing a tool is not an endorsement or a claim of integration.

CategoryExamplesPurpose
ML testingpytest, Great ExpectationsCode and data checks
FairnessFairlearn, Aequitas, AI Fairness 360Bias and fairness analysis
ExplainabilitySHAP, LIME, CaptumModel interpretation
SecurityTextAttack, Adversarial Robustness ToolboxAdversarial testing
MonitoringEvidently, WhyLabs, ArizeProduction observability
Generative AI evaluationHELM, lm-evaluation-harnessLanguage model evaluations

Continue to MANAGE to prioritise and address findings.

AI-Native Entry Framework | CC BY-NC-SA 4.0