DeepLLM Quiz
Deep Learning

Forward-mode automatic differentiation: carrying derivatives along

10 questions on primal and tangent variables, evaluation traces, Jacobian columns, seeding with vectors and when forward mode is the right choice.

  • 10 questions
  • Stopwatch
  • Instant feedback

Shown publicly with your score. Don’t use your full real name.

Sample questions

Play now ↑

Answers stay hidden. Start the quiz to play them.

  1. Sample 1

    A model has 2 million weights and a single error value. How many forward-mode passes are needed to get the derivative of the error with respect to every weight?

    • One
    • About 2 million, one per weight
    • Two, one for each million

How it works

  • One question per screen. An answer is final once sent.
  • You see right away whether you were right, with a short explanation.
  • The stopwatch runs: on equal scores, the faster player ranks first.
  • Only your best attempt counts, so replaying is never risky.

About this quiz

Suppose you are told how a spreadsheet computes its final cell, step by step, and you want to know how that cell reacts when one input changes slightly. One approach would be to try the change and look. Another is to carry a second number along with every intermediate cell, a number that says how fast that cell is changing with the input in question. Each cell can fill in its second number from the second numbers of the cells that feed it, using the simple rules of calculus for addition, multiplication, exponentials and the like. When the final cell is reached, its second number is the derivative you wanted. That is forward-mode automatic differentiation.

This quiz explains the mechanism and, just as importantly, its limits. You will meet the vocabulary: primal variables, which are the ordinary values, and tangent variables, which carry the derivatives. You will see how a program turns into an evaluation trace, a sequence of elementary operations that can be drawn as a graph, and how the tangent equations are generated from it with no human algebra. You will also look at what a single pass delivers, what it takes to obtain a complete table of derivatives, and what the pass looks like when started from a vector instead of a single direction.

The questions are posed as design decisions. A function has four inputs and a hundred outputs: how many passes? A training problem has millions of weights and one error value: is this the right mode? A researcher wants the derivative with respect to a different input: what has to change? These are the questions that decide which mode a library uses for which job.

Misconceptions are common. Some people think automatic differentiation always runs backwards, which is true only of one of its modes. Others assume one pass gives all derivatives, when a single forward pass gives the derivatives with respect to one chosen direction. And some forget that the easy implementation and low memory use of the forward mode are real advantages in the right setting. Forward mode also has a quiet role outside training. Sensitivity studies, which ask how a handful of settings influence many results, are a natural fit, and so are physical simulations with few parameters and many measured outputs. Combined with the reverse mode in the right order, it can even deliver second-derivative information without building the huge table of curvatures. Knowing the strengths of this mode lets you recognise such opportunities, and stops you from reaching for it when the problem has the opposite shape.

The quiz suits learners curious about how frameworks produce gradients, and practitioners who have seen terms like Jacobian-vector product and want them to make sense. It asks only for counting and simple reasoning. There are 10 questions with explanations, and it takes about four minutes.

Questions and answers

›How long does the quiz take?

About 3 to 4 minutes for 10 questions, at roughly 20 seconds each. An explanation follows each answer, which also summarises the idea behind the question.

›Do I need to know calculus?

Only the notion that a derivative says how fast one quantity changes with another. You do not have to differentiate anything. The questions are about how the computation is organised, how many passes it needs and when it is the efficient choice.

›What are primal and tangent variables?

A primal variable is an ordinary intermediate value in the evaluation of a function. A tangent variable is a companion to it that holds the derivative of that value with respect to a chosen input. The two travel together through the computation, as a pair, and every step updates both. The tangent of the final result is the derivative being sought.

›What is an evaluation trace?

It is the list of elementary operations, such as additions, multiplications and exponentials, that a program carries out to compute its result, in order. It can be drawn as a graph with a node for each intermediate value and arrows from the values used to the value computed. Both modes of automatic differentiation work by walking over this graph.

›Why can the tangent code be generated automatically?

Because every elementary operation has a simple known derivative, and the chain rule says how to combine them. Software can therefore attach the matching tangent calculation to each operation in the trace without any human algebra. The programmer writes only the code for the function itself.

›What does a single forward pass produce?

It produces the derivatives of all the outputs with respect to one chosen input, which is one column of the table of derivatives. What that means for functions with many inputs is a good question to think about before you start the quiz, because it explains why a second mode of automatic differentiation exists, and why the choice between the two depends on the shape of the problem.

›What is a Jacobian-vector product?

It is the table of derivatives multiplied by a vector of numbers. It describes how the outputs change when the inputs move in the direction given by the vector. Forward mode computes it in a single pass if the tangents of the inputs are started with the entries of the vector, instead of with a one for a single input.

›When is forward mode a good choice?

When the function has few inputs and many outputs, so that a small number of passes covers every input. It is also simpler to implement and uses little memory, since each intermediate value can be discarded once it has been used. It is a poor choice when there are far more inputs than outputs, as in training a network.

More quizzes