跳到正文
ResAI

USAAIO 2026

第一轮

共九道题,覆盖第一轮考纲:数学基础、经典机器学习、PyTorch、NLP 词向量与 CNN,题型包括概念选择题、简短推导和 Colab 编程题。
日期
2026年1月30日
题目数
9
小题数
35
总分
300

题面为官方英文原文。

第 1 题机器学习概念

50 分

摘要关于机器学习核心概念的选择题,例如识别无监督学习任务、比较 L1 与 L2 正则化,以及偏差与方差如何随模型复杂度变化。

    监督与无监督学习正则化偏差–方差

Which of the following tasks is an example of unsupervised learning?

  • A. Predicting house prices given historical data and labeled prices.
  • B. Classifying emails as spam or not spam.
  • C. Grouping customers based on purchasing behavior without predefined labels.
  • D. Predicting whether a tumor is malignant or benign.
  • E. Recognizing handwritten digits using labeled images.

Consider two regularized linear regression models trained on the same dataset: Model A uses l1l_1-regularization. Model B uses l2l_2-regularization. Both use the same regularization strength λ>0\lambda > 0.

Which statement is most likely true?

  • A. Models A and B have the same number of non-zero weights.
  • B. Model A has fewer non-zero weights than Model B.
  • C. Model B has fewer non-zero weights than Model A.
  • D. Neither model can produce zero weights.
  • E. There is no way to know which model has fewer non-zero weights.

Which of the following best describes the typical behavior of the error components attributed to bias and variance as you increase the complexity of a model (for example, by increasing the degree of a polynomial in a regression model),?

  • A. Both bias and variance increase.
  • B. Both bias and variance decrease.
  • C. Bias and variance remain constant regardless of complexity.
  • D. Bias decreases and variance increases.
  • E. Bias increases and variance decreases.

Under which circumstances is the f1f1 score generally preferred over classification accuracy?

  • A. When the dataset is very large.
  • B. When the classes are well balanced.
  • C. When the model is linear.
  • D. When the dataset is highly imbalanced.
  • E. When the number of features is large.

Which of the following statement is correct about Uniform Manifold Approximation and Projection (UMAP)?

  • A. UMAP preserves all pairwise distances exactly.
  • B. UMAP prioritizes preserving local neighborhood structure over global distances.
  • C. UMAP guarantees linear projections of the data.
  • D. UMAP minimizes reconstruction error like PCA.
  • E. UMAP forces all clusters to have equal size.

第 2 题主成分与投影

15 分

摘要将方向向量归一化为单位主成分,并计算数据点在其上的投影。

    PCA线性代数

Consider a sample data point x∈Rd\mathbf{x} \in \mathbb{R}^d. Let e^∈Rd\hat{\mathbf{e}} \in \mathbb{R}^d be a principal component of unit length.

Let d=3d = 3. Consider the vector

v=[1−23].\mathbf{v} = \begin{bmatrix} 1 \\ -2 \\ 3 \end{bmatrix}.

Let e^\hat{\mathbf{e}} point in the same direction as v\mathbf{v}. We can write e^\hat{\mathbf{e}} in the following form:

e^=1a[bcd],\hat{\mathbf{e}} = \frac{1}{\sqrt{a}} \begin{bmatrix} b \\ c \\ d \end{bmatrix},

where aa is a positive integer, b,c,db, c, d are integers and gcd⁡(a,b2,c2,d2)=1\gcd\left(a, b^2, c^2, d^2\right) = 1. What is the value of a+b+c+da + b + c + d?

  • A. 0.
  • B. 12.
  • C. 14.
  • D. 16.
  • E. 20.

Let

x=[−1−46].\mathbf{x} = \begin{bmatrix} -1 \\ -4 \\ 6 \end{bmatrix}.

Compute the projection of x\mathbf{x} onto e^\hat{\mathbf{e}} (the inner product of these two vectors). Your answer can be written as

ba,\frac{b}{\sqrt{a}},

where aa is a positive integer, bb is an integer and gcd⁡(a,b2)=1\gcd\left(a, b^2\right) = 1. What is the value of a+ba + b?

  • A. 14.
  • B. -6.
  • C. -11.
  • D. 34.
  • E. 39.

Let r\mathbf{r} be the residual after x\mathbf{x} is projected onto e^\hat{\mathbf{e}}. We can write r\mathbf{r} in the form

r=1a[bcd],\mathbf{r} = \frac{1}{a} \begin{bmatrix} b \\ c \\ d \end{bmatrix},

where b,c,db, c, d are integers, aa is a positive integer and gcd⁡(a,b,c,d)=1\gcd\left(a, b, c, d\right) = 1. What is the value of a+b+c+da + b + c + d?

  • A. 14.
  • B. -22.
  • C. -36.
  • D. 50.
  • E. 64.

第 3 题矩阵与秩一分解

10 分

摘要根据线性映射还原矩阵,再将其写成若干外积之和。

    线性映射外积

Consider a matrix A∈R3×4\mathbf{A} \in \mathbb{R}^{3 \times 4}. For any vector

x=[x0x1x2x3],\mathbf{x} = \begin{bmatrix} x_0 \\ x_1 \\ x_2 \\ x_3 \end{bmatrix},

we have

Ax=[x2−x3x3x0+2x1].\mathbf{A}\mathbf{x} = \begin{bmatrix} x_2 - x_3 \\ x_3 \\ x_0 + 2x_1 \end{bmatrix}.

Compute A\mathbf{A}. Reasoning is not required.

We can write A\mathbf{A} in the following decomposition form:

A=∑i=0I−1u(i)v(i),⊤,\mathbf{A} = \sum_{i=0}^{I-1} \mathbf{u}^{(i)} \mathbf{v}^{(i),\top},

where u(i)\mathbf{u}^{(i)} and v(i)\mathbf{v}^{(i)} are column vectors.

Compute

  1. II
  2. u(i)\mathbf{u}^{(i)} and v(i)\mathbf{v}^{(i)} for all i∈{0,1,⋯ ,I−1}i \in \{0, 1, \cdots, I-1\}.

Reasoning is required.

第 4 题导数与梯度(NumPy 实现)

20 分

摘要手动求 tanh 的导数,再在严格限制下(不可使用自动求导和线性代数函数)用 NumPy 实现均方误差损失的梯度。

    微积分均方误差的梯度NumPy

This is a math task. Compute the following derivative:

dtanh⁡xdx,\frac{d \tanh x}{dx},

where

tanh⁡x=ex−e−xex+e−x.\tanh x = \frac{e^x - e^{-x}}{e^x + e^{-x}}.

Reasoning is required.

This is a coding task.

Run the following starter code:

import numpy as np

Write a function called my_fun_derivative:

  1. Inputs:

    • (a) NumPy array X with shape (N,d).
    • (b) NumPy array y with shape (N,).
    • (c) NumPy array theta with shape (d,).
  2. Output:

    ∇θ 1N∑n=0N−1(y[n]−θ⊤X[n])2.\nabla_\theta \, \frac{1}{N} \sum_{n=0}^{N-1} \left( y[n] - \theta^\top \mathbf{X}[n] \right)^2.

    So the output is a NumPy array with shape (d,).

In this task, you are not allowed to

  1. import any additional libraries/modules/methods;
  2. use autograd in PyTorch;
  3. use any method in np.linalg, including @ and .T;
  4. use any loop.

You will receive 0 points if you violate any of these rules.

第 5 题词向量

90 分

摘要基于给定文本使用 100 维 GloVe 词向量:计算相似度、类比推理,并分析词向量的性质。

    自然语言处理GloVe余弦相似度

In this problem, we study word/token embeddings. Each token is embedded as a vector of length 100.

Run the following starter code:

!pip install gensim

import gensim.downloader as api
from gensim.utils import simple_preprocess
import requests

import numpy as np
import matplotlib.pyplot as plt

glove = api.load("glove-wiki-gigaword-100")

url_part1 = "https://huggingface.co/datasets/usaaio-official/"
url_part2 = "2026_USAAIO_Round1_public/raw/main/"
url_part3 = "2026_USAAIO_Round1_NLP.txt"
url = url_part1 + url_part2 + url_part3

text = requests.get(url).text

tokens = simple_preprocess(text)
tokens = [token for token in tokens if token in glove]
print(len(tokens))
tokens = list(set(tokens))
print(len(tokens))
vectors = [glove[word] for word in tokens]

Do not import any additional libraries, modules, or methods beyond those included in the given starter code.

In the starter code, we run the following line twice.

print(len(tokens))

Why do we get two different results?

Explain what the following code does:

tokens = list(set(tokens))

Write code to convert vectors into a NumPy array. Name it vectors_arr. So

vectors_arr=[v(0),⊤v(1),⊤⋮v(N−1),⊤],\text{vectors\_arr} = \begin{bmatrix} \mathbf{v}^{(0),\top} \\ \mathbf{v}^{(1),\top} \\ \vdots \\ \mathbf{v}^{(N-1),\top} \end{bmatrix},

where NN is the total number of tokens and v(n)\mathbf{v}^{(n)} is the embedding of the nnth token.

Define

v^(n)=v(n)∣∣v(n)∣∣2.\hat{\mathbf{v}}^{(n)} = \frac{\mathbf{v}^{(n)}}{||\mathbf{v}^{(n)}||_2}.

Thus, v^(n)\hat{\mathbf{v}}^{(n)} has unit length. Let

W=[v^(0),⊤v^(1),⊤⋮v^(N−1),⊤].\mathbf{W} = \begin{bmatrix} \hat{\mathbf{v}}^{(0),\top} \\ \hat{\mathbf{v}}^{(1),\top} \\ \vdots \\ \hat{\mathbf{v}}^{(N-1),\top} \end{bmatrix}.

Write code to compute W from vectors_arr.

Do not use np.linalg or any loop.

Define the similarity between tokens ii and jj as

simij=v^(i),⊤v^(j).\mathrm{sim}_{ij} = \hat{\mathbf{v}}^{(i),\top} \hat{\mathbf{v}}^{(j)}.

What is the range of simij\mathrm{sim}_{ij}?

Reasoning is not required.

Define a similarity matrix

S=[sim00sim01⋯sim0(N−1)sim10sim11⋯sim1(N−1)⋮⋮⋱⋮sim(N−1)0sim(N−1)1⋯sim(N−1)(N−1)]∈RN×N.\mathbf{S} = \begin{bmatrix} \mathrm{sim}_{00} & \mathrm{sim}_{01} & \cdots & \mathrm{sim}_{0(N-1)} \\ \mathrm{sim}_{10} & \mathrm{sim}_{11} & \cdots & \mathrm{sim}_{1(N-1)} \\ \vdots & \vdots & \ddots & \vdots \\ \mathrm{sim}_{(N-1)0} & \mathrm{sim}_{(N-1)1} & \cdots & \mathrm{sim}_{(N-1)(N-1)} \end{bmatrix} \in \mathbb{R}^{N \times N}.

Express S\mathbf{S} in terms of W\mathbf{W}.

Reasoning is not required. Coding is not needed.

Write one line of code to compute S using W.

Do not use np.linalg, @ or any loop.

  1. (Coding task) Print out the diagonal values of S.
  2. (Non-coding task) Interpret your result.

Create a dictionary called sim_dict. Each token serves as a key.

For each given token (the key), its value should be the token (excluding itself) that has the highest similarity score with that key.

For example, if your solution is correct, you should obtain the following key-value pair:

"bright": "lights"

Is S invertible?

Mathematical reasoning is required. Coding is not allowed.

Let the singular value decomposition (SVD) of W\mathbf{W} be

W=UΣV⊤.\mathbf{W} = \mathbf{U} \mathbf{\Sigma} \mathbf{V}^\top.

Write code to compute

  1. U\mathbf{U},
  2. the diagonal of Σ\mathbf{\Sigma}, sorted in decreasing order and denoted by σ\sigma,
  3. V\mathbf{V}.

Hint: You may use np.linalg.svd.

Denote by

S=QΛQ⊤\mathbf{S} = \mathbf{Q} \mathbf{\Lambda} \mathbf{Q}^\top

a spectral decomposition of S\mathbf{S}, such that

  1. Q∈RN×N\mathbf{Q} \in \mathbb{R}^{N \times N} is an orthonormal matrix.
  2. Λ∈RN×N\mathbf{\Lambda} \in \mathbb{R}^{N \times N} is a diagonal matrix whose diagonal entries are sorted in decreasing order.

Write code to compute Q\mathbf{Q} and the diagonal of Λ\mathbf{\Lambda} (denoted by λ\lambda) using U\mathbf{U}, σ\sigma, and V\mathbf{V} obtained in Part 5.11.

The Frobenius norm of the matrix S\mathbf{S} is defined as

∣∣S∣∣F=∑i=0N−1∑j=0N−1Sij2.||\mathbf{S}||_F = \sqrt{\sum_{i=0}^{N-1} \sum_{j=0}^{N-1} S_{ij}^2}.

Mathematically express ∣∣S∣∣F||\mathbf{S}||_F in terms of the SVD of W\mathbf{W}.

Reasoning is required.

Consider a large NN (N>100N > 100). Recall that S∈RN×N\mathbf{S} \in \mathbb{R}^{N \times N} can be expressed in terms of W∈RN×100\mathbf{W} \in \mathbb{R}^{N \times 100}.

Thus, the amount of data needed to store the relationship between each pair of tokens is not N2N^2, but 100N100N.

However, this is still too much. Our goal is to approximate S\mathbf{S} using only rNrN numbers, where r<<100r << 100.

Denote by Wr∈RN×r\mathbf{W}_r \in \mathbb{R}^{N \times r} a matrix constructed from W\mathbf{W}. Denote by Sr∈RN×N\mathbf{S}_r \in \mathbb{R}^{N \times N} a matrix constructed from Wr\mathbf{W}_r.

To measure the error between Sr\mathbf{S}_r and S\mathbf{S}, we use the following relative squared Frobenius metric:

∣∣S−Sr∣∣F2∣∣S∣∣F2.\frac{||\mathbf{S} - \mathbf{S}_r||_F^2}{||\mathbf{S}||_F^2}.

For each given rr, mathematically construct Wr\mathbf{W}_r and Sr\mathbf{S}_r, such that the above metric is minimized.

Reasoning is not required.

This is a coding task based on your findings in Part 5.14.

Generate a plot. The xx-axis is r∈{1,2,⋯ ,100}r \in \{1, 2, \cdots, 100\}. The yy-axis is the relative squared Frobenius metric.

第 6 题解读 CNN 特征图

10 分

摘要给出预训练 CNN 五个层输出的乱序特征图,判断每张特征图来自哪一层并说明理由。

    卷积神经网络可解释性

Figure 1 is an image. We send it to a pretrained convolutional neural network.

Original image

Figure 1: Original image

We obtain five feature maps that are outputs from five different layers (indexed from 0 to 4), as shown in Figure 2.

Feature maps (1)–(5) from different layers

Figure 2: Feature maps from different layers

However, these feature maps are not given in order. For instance, feature map (1) is not necessarily the output from layer 0.

For each feature map, determine which layer it outputs from.

Reasoning is required.

第 7 题用 PyTorch 构建模块

30 分

摘要实现自定义的阈值模块和线性模块,并推导使各层激活值方差保持稳定的权重方差。

    PyTorch参数初始化激活函数

Run the following starter code:

import torch
import torch.nn as nn

Build a threshold module that subclasses torch.nn.Module and is named My_Threshold.

The threshold activation function is defined as

Θ(x)={1if x≥00if x<0.\mathbf{\Theta}\left(x\right) = \begin{cases} 1 & \text{if } x \geq 0 \\ 0 & \text{if } x < 0 \end{cases}.

Consider the following transformation

y=∑c=0C−1wcxc.y = \sum_{c=0}^{C-1} w_c x_c.

Suppose x0,⋯ ,xC−1x_0, \cdots, x_{C-1} and w0,⋯ ,wC−1w_0, \cdots, w_{C-1} are all independent random variables. For c∈{0,⋯ ,C−1}c \in \{0, \cdots, C-1\}, E[wc]=E[xc]=0\mathrm{E}[w_c] = \mathrm{E}[x_c] = 0, Var⁡[wc]=σw2\operatorname{Var}\left[w_c\right] = \sigma_w^2 and Var⁡[xc]=σ2\operatorname{Var}\left[x_c\right] = \sigma^2.

We want yy to have the same variance as each input xcx_c. That is, we want Var⁡[y]=σ2\operatorname{Var}\left[y\right] = \sigma^2.

Compute σw\sigma_w that achieves this.

Reasoning is required.

Build a linear module that subclasses torch.nn.Module and is named My_Linear.

  1. The input argument bias is True by default. But it can be set to False. If bias is True, its initial value is 0.
  2. The initial value of each entry in weight is drawn from a normal distribution with mean 0 and standard deviation σw\sigma_w that you find in Part 7.2.

Use PyTorch to build a multi-layer perceptron (MLP) model that performs the following inference task.

On a 2-dim plane, consider a triangle with vertices (0,0)(0, 0), (3,1)(3, 1), (1,5)(1, 5). Each input sample to your model is a point in the 2-dim plane. The output is 1 if the point lies inside the triangle and 0 otherwise.

  1. Define your neural network module as a Python class named My_Triangle that inherits from nn.Module, and then create an instance of that class named my_triangle to serve as your model.

  2. Your module architecture may consist only of the threshold module you built in Part 7.1 and the linear module you built in Part 7.3. Any other module is prohibited.

  3. In the forward method in My_Module, the input is a tensor of shape (B,2), where B is the batch size. The output is a binary tensor (0 or 1) of shape (B,).

  4. In my_triangle, for each linear module, you must manually determine the values of weight and bias. So that the model is ready for inference.

    Note: This problem is inference only. There is no training.

  5. In my_triangle, the attribute requires_grad for all learnable parameters must be set to False.

第 8 题剖析 ResNet-50

25 分

摘要统计预训练 ResNet-50 的可学习参数量并追踪张量形状,部分小题不得使用辅助方法。

    ResNet参数量计算张量形状

Run the following starter code:

import torch
import torch.nn as nn
from torchvision.models import resnet50
import torchsummary

model = resnet50(pretrained=True)

What is the total number of learnable parameters in model?

Hint: For an object of type torch.nn.parameter.Parameter, you can use the method numel() to count the number of learnable parameters it contains.

Suppose the input has shape (B,3,224,224). What is the shape of the output from model.layer2?

What is the total number of learnable parameters in all convolutional modules in model.layer3[2]?

To solve this problem, you are not allowed to use the method numel for any object of type torch.nn.parameter.Parameter.

Reasoning is required.

We want to use a truncated pretrained resnet50 model (up to the output from model.layer3[4]) as a backbone for a classification task with 5 classes. Build such a model.

In your solution, all parameters in the backbone must be frozen (that is, fixed and not learnable).

第 9 题表格数据二分类

50 分

摘要为含 30 个特征的医学表格数据集构建分类器,在隐藏测试集上评分。

    分类特征工程模型评估

In this problem, we study a tabular dataset for a binary classification task. All features are numeric.

You can access the training dataset by running the following starter code:

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

url_part1 = "https://huggingface.co/datasets/usaaio-official/"
url_part2 = "2026_USAAIO_Round1_public/raw/main/"
url_part3 = "2026_USAAIO_Round1_breast_cancer_train.csv"
url = url_part1 + url_part2 + url_part3

df = pd.read_csv(url)
X = df.drop("target", axis=1)
y = df["target"]

In this training dataset, X contains 30 input features, and y contains the binary target labels.

We also have a hidden test dataset that you cannot access during the competition.

You must submit a single Jupyter notebook (.ipynb) containing your complete solution, including (but not limited to):

  1. Data preprocessing (if needed)
  2. Model construction
  3. Model training
  4. Inference logic

Inference requirements

For inference, you must define a function with the following signature:

def my_prediction(X_test):
    ###INSERT YOUR CODE HERE###
    return y_pred

In this function:

  1. X_test is a pandas DataFrame containing all input features from the hidden test set.
  2. y_pred must be a pandas Series containing your predicted labels.

After the competition, we will execute all code in your submitted notebook from top to bottom. During evaluation, we will load the hidden test features as X_test and call your function:

my_prediction(X_test)

Your predictions y_pred will be evaluated using the macro-averaged f1 score (f1-macro).

Model constraints

  1. In your solution, you must use k-Nearest Neighbors (kNN) for classification.

  2. However, this does not mean you must directly apply kNN to the raw training and test data. You may use any data preprocessing, feature engineering, or pipeline you find appropriate.

  3. Beyond kNN, you are not allowed to use any other supervised learning models.

  4. You may import any module or method from scikit-learn, numpy, pandas, and matplotlib.

    One restriction is that in scikit-learn, among all supervised learning models, you can only import kNN.

  5. Do not use deep neural network to solve this problem.

Notebook requirements

In your submitted notebook, please ensure the following:

  1. Your code includes sufficient comments to make it readable.
  2. At the end of the notebook, include a text cell summarizing:
    • Your overall approach.
    • The intuition behind your design choices.
    • Any alternative approaches or models you considered but did not pursue, or you tried but did not submit.

Your report does not need to be long, but it should be clear, concise, and well-reasoned.

Grading criteria

Your submission will be evaluated based on:

  1. Whether the entire notebook runs successfully from start to finish.
  2. Performance on the hidden test dataset.
  3. The quality of your reasoning and problem-solving approach.

We do not evaluate code style or quality.

题目与解答版权归 USA-NA-AIO(USAAIO)所有,注明出处后用于教育目的展示;摘要和知识点标签由 ResAI 撰写。来源: usaaio.org