Unit 10 / 11

Bias, Ethics and Cost: Responsible and Sustainable AI Engineering

Gains:

  • Ability to detect hidden discrimination by understanding that bias comes from data (historical, representational, measurement, aggregation) and evaluating the model on the basis of subgroups
  • Ability to provide explainability, human oversight and accountability in high-impact decisions and document transparency with a model card
  • Ability to manage financial and environmental costs without compromising quality with the smallest adequate model, prompt shortening, cache and batch

A model may technically work perfectly but still be wrong — if it is unfair to some people, inexplicable, or produces unsustainable costs. In this unit, we cover three "invisible" but decisive dimensions of ML engineering: bias and fairness, ethics and transparency, cost and sustainability. These are not ornaments added later, but integral parts of engineering quality.

Where does prejudice come from?

Model bias (the model's systematic treatment of certain groups differently/unfairly) usually comes from the data, not the model. Sources:

  • Historical bias: Data reflects past injustice. If a particular group has been given less credit in the past, the model trained on that data will learn and perpetuate this discrimination.
  • Representation bias: Some groups are underrepresented in the data; the model performs poorly for them (e.g. low accuracy in a small sample demographic).
  • Measurement bias: Labels themselves are biased (e.g., if the definition of a “good employee” is based on past promotion decisions).
  • Aggregation bias: Because data comes from a specific channel, it is not representative of the universe.

The model doesn't just learn these biases; scales up by automating it. One person's biased decision affects another person; The verdict of a biased model is millions.

Caution: Don't fall into the mistake of saying "the model is neutral because it's just math." The model learns and automates human bias in data. Neutrality is not a default, but an outcome that must be measured and ensured.

measuring justice

To manage justice, it is necessary to measure it first. To do this, evaluate the model on a subgroup basis: are metrics such as accuracy, recall, false positive rate equal across different demographic groups? A few concepts of justice:

  • Group fairness: Does the model treat different groups correctly/incorrectly at similar rates?
  • Equality of opportunity: Does the model capture the truly positive ones equally in all groups (equal recall)?

Important fact: different definitions of justice may not be satisfied at the same time (this is a mathematical consequence). Which definition of justice takes priority in this context is an ethical and business decision, not a technical one, and is made together with stakeholders.

Weak approach / Strong approach

Poor: "The overall accuracy of the model is 88%, which is fair."

Güçlü: "Overall accuracy was 88%, but when we divided it into subgroups, the recall was 91% in one group and 67% in another group — the model was systematically missing that group. We documented the reason (lack of representation), collected data for that group and re-evaluated it with the equal-recall goal. We decided with the stakeholders which definition of fairness we would prioritize."

The difference: the strong approach does not hide behind the general metric, it separates subgroups and treats fairness as an open decision.

Ethics and transparency

The core principles of responsible AI are:

  • Explainability: Can it be explained why the model made this decision? In high-impact decisions (credit, hiring, healthcare) one has a right to an explanation. The unexplained model should not be used in these areas or should be supported by an explainable method.
  • Human oversight: High-impact decisions should not be made automatically; The model suggests, the human confirms.
  • Accountability: It should be clear who is responsible when the model makes an error. “The model decided” is not an excuse.
  • Transparency: The user should know that they are interacting with an AI and how their data is used.

In many countries and sectors, these principles are also embedded in legislation (transparency, auditing and human oversight obligations for high-risk AI systems). The engineer is responsible for knowing the regulations of his field.

Tip: Keep a "model card" for each high-impact model: what the model does, what data it was trained on, how well/poorly it works in which groups, what its known limits are. This document is both a transparency and accountability tool.

Cost and sustainability

AI is not cheap. Cost is managed in two dimensions:

Financial cost:

  • Token cost (LLM): Each request and response costs tokens; As the volume grows, the bill grows. Unnecessarily long prompts, overly large model selection and uncontrolled agent loops (unit 5) inflate the cost.
  • Training and hosting: Fine-tuning and model presentation incur hardware costs.
  • Optimization: Do not use a large model if a small model is sufficient; cache frequently asked questions; shorten the prompt; Batch what can be processed.

Environmental cost: Large model training and inference consumes significant energy. Sustainability makes avoiding unnecessary calculations (correct size model, efficient architecture) a professional responsibility.

Tip: The first rule of cost optimization: "What is the smallest adequate model for this job?" Putting the most powerful model everywhere is like hammering a nail in with a sledgehammer — expensive and unnecessary.

three mini cases

Case 1 - Hidden discrimination. A recruitment screening model looked good overall. Subgroup analysis found that the model systematically underscored female candidates because the historical data was male-dominated—it had learned historical bias. The model was stopped, data balanced, and fairness metrics monitored. General righteousness covered up hidden discrimination.

Case 2 - Unexplained rejection. A credit model was rejecting applications, but no one could explain why. When a customer requested legal clarification, the team was unable to respond. The model was withdrawn from use in high-impact decisions until an explainable method was added and justification was produced for each rejection. Lesson: explainability is essential in high-impact decision making.

Case 3 - Bill shock. One team was using the largest LLM and very long prompts for each request. The monthly bill has grown unexpectedly. Post analysis: most requests could be solved with a small model, half of the prompts were redundant, and frequent questions could be cached. These three optimizations reduced the cost significantly, without compromising the quality. Lesson: the most powerful model is not necessary everywhere.

Copiable templates

Help me evaluate this model for bias/fairness. Which subgroups (demographic/segment) should I divide and measure? What metrics (accuracy, recall, false positive rate by group) should I compare? Can different definitions of fairness conflict, which should I prioritize in this context and why? Model/decision context: [explanation]

Produce a draft model card for this high-impact model. Should include: purpose, training data and date, performance in subgroups, known limits, appropriate/inappropriate use, explainability status, point of human oversight. Model: [description]

Help me reduce the cost of this LLM implementation, without compromising the quality.Available: model size, average prompt length, request volume, is there cache?Evaluate:1) Is the smaller model enough (for which tasks)?2) Can the prompt be shortened?3) Can frequent requests be cached?4) Is there work available for batch?Write down the estimated impact of each suggestion.

Produce an ethics/responsibility checklist for this high-impact decision system.- Explainability: can the decision justification be produced?- Human oversight: is the high-impact decision subject to approval?- Accountability: who is responsible in case of error?- Transparency: does the user know that AI is being used?- Regulation: what are the legal obligations involved?System: [description]

Bias source table

Source

symptom

precaution

historical bias

Past discrimination continues

Data audit + fairness metric

representation bias

Low accuracy in small sample group

Subgroup analysis + balancing

measurement bias

biased labels

Label process review

Aggregation bias

The universe is not represented

Resource diversification

Common mistakes

  • Relying on the overall metric. Hidden discrimination cannot be seen without subgroup analysis.
  • Assuming "model neutral". The model learns and amplifies bias in the data.
  • Leaving the high-impact decision to the unexplained model. Legal and ethical risk.
  • Bypassing human supervision. "The model decided" is no excuse.
  • Putting the biggest model everywhere. Unnecessary cost and energy.
  • Not tracking cost. The bill swells silently.

In summary

A technically correct model is still a failure if it is not fair, explainable and sustainable. Bias mostly comes from the data and the model magnifies it at scale; Measure fairness by subgroups and agree with stakeholders which definition of fairness to prioritize. Explainability, human oversight, and accountability are essential in high-impact decisions; Document transparency with model card. Manage cost and energy: choose the smallest adequate model, shorten the prompt, use cache and batch. These dimensions are integral parts of engineering quality, not frills added later.

Application task

Divide a model into at least two subgroups and compare the recall and false positive rate on a group basis; If there is a significant difference, write the reason and a precaution. Draft a brief model card for a high-impact model (purpose, data, subgroup performance, boundaries, explainability). Identify at least two concrete optimizations (minimum / prompt truncation / cache / batch) to reduce the cost of implementing an LLM and write down their estimated impact.

checklist

  • [ ] I evaluated the model based on subgroups, I did not rely on the general metric.
  • [ ] I decided with the stakeholders which definition of justice I would prioritize.
  • [ ] High impact decision is explainable and subject to human approval.
  • [ ] I documented transparency and boundaries with the pattern card.
  • [ ] I chose the smallest adequate model; I optimized prompt/cache/batch.
  • [ ] I monitor the cost and energy impact.