I knew the 1-NN problem from a prior round so I wasn't starting from zero, but rephrasing it as a literal forward pass with Wx+b layers and at least one activation was a different beast.
First, clarify that the network is a fixed computational graph with no learned parameters, where the training set is embedded as constant weights. Then, express each step—computing distances, finding the minimum, and retrieving the label—using linear layers and activations, leveraging operations like squared distance expansion, softmax with low temperature for argmin, and one-hot label lookup.
Pro tip: Emphasize that this is a theoretical construction to demonstrate neural network expressiveness, not a practical implementation, and highlight the use of temperature scaling in softmax to approximate a hard minimum.
State that the network has no trainable parameters; training examples and labels are fixed constants. The input is a query vector x, and the output is the label of the nearest training example.
Use a linear layer to compute dot products between x and each training point, and another linear layer to compute the squared norm of x. Combine with precomputed squared norms of training points to get squared Euclidean distances via the identity ||x - t_i||^2 = ||x||^2 - 2 x·t_i + ||t_i||^2.
Apply a softmax with a very low temperature (or negative distances with high temperature) to approximate a one-hot vector indicating the nearest neighbor. Alternatively, use a hard-min activation if allowed, but softmax is more standard.
Use a linear layer with weights being the one-hot encoded labels (or label vectors) to output the label of the nearest neighbor. If labels are categorical, output a probability distribution over classes.
Mention that this construction is exact only with infinite precision; in practice, softmax temperature introduces approximation. Also note that the network size scales with the number of training examples, making it impractical for large datasets.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.