COMP10002 Foundations of Algorithms
Site Guide
A guide to what each part of the assignment site is for, what to read in order, and what to use only when you get stuck.
Overview
This site is designed so that you can read the main assignment page straight through without constantly jumping away to background material.
The basic idea is:
- the main assignment page is the required path
- the Concepts page collects both the needed explainers and the optional demos, tooling, and background material
If you are unsure what to read next, the answer is usually: go back to the main assignment page and keep following the stages.
First pass: what to read in order
For a first serious pass through the assignment, use this order:
- Read the main assignment page from the top down.
- Skim the “Getting started” and stage sections so you know the overall shape.
- Open
a1.cbeside the site and match each stage description to the scaffold function. - Only click a concept link when a term is slowing you down.
- Come back to the main page after reading the explainer.
That reading pattern matters because the assignment is easier when you keep the algorithmic flow in mind:
- Stage 0 reads the token list and numeric input
- Stage 1 creates one-hot embeddings from the token list
- Stage 2 computes
Q,K, andVfrom the provided prompt embeddings - Stages 3 to 5 do prompt attention
- Stage 6 extends the same logic to generated tokens using the KV cache
What each section of the site is for
Main assignment page
Use Assignment for:
- the actual task you must implement
- the exact stage order
- the scaffold function signatures
- the output format
- testing notes, pitfalls, and marking notes
This is the page you should keep open while coding.
Concepts page
Use Concepts when one idea is blocking you, or when you want optional extra help.
The needed concept explainers are best for short detours such as:
- “What does dot product mean here?”
- “Why do we subtract the max in softmax?”
- “What exactly does the KV cache store?”
The optional material on that page is useful for different reasons:
- Transformer explainer if you want the bigger model picture
- Transformer history if you want to know why this architecture mattered historically
- Parameters and model scale if terms like “7B parameters” are distracting you
- Toy demo if you want to connect the numeric input and output back to token positions
- Compiler tooling if you want practical help compiling, checking warnings, and using tools such as
ccheckorcppcheck - Annotated scaffold if the raw
a1.cfile is what is slowing you down rather than the maths - Strings in C if Stage 1 is conceptually fine but you are rusty on
strcmp,strcpy, or null-terminated strings - qsort and function pointers in C if Stage 1 makes sense except for the library sort or its comparison function
None of those pages replace the main assignment instructions.
When you are stuck
Different kinds of confusion call for different pages.
If you are stuck because:
- you do not understand the overall task, return to the main assignment page
- one term is confusing, open the matching concept page
- you want more intuition before coding, reread the overview on the main assignment page and then open Transformer explainer if you still want the bigger picture
- the scaffold itself feels dense, use Annotated scaffold
- Stage 1 makes sense but C strings do not, use Strings in C
- Stage 1 makes sense but
qsort(...)or the comparison callback looks strange, use qsort and function pointers in C - your code compiles badly or tools are unfamiliar, use Compiler tooling
- the numbers feel abstract, use Toy demo
The important thing is not to disappear into background reading forever. The goal of the site is to support the assignment, not to turn it into a reading comprehension exercise.
If you have already read enough to understand what each stage is asking for, the best next step is usually to return to a1.c, implement one stage, compile, and test it.