Generative AI and LLMs

Responsible Generative AI

Lesson 9 of 10

Building something that works is half the job. The other half is making sure it does not cause harm to the people who use it or who are affected by it.

Accuracy and over-reliance

Generated text sounds authoritative whether or not it is correct, and people tend to trust it.

  • Tell users clearly that content is generated by AI and may contain errors.
  • Show sources so that claims can be checked.
  • Keep a qualified person responsible for decisions with real consequences, such as those about health, money, law, employment and safety.

Bias and fairness

Models learn from human-written data and can reproduce its stereotypes and imbalances. An assistant may write differently about different groups, or perform worse for some languages and dialects.

  • Test with inputs that vary names, genders, ages and backgrounds while keeping everything else the same, and compare the outputs.
  • Measure quality separately for the different groups of people you serve.
  • Give users a way to report problems, and act on the reports.

Privacy

  • Send a model only the personal data the task needs.
  • Find out how your provider stores and uses what you send, including whether it is used for training and how long it is kept.
  • Do not place personal or confidential data in a prompt if the person receiving the answer is not entitled to see it.
  • Follow the data protection law that applies to you. Requirements differ between countries, so take proper advice.

Security

The prompt engineering course covered prompt injection. In summary:

  • Treat everything a model reads as untrusted, including retrieved documents and web pages.
  • Treat everything it writes as untrusted, and validate it before use.
  • Give it the least access it needs.
  • Require human approval for actions that cannot be undone.

The OWASP Top 10 for LLM applications is a good checklist of the main risks.

Intellectual property

  • Models can reproduce passages of copyrighted text or code from their training data.
  • The ownership of generated content, and the rules on training data, differ between countries and are still being settled.
  • Read the terms of the tools you use, and take legal advice before relying on generated content commercially.

Misuse

The capabilities that help users can also be turned to harm: spam, fraud, impersonation and disinformation.

  • Define what your application is for, and decline requests outside it.
  • Limit the rate of use and watch for abuse.
  • Do not build features whose main use is to deceive.

Transparency

  • Tell people when they are talking to an AI system.
  • Label generated images, audio and video where they could be mistaken for real.
  • Document what the system is for, what data it uses and its known limits.

Environmental and financial cost

Training and running large models uses significant energy and money. Use the smallest model that does the job well, avoid unnecessary calls and cache results where you can.

Regulation

Governments are introducing rules for AI. The European Union’s AI Act, for example, sets obligations that depend on the level of risk of a system. Requirements vary by country and sector and continue to change. If your application affects people’s rights, safety or access to services, find out which rules apply to it.

A framework

The NIST AI Risk Management Framework organises this work into four functions.

Function Meaning
Govern Set policies and assign responsibility
Map Understand the context and identify the risks
Measure Assess and track those risks
Manage Prioritise them and act

A review before release

  • What is the worst plausible outcome of a wrong answer, and who bears it?
  • Has the system been tested with difficult, hostile and diverse inputs?
  • Do users know they are dealing with AI, and can they reach a person?
  • What data is sent to the model, and is that permitted?
  • Which actions can the system take without approval?
  • Who monitors it after release, and how are problems reported and fixed?

Practice

Choose an AI feature you use or plan to build. Answer the six review questions for it in one sentence each.