Lesson 07 · 40 minutes
Apply the NIST AI RMF with one artefact for each function
- Name the four functions of the NIST AI Risk Management Framework and what each one is for
- Build a plan that gives one system at least one real artefact for each function
- Check the plan with a script that tests that each artefact file exists
The lab folder as it stands after this lesson. Unzip it in ~/krlab.
More
The zip holds every file that the course has printed up to here. To start this lesson with the files of the earlier lessons only, take the zip of the lesson before. Type the code yourself first: you learn more.
Scenario
The board of Harbour Credit has heard that a partner bank describes its AI risk work in the language of the NIST AI Risk Management Framework. "Can we show the same for LoanScore on one page? Show me what we have, not what we plan." Your lead asks for a plan with four columns, one for each function. Every entry must point to a file that exists, and a script must say when a column is empty.
Recall
Lesson 6: what does the classification of LoanScore ask its provider to produce?
For a high-risk system under Annex III, nine artefacts, among them a risk management system, data governance, technical documentation, logging, human oversight, and a quality management system.
Lesson 5: what does an explanation record hold?
The decision id, the decision, the probability, the cut-off, the main reasons and the model version. A checker proves that each decision has one.
The idea
The NIST AI Risk Management Framework (AI RMF 1.0, NIST AI 100-1) was released by the US National Institute of Standards and Technology on 26 January 2023. Its use is voluntary. It describes how an organisation can manage the risks of AI systems, in four functions: Govern, Map, Measure and Manage.
| Function | In plain words | An artefact that shows it |
|---|---|---|
| Govern | Build a culture and a structure of risk management: policies, roles, accountability. It runs through the other three. | The policy and the RACI table (lesson 1), the oversight rule |
| Map | Set the context in which the risks are framed: purpose, users, affected people, limits. | A context map, the risk register (lesson 3) |
| Measure | Use quantitative, qualitative or mixed methods to analyse and track the risks. | The fairness report (lesson 4), explanation records (lesson 5) |
| Manage | Put resources against the risks that were mapped and measured, on a regular basis, and respond. | A response plan, an incident log |
NIST also publishes a Generative AI Profile (NIST AI 600-1, July 2024). A profile is a companion document that applies the framework to one kind of system, here generative AI. It names risks that are new or made worse by generative AI, and suggests actions under the four functions. For a language-model system such as HelpBot, it is a source of ideas for the Map and Measure artefacts.
- Govern → Map: policy and roles set the frame
- Map → Measure: context says what to measure
- Measure → Manage: results drive the response
- Manage → Govern: lessons change the policy
The framework is a way of working, not a form to fill in, and NIST says on its own page that AI RMF 1.0 is being revised. Take the current document from NIST. This lesson uses it as a plan structure: for one system, each function gets at least one artefact that exists. "Exists" is a test that a script can run, and it keeps the plan honest.
Worked example
Work in ~/krlab/ai-governance with the environment on. The plan points to files from earlier lessons: policy.md, raci.csv, register.csv and explanations.jsonl.
1. Write the Map artefact
A context map says what the system is for, who uses it, who is affected and where it must not be used. Save context.md.
context.md
# Context map of LoanScore
Intended use: LoanScore ranks consumer loan applications for a credit officer. It never decides alone.
Users: credit officers at Harbour Credit.
People affected: loan applicants. They see the officer's decision and the reasons.
Data: income, debt ratio and years of credit history from the application form. The group is not an input. It is used only to measure fairness.
Known limits: trained on one year of past applications. Not tested on self-employed applicants.
Out of scope: business loans, and any automatic decline.2. Write the Manage artefact
A response plan says what starts it, who acts and in what order. Save response.md. The limit 0.80 is the one of lesson 4. (Lesson 8 says what the monthly report would hold. The course does not build it.)
response.md
# Response plan for LoanScore
Triggers: the selection-rate ratio in the monthly report falls below 0.80. Accuracy on fresh outcomes falls below 0.80. An applicant shows that a reason in a decision was wrong.
Steps:
1. The owner switches LoanScore to "officer only" mode within one working day.
2. The builder finds the cause and writes it in the risk register.
3. The reviewer retests. The approver decides when LoanScore resumes.
4. The owner tells the applicants whose decision was wrong.3. Write the Govern artefact for oversight
Human oversight means that a person watches what the system does and can overrule it. A rule on paper is a start, but it does not prove that people follow it, so the rule also says what the owner samples. Save oversight.md.
oversight.md
# Human oversight of LoanScore
A credit officer reads the score and its two reasons for every application before the decision. The officer may decline to follow the score and writes the reason in the case file. LoanScore cannot approve or decline an application alone.
Each month the owner samples 20 decisions from the case files and counts how many the officer changed. A count of zero is a warning too, because it may mean that nobody reads the score.4. Keep an incident log
An incident is an event in which the system harmed a person, nearly did, or broke a rule: a wrong decision that someone contests, a data leak, an outage that stops decisions. Which incidents count as serious, and whom you must tell and how fast, is a question for your legal people. The log only shows that somebody was told. Dates written as 2026-10-20 sort in the same order as text, so < compares them. inventory.load (lesson 2) reads a CSV file. Save both files.
incidents.csv
id,date,system,severity,reported_to,closed
I1,2026-09-14,HelpBot,minor,,2026-09-15
I2,2026-10-02,LoanScore,serious,Compliance lead,2026-10-20
I3,2026-11-10,HelpBot,serious,Data protection officer,incident_check.py
"""incident_check.py: a serious incident must name who was told.
python3 incident_check.py incidents.csv
"""
import sys
from govlib import finish
from inventory import load
SEVERITIES = ["minor", "serious"]
def problems(path):
found = []
for row in load(path):
if row["severity"] not in SEVERITIES:
found.append(f"{row['id']}: severity {row['severity']!r} is not one of {SEVERITIES}")
if row["severity"] == "serious" and not row["reported_to"].strip():
found.append(f"{row['id']}: a serious incident, and nobody was told")
if row["closed"] and row["closed"] < row["date"]:
found.append(f"{row['id']}: closed before it began")
return found
if __name__ == "__main__":
finish(problems(sys.argv[1]))Run it, then remove the name of the person who was told about I3 and run it again.
python incident_check.py incidents.csv
sed 's/Data protection officer//' incidents.csv > incidents2.csv
python incident_check.py incidents2.csvproblems: 0
PROBLEM I3: a serious incident, and nobody was told
problems: 15. Produce the Measure artefact
The fairness report is the comparison of lesson 4: the plain model, the group threshold that the decisions use, and the reweighted model. > sends the output of a command into a file, and cat prints a file.
python mitigate.py > fairness_report.txt
cat fairness_report.txtmethod accuracy ratio rate A rate B bad loans
threshold 0.50 0.87 0.75 0.75 0.56 25
group B threshold 0.36 0.87 0.80 0.75 0.60 28
reweighted training 0.87 0.77 0.75 0.58 256. Write the plan
Each row names the function, the artefact, the file, the owner and the status. Save rmf_plan.csv.
rmf_plan.csv
function,artefact,file,owner,status
Govern,AI use policy,policy.md,Aino,done
Govern,Accountability table,raci.csv,Aino,done
Govern,Oversight rule,oversight.md,Aino,done
Map,Context map,context.md,Bram,done
Map,Risk register,register.csv,Dana,done
Measure,Fairness measurement,fairness_report.txt,Chidi,done
Measure,Explanation records,explanations.jsonl,Chidi,done
Manage,Response plan,response.md,Femi,done
Manage,Incident log,incidents.csv,Femi,done7. Check the plan
The checker has three jobs. Each function must have at least one artefact whose file exists and is not empty. Each artefact must have an owner. An artefact that is marked done must have its file. Path.is_file() tests that a file exists, and stat().st_size is its size in bytes. The script also prints the four columns side by side.
plan_check.py
"""plan_check.py: every function of the NIST AI RMF needs at least one artefact that exists.
python3 plan_check.py rmf_plan.csv [folder]
"""
import csv
import sys
from pathlib import Path
from govlib import finish
FUNCTIONS = ["Govern", "Map", "Measure", "Manage"]
def load(path):
with open(path, newline="") as f:
return list(csv.DictReader(f))
def exists(folder, name):
path = Path(folder) / name
return path.is_file() and path.stat().st_size > 0
def problems(path, folder="."):
rows, found = load(path), []
for name in FUNCTIONS:
if not any(r["function"] == name and exists(folder, r["file"]) for r in rows):
found.append(f"{name}: no artefact exists")
for r in rows:
if r["function"] not in FUNCTIONS:
found.append(f"{r['artefact']}: {r['function']!r} is not one of {FUNCTIONS}")
if not r["owner"].strip():
found.append(f"{r['artefact']}: no owner")
if r["status"] == "done" and not exists(folder, r["file"]):
found.append(f"{r['artefact']}: marked done, but {r['file']} is missing or empty")
return found
def table(rows):
columns = {name: [r["file"] for r in rows if r["function"] == name] for name in FUNCTIONS}
print("".join(name.ljust(22) for name in FUNCTIONS).rstrip())
for i in range(max(len(c) for c in columns.values())):
print("".join((columns[name][i] if i < len(columns[name]) else "").ljust(22) for name in FUNCTIONS).rstrip())
if __name__ == "__main__":
table(load(sys.argv[1]))
finish(problems(*sys.argv[1:3]))python plan_check.py rmf_plan.csv
echo "exit code $?"Govern Map Measure Manage
policy.md context.md fairness_report.txt response.md
raci.csv register.csv explanations.jsonl incidents.csv
oversight.md
problems: 0
exit code 08. Take one column away
grep -v prints the lines that do not hold the text. Remove the two Measure rows and check again.
grep -v "^Measure" rmf_plan.csv > plan2.csv
python plan_check.py plan2.csvGovern Map Measure Manage
policy.md context.md response.md
raci.csv register.csv incidents.csv
oversight.md
PROBLEM Measure: no artefact exists
problems: 1The checker says that Measure has no artefact. The fairness report is the evidence that people ask for under Measure.
Your turn
The HelpBot team started its own plan. It is in the folder helpbot: save the files below, and create the empty file helpbot/tests.txt with touch (it makes an empty file). There are no steps.
helpbot/policy.md
# Chatbot policy of Harbour Credit
HelpBot answers questions about orders and fees from the handbook only. It never gives legal or credit advice. A person takes over when the customer asks for one.helpbot/context.md
# Context map of HelpBot
HelpBot answers customer questions in the app. Customers can read every answer. It runs on a hosted language model from ModelHost and sees the handbook and the customer's question, not the customer's account.helpbot/rmf_plan.csv
function,artefact,file,owner,status
Govern,Chatbot policy,policy.md,Dana,done
Map,Context map,context.md,Bram,done
Measure,Answer test results,tests.txt,Chidi,done
Manage,Response plan,response.md,,plannedtouch helpbot/tests.txtRun python plan_check.py helpbot/rmf_plan.csv helpbot (the second word is the folder where the files are). Then repair the plan: write a real test record in tests.txt, write response.md in the folder, and give its row an owner and the status done. Answer from your runs.
Last, name two risks of the register of lesson 3 that apply to a chatbot such as HelpBot, and the function of the plan under which you would handle each one. The page does not check this part.
Check yourself
Why does the checker test that the file exists, and not only that the plan lists it?
A plan that lists a file can be written in an afternoon. A file that exists is evidence of work done. Testing existence is the cheapest way to separate a plan from a promise. It still cannot tell whether the content is good: a person reviews that.
Which function is Govern, and why is it described as running through the other three?
Govern holds the policies, roles and accountability. Without it, a context map has no owner, a measurement has no limit that someone chose, and a response has nobody to start it. So its artefacts support every other function.
Is a plan that passes the checker "compliant with the NIST AI RMF"?
No. The framework is voluntary and has no certificate, and a checker cannot judge quality. A passing plan shows that each function has at least one real artefact for this system. It is a good starting point for a review and for the pack of lesson 13.
Where do the risks of the register fit among the four functions?
The register is a Map artefact, because it frames the risks of the system in its context. The fairness report is a Measure artefact. The controls of the register that you apply are Manage actions.
Field notes
- One artefact for each function is a floor, not a target. A real programme has several for each function, and a review date for each one (lesson 8). It also keeps an incident log, like the one in this lesson, and asks the legal team which incidents must be reported, to whom, and how fast.
- Use the profile that fits the system. The Generative AI Profile helps for language-model systems. A scoring model such as LoanScore gains little from it, and more from the core framework.
- Link the plan to the other frameworks. The same register and the same records serve the EU AI Act (lesson 6) and an ISO/IEC 42001 management system (lesson 8). NIST publishes a crosswalk from the AI RMF to ISO/IEC 42001, which you can use as a map.
- Keep the status honest.
plannedis a fine status. Adonewith no file is the kind of claim that auditors check first, and the script checks it for you. - NIST says on its page that AI RMF 1.0 is being revised. Put the version of the framework that you used in the plan, so that a reader knows what you compared against.