---
title: "Weighted Models: Learned Parameters and Written Code"
description: "In a weighted model, training fits numerical parameters to examples. Human-written code defines the calculation and training process. Small models can be traced directly; interpreting a large model ca"
canonical: https://lightmysky.com/learn/computing/weighted-models-learned-parameters-and-written-code-mt_3_1toZUxak
source: https://lightmysky.com/learn/computing/weighted-models-learned-parameters-and-written-code-mt_3_1toZUxak.md
retrieved: 2026-10-19
---

> **Agent view.** This is the Markdown twin of the page, for tools and assistants.
> When to use this site, and the call that answers each job: https://lightmysky.com/agent-instructions.md
> API description (OpenAPI 3.1): https://lightmysky.com/openapi.json · Authentication: https://lightmysky.com/auth.md
> Pricing: https://lightmysky.com/pricing.md · Catalog: https://lightmysky.com/llms.txt · Full catalog: https://lightmysky.com/llms-full.txt
> Every machine-readable file on this domain: https://lightmysky.com/.well-known/ai-catalog.json
> Ask for Markdown with `Accept: text/markdown`, a `.md` address, or `?mode=agent`.

# Weighted Models: Learned Parameters and Written Code

In a weighted model, training fits numerical parameters to examples. Human-written code defines the calculation and training process. Small models can be traced directly; interpreting a large model can be harder.

Subject: Computing · Area: Artificial Intelligence · Ages 14 to 15
Page: https://lightmysky.com/learn/computing/weighted-models-learned-parameters-and-written-code-mt_3_1toZUxak

## Ready when they can

- Contrast a hand-written classification rule with numerical weights fitted from examples
- Distinguish changing parameters during training from using fixed parameters during prediction
- Explain how a small weighted model can be traced and why larger models can be harder to interpret

## Lesson: How learned weights work with code

A person could write a spam rule about a particular phrase. A weighted model instead uses numerical parameters fitted from examples. People still write its calculation and learning code. Other trained models can use different structures.

**Example.** A toy spam model multiplies each of three inputs by its weight and adds the products and a bias (an extra number). Suppose the products are 2, 1 and 0, with bias 1: the total is 4. Code labels totals of 4 or more as spam. Training fits weights and bias. This toy is not a tested service.

Training uses errors on labeled examples to adjust this toy model's weights and bias. Its calculation stays fixed. Updates aim to reduce errors, but need not improve every example. During prediction without parameter updates, the numbers stay fixed. Further training can change them.

Trace inputs, weights and bias through the code to investigate predictions. Learned weights do not remove auditable code. Many interacting parameters can make interpretation harder. Different inputs can produce different outputs with fixed parameters. Retraining can change parameters and predictions for the same input while keeping the calculation fixed.

*(drawing: Training fits the numbers. Prediction uses the fitted numbers without necessarily changing them.)*

**Recap.** Code defines the toy model's calculation. Training fits weights and bias. Prediction uses them, and its calculation can be traced.

## Practice

8 questions on this page, each with its working shown.

## Needs first

- [Bias in AI Systems](https://lightmysky.com/learn/computing/bias-in-ai-systems-mt__BbOjiY5A5)
- [How a Chatbot Picks Its Next Token](https://lightmysky.com/learn/computing/how-a-chatbot-picks-its-next-token-mt_1Zbhamhzai)
- [Machine Learning Basics](https://lightmysky.com/learn/computing/machine-learning-basics-mt_K6qtan847r)

## Opens up

- [Training Data: Where It Came From and What It Leaves Out](https://lightmysky.com/learn/computing/training-data-where-it-came-from-and-what-it-leaves-out-mt_1Lw0TMHShk)
