Skip to content
Tutorials Center
My learning

Topics

Lesson 37 of 53 ยท Safety, Risks and Responsibility

Bias, Privacy, Copyright and Responsible Use

Understand training-data bias, protect personal data with PII redaction, handle licensing and memorization, and build human oversight into LLM apps.

A model is a mirror of its training data, and that data is a huge, uneven sample of what people wrote. It contains stereotypes, private details, copyrighted work and plain mistakes. When you build an application on top of a model, you inherit those properties and you become responsible for what the application does with them.

This lesson covers four practical areas: bias, privacy, copyright and licensing, and the human and legal controls around them. It is not legal advice. Rules differ by country and change quickly, so treat it as a map of the questions to ask, then check with a qualified person for your own product. It builds on Hallucinations and Prompt Injection and LLM Security.

Four areas of responsibility

Bias Unequal quality or stereotyped output.
Privacy Personal data in prompts, logs and training.
Copyright Who owns inputs and outputs.
Oversight People stay accountable.

Each one needs a decision, not just a disclaimer.

1 / 2

Where bias comes from

Bias is a systematic difference in how a system treats people or topics. In language models it enters at several points:

  • Data coverage. Web text over-represents some languages, regions, ages and viewpoints. A model is usually better in English than in Swahili, and better about topics that many people write about.
  • Associations. If a corpus mostly pairs "nurse" with "she" and "engineer" with "he", the statistics are learned like any other pattern, as you saw in Embeddings.
  • Labeling and tuning. The people who rate answers during tuning have their own backgrounds and instructions, which shapes what counts as a good answer.
  • Your prompt and your users. A prompt that says "a typical CEO" invites the default association.

Bias shows up as stereotyped text, as lower accuracy for some groups, and as unequal refusals. It can also be a harm of omission: a model that works poorly for a dialect quietly serves those speakers worse.

Measuring it with paired prompts

You cannot fix what you do not measure. A simple, honest test is a paired prompt test: change only one attribute (a name, a pronoun, a country) and compare the outputs. The demo below uses a deliberately biased toy "model" that completes a sentence from learned counts, then measures the gap.

Python A paired-prompt bias probe on a toy model

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The model never "decided" to stereotype; it repeated the data. Real evaluations use hundreds of paired prompts and compare accuracy, refusal rate, sentiment or toxicity between groups. What helps in practice:

  • Test with varied inputs (names, dialects, languages) as part of your eval suite.
  • Give explicit instructions about fairness in the system prompt, then verify they work rather than assuming.
  • Avoid using a model alone for high-stakes decisions about people such as hiring, lending or medical triage.
  • Publish known limits to users.

Prompting reduces bias but does not remove it. Treat it as a risk to monitor, like latency or cost.

Privacy: personal data in prompts, logs and training

Anything you put in a prompt leaves your system and reaches the model provider (or your own server). That text may also end up in logs, traces, analytics and caches. PII (personally identifiable information) means data that identifies a person: names, email addresses, phone numbers, national IDs, addresses, payment details, health data and more. Many laws regulate it, and the strictest rules usually apply to health, financial and children's data.

Good habits:

  1. Minimize. Send only what the task needs. A summary of a support ticket rarely needs the customer's phone number.
  2. Redact before sending and restore afterwards when the real value matters.
  3. Read the provider terms. Check whether your data is used for training, how long it is retained, and where it is stored.
  4. Protect logs. Prompt logs are among the most sensitive data you hold. Limit access, set retention and apply the same redaction.
  5. Do not put secrets in prompts. Passwords and API keys do not belong in text a model sees.

Redaction with placeholders

A common pattern replaces each sensitive value with a stable placeholder, keeps a private mapping, sends the redacted text, and swaps the placeholders back in the reply.

Python Redact PII, then restore it in the reply

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Notice the last line: regular expressions find structured values but not names, street addresses or free-text details like "my daughter's school in Leeds". Production systems add a named-entity recognition model or a dedicated PII service and still accept a miss rate. Redaction lowers risk; it does not guarantee anonymity.

Three separate questions get mixed together:

  • Training data. Whether training on copyrighted works is allowed is being decided by courts and legislators, and the answer differs between jurisdictions. As a builder you mostly rely on your provider's terms and, for open-weight models, the model's license.
  • Memorization. Models can reproduce rare, repeated text almost verbatim (a famous license text, a widely copied code snippet, sometimes personal data). It is more likely with duplicated data and larger models. Do not assume that output is original just because a model produced it.
  • Ownership and use of outputs. Whether AI-generated output can be copyrighted at all depends on the country and the amount of human creative input. Providers' terms say who may use outputs commercially.

Practical rules:

  • Check the license of any open-weight model (some restrict commercial use or large deployments) and of any dataset you fine-tune on.
  • For code, run a license or similarity scanner on generated code that goes into a product.
  • Do not paste confidential or third-party material into tools you do not control.
  • Keep records of where your own training or retrieval data came from, so you can remove a source on request.
  • In RAG, you are showing someone's text to a model on purpose, so make sure you have the right to use it.

Disclosure, oversight and regulation

Disclosure. Tell people when they talk to a machine and when content was generated, especially for realistic images, audio and text that could be mistaken for human work. Some jurisdictions now require it.

Human oversight. Decide who is accountable when output is wrong. Useful patterns:

  • Human in the loop: a person approves before anything is sent or executed (refunds, emails, code merges).
  • Human on the loop: the system acts, and a person samples and audits results.
  • Escalation: the app hands over to a person when confidence is low or the topic is sensitive (medical, legal, self-harm).
  • Reversibility: prefer actions that can be undone.

Regulation. Laws are moving fast. The broad ideas to know: data protection laws such as the EU GDPR (lawful basis, data minimization, rights to access and deletion), risk-based AI laws such as the EU AI Act (stricter duties for high-risk uses like hiring or credit, transparency duties for chatbots and synthetic media), sector rules (health, finance, education) and consumer protection law (you cannot make misleading claims about what your AI does). Requirements depend on where your users are, not only where you are.

A responsible-use checklist

Test Paired prompts across groups and languages.
Minimize Send and log only what you need.
Check terms Provider, model and data licenses.
Disclose Say when AI is involved.

Add a human review step wherever a mistake would hurt someone.

1 / 2

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. A paired-prompt test changes only a name and finds different answer quality. What does this show?

    Holding everything constant except one attribute isolates that attribute as the cause of the gap, which is the idea behind paired-prompt bias tests.
  2. 2. Why is regex redaction alone not enough to anonymize text?

    Patterns match formats such as emails or card numbers. Names, addresses and descriptive details have no fixed format, so you need extra tooling and still expect misses.
  3. 3. Which is the best default for personal data in prompts?

    Data minimization lowers risk. System prompts are not secret storage, and prompts and logs are sensitive in their own right.
  4. 4. What does 'memorization' mean for copyright risk?

    Memorization is mostly seen with duplicated or rare text, and larger models do it more, so generated output is not automatically original.

Summary

  • Bias comes from data coverage, learned associations, tuning labels and your own prompts. Measure it with paired prompts and track the gaps.
  • Minimize the personal data you send, redact structured PII, protect logs and read provider terms. Regex redaction misses names and context.
  • Copyright questions cover training data, memorization and output ownership. Check model, dataset and provider licenses.
  • Disclose AI use, keep a person accountable for important decisions, and learn which laws apply to your users.

Next: Fine-Tuning vs Prompting.