<?xml version='1.0' encoding='UTF-8'?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0"><channel><title>wsx的博客</title><link>https://personawsx.github.io</link><description>我是wsx，北邮研究生</description><copyright>wsx的博客</copyright><docs>http://www.rssboard.org/rss-specification</docs><generator>python-feedgen</generator><image><url>https://avatars.githubusercontent.com/u/171470826?v=4&amp;size=64</url><title>avatar</title><link>https://personawsx.github.io</link></image><lastBuildDate>Sat, 22 Aug 2026 03:08:02 +0000</lastBuildDate><managingEditor>wsx的博客</managingEditor><ttl>60</ttl><webMaster>wsx的博客</webMaster><item><title>cs336 lecture 6</title><link>https://personawsx.github.io/post/cs336%20lecture%206.html</link><guid isPermaLink="true">https://personawsx.github.io/post/cs336%20lecture%206.html</guid><pubDate>Sat, 25 Jul 2026 12:17:02 +0000</pubDate></item><item><title>cs336 lecture 5 GPUs，TPUs</title><link>https://personawsx.github.io/post/cs336%20lecture%205%20GPUs%EF%BC%8CTPUs.html</link><description>&lt;img width='1249' height='624' alt='Image' src='https://github.com/user-attachments/assets/b91361c4-65d6-4343-955c-d0a6ec56cfd4' /&gt;|

&lt;img width='1200' height='660' alt='Image' src='https://github.com/user-attachments/assets/a850d887-6b50-4eae-bda4-312bd260cab6' /&gt;

&lt;img width='1158' height='630' alt='Image' src='https://github.com/user-attachments/assets/ee356efa-21c3-4b7d-af07-8f2fe2fc83bb' /&gt;

早期算力增长依赖登纳德缩放（减少晶体管体积），而在该技术路线走到尽头后，依靠 GPU 并行算力的大幅提升，才支撑起现代大语言模型的持续迭代扩容。</description><guid isPermaLink="true">https://personawsx.github.io/post/cs336%20lecture%205%20GPUs%EF%BC%8CTPUs.html</guid><pubDate>Sat, 25 Jul 2026 12:16:40 +0000</pubDate></item><item><title>cs336 lecture 4 Attention Alternatives</title><link>https://personawsx.github.io/post/cs336%20lecture%204%20Attention%20Alternatives.html</link><description># 1、Linear attention
## 1. Q/K/V 定义
- $Q\in\mathbb{R}^{n\times d_k}$：Query，查询矩阵，每行代表单个token的查询向量
- $K\in\mathbb{R}^{n\times d_k}$：Key，键矩阵，每行代表单个token的检索特征
- $V\in\mathbb{R}^{n\times d_v}$：Value，值矩阵，每行代表单个token携带的内容信息
- $n$：序列token长度； $d_k$：Q/K维度； $d_v$：V维度 
这里的QKV是利用输入向量乘以不同的矩阵得到的。</description><guid isPermaLink="true">https://personawsx.github.io/post/cs336%20lecture%204%20Attention%20Alternatives.html</guid><pubDate>Thu, 23 Jul 2026 14:56:13 +0000</pubDate></item><item><title>cs336 lecture 3 Architectures</title><link>https://personawsx.github.io/post/cs336%20lecture%203%20Architectures.html</link><description># 1 Common architecture variations
## 1.1 Pre-vs-post norm

&lt;img width='1196' height='621' alt='Image' src='https://github.com/user-attachments/assets/21f3c497-2dd7-4c2b-a6bc-cb33da7492a9' /&gt;

残差主干道保持原始数据，不受归一化干扰，这一点至关重要
若遇到稳定性问题，可以在模型的各个地方适当加上LayerNorm

## 1.2 LayerNorm vs RMSNorm

Original transformer: LayerNorm – normalizes the mean and variance across
 $d_{model}$

$$
y = \frac{x - \mathbb{E}[x]}{\sqrt{\text{Var}[x] + \epsilon}} * \gamma + \beta
$$

**Notable models:**
GPT3/2/1, OPT, GPT-J, BLOOM

Many modern LMs: RMSNorm – does not subtract mean or add a bias term

$$
y = \frac{x}{\sqrt{||x||_2^2 + \epsilon}} * \gamma
$$

$$\|x\|_2 = \sqrt{x_1^2 + x_2^2 + ... + x_d^2}$$

**Notable models:**
LLaMA-family, PaLM, Chinchilla, T5

### Why RMSNorm?
Modern explanation – it’s faster (and just as good).
- Fewer operations (no mean calculation)
- Fewer parameters (no bias term to store)

$$
y = \frac{x - \mathbb{E}[x]}{\sqrt{\text{Var}[x] + \epsilon}} * \gamma + \beta
$$

Does this explanation make sense?

| Operator class | % flop |
| ---- | ---- |
| $\triangle$ Tensor contraction | 99.80 |
| $\square$ Stat. normalization | 0.17 |
| $\bigcirc$ Element-wise | 0.03 |

Matrix multiplies are the vast majority of FLOPs (and memory)

Important lesson: FLOPS are not runtime（真实运行耗时）! 

| Operator class | % flop | % Runtime |
| ---- | ---- | ---- |
| $\triangle$ Tensor contraction | 99.80 | 61.0 |
| $\square$ Stat. normalization | 0.17 | 25.5 |
| $\bigcirc$ Element-wise | 0.03 | 13.5 |

RMSNorm can still matter due to the importance of **data movement**

&lt;img width='436' height='488' alt='Image' src='https://github.com/user-attachments/assets/d2a988bb-06d4-45d1-a406-fb2e26245104' /&gt;

MHA 拥有 99% 以上的总 FLOPs，但它计算访存比很高，计算效率高；
Dropout、残差相加、LayerNorm 的 FLOPs 加起来很少，但计算访存比很低，全是访存受限，其大量时间消耗在读写显存上。</description><guid isPermaLink="true">https://personawsx.github.io/post/cs336%20lecture%203%20Architectures.html</guid><pubDate>Thu, 23 Jul 2026 14:55:21 +0000</pubDate></item><item><title>cs336 lecture 2 Pytorch</title><link>https://personawsx.github.io/post/cs336%20lecture%202%20Pytorch.html</link><description>Recall: what's the best model one can train given fixed resources (compute, memory)?
In other words: maximize (computational) efficiency.
Prerequisite: understand the resources (compute, memory) for a given computation.

motivating_questions()
What knowledge to take away from this lecture:    
Mechanics: straightforward (PyTorch semantics) 
Mindset: resource accounting (remember to do it)   
Intuitions: get a sense of how resources are spent, no ML magic today
 
### 1、def tensors_basics():（张量的定义）
    Tensors are the basic building block for storing everything:
data    
parameters 
gradients  
optimizer state   
activations
张量包括向量、矩阵甚至任意阶的数组

问：张量需要多少存储空间？答：取决于张量的类型，一般张量里存储的是浮点数（大多指float32），也可以为整数或者其他类型。</description><guid isPermaLink="true">https://personawsx.github.io/post/cs336%20lecture%202%20Pytorch.html</guid><pubDate>Mon, 20 Jul 2026 10:47:32 +0000</pubDate></item><item><title>cs336 lecture 1 overview；tokenization</title><link>https://personawsx.github.io/post/cs336%20lecture%201%20overview%EF%BC%9Btokenization.html</link><description>
### What can we learn in this class that transfers to frontier model？
There are three types of knowledge:
Mechanics: how things work (what a Transformer is, how model parallelism works)
Mindset: squeezing the most out of the hardware, taking scaling seriously
Intuitions: which data and modeling decisions yield good accuracy

### The bitter lesson
Wrong interpretation: scale is all that matters, algorithms don't matter.
Right interpretation: algorithms that scale are what matter.

### accuracy = efficiency × resources

In fact, efficiency is way more important at larger scales (can't afford to be wasteful).
[Hernandez+ 2020] showed 44x algorithmic efficiency on ImageNet between 2012 and 2019.

Framing: what is the best model one can build given a certain compute and data budget?

### In other words, maximize efficiency!

### 1、Tokenization
What are the atoms（最小基本单元） that the model operates on?
Formally: a tokenizer converts between raw inputs (bytes) and sequences of integers (tokens)

&lt;img width='2395' height='983' alt='Image' src='https://github.com/user-attachments/assets/0673caa3-6303-45de-af6f-f2f209c65c5b' /&gt;

Popular tokenizer: Byte-Pair Encoding (BPE) https://arxiv.org/abs/1508.07909 
Intuition: break input into frequently-occuring chunks
   
#### Efficiency lens：
（1）Reduce context length (1000 bytes → ~250 tokens)
（2）Adaptive computation (more modeling capacity on interesting parts of input)
   
#### The dream: 
tokenizer-free model architectures, which operate directly on bytes （https://arxiv.org/abs/2105.13626；https://arxiv.org/abs/2412.09871； https://arxiv.org/abs/2406.19223；https://arxiv.org/abs/2507.07955）
These are promising, but have not yet been scaled up to the frontier.

Raw text is generally represented as **Unicode strings**.

例如：string = 'Hello, 🌍! 你好!'
 
A language model places a probability distribution over sequences of tokens (usually represented by integer indices).

例如：indices = [15496, 11, 995, 0]

So we need a procedure that **encodes strings into tokens**.
We also need a procedure that **decodes tokens back into strings**.
A Tokenizer is a class that **implements the encode and decode methods**.

To get a feel for how tokenizers work, play with this：https://tiktokenizer.vercel.app/?encoder=gpt2

### Observations
（1）A word and its preceding space are part of the same token (e.g., ' world').  
（2）A word at the beginning and in the middle are represented differently (e.g., 'hello hello').  
（3）Numbers are tokenized into every few digits.

### Compression ratio: number of bytes per token
即 **压缩比 compression_ratio = 原始文本UTF-8总字节数 / token数量**
The larger the compression ratio, the shorter the sequence (good since attention is quadratic in sequence length)，即：压缩比越大，token序列越短.
One could increase compression ratio by **increasing vocabulary size (number of possible token values increases)**, leading to sparsity（稀疏性，即许多token在数据中极少出现，表征训练不足）.

## 如何表征token？

There are approximately 150K Unicode characters. 
#### Problem 1: this is a very large vocabulary.
#### Problem 2: many characters are quite rare (e.g., 🌍), which is inefficient use of the vocabulary.
This tokenizer is the worst of both worlds (large vocabulary, low compression ratio).

换一种方法：（转为字节）
Unicode strings can be represented as a sequence of bytes, which can be represented by integers between 0 and 255.

The vocabulary is nice and small: a byte can represent 256 values.
vocabulary_size = 256  

### Problem：   
What about the compression rate?
The compression ratio is terrible, which means the sequences will be too long.
Given that the context length of a Transformer is limited (since attention is quadratic), this is not looking great...

其他方法：
Another approach (closer to what was done classically in NLP) is to split strings into words.

What's good: each token is meaningful (since humans invented words).  

Problem：
（1）Many words are rare and the model won't learn much about them.
（2）This doesn't obviously provide a fixed vocabulary size.
（3）New words we haven't seen during training get a special UNK token, which is ugly and can mess up perplexity calculations.

# Byte Pair Encoding（BPE）
Intuition: common sequences of bytes are represented by a single token, rare sequences are represented by many tokens.
Sketch: start with each byte as a token, and successively merge the most common pair of adjacent tokens.

### Example：

原始文本：`the cat in the hat`

### Step 0 初始化
把文本拆分为最小单元（字符，模拟底层UTF-8字节）
序列：`t h e   c a t   i n   t h e   h a t`
基础 vocab：`{t, h, e,  , c, a, i, n}`

### Step 1 统计相邻配对频次，选出最高频 `t h`
合并 `t + h → th`
新序列：`th e   c a t   i n   th e   h a t`
vocab 新增：`th`

### Step 2 重新统计配对，最高频 `th e`
合并 `th + e → the`
新序列：`the   c a t   i n   the   h a t`
vocab 新增：`the`

### Step 3 重新统计配对，最高频 `a t`
合并 `a + t → at`
最终序列：`the   c at   i n   the   h at`
vocab 新增：`at`

结果：
1. 高频片段 `the`、`at` 合并为**单个token**；
2. 极低频次片段无法合并，会保留大量基础单元（多个token）。</description><guid isPermaLink="true">https://personawsx.github.io/post/cs336%20lecture%201%20overview%EF%BC%9Btokenization.html</guid><pubDate>Sun, 19 Jul 2026 10:57:09 +0000</pubDate></item><item><title>cs231n lecture 18 Human-Centered AI</title><link>https://personawsx.github.io/post/cs231n%20lecture%2018%20Human-Centered%20AI.html</link><guid isPermaLink="true">https://personawsx.github.io/post/cs231n%20lecture%2018%20Human-Centered%20AI.html</guid><pubDate>Thu, 16 Jul 2026 12:33:27 +0000</pubDate></item><item><title>cs231n lecture 17 Robot Learning</title><link>https://personawsx.github.io/post/cs231n%20lecture%2017%20Robot%20Learning.html</link><description> 
&lt;img width='946' height='435' alt='Image' src='https://github.com/user-attachments/assets/6c38ac93-ba62-4560-8c1a-66c22485991c' /&gt;

# 1、Problem Formulation
。</description><guid isPermaLink="true">https://personawsx.github.io/post/cs231n%20lecture%2017%20Robot%20Learning.html</guid><pubDate>Thu, 16 Jul 2026 12:32:44 +0000</pubDate></item><item><title>cs231n lecture 16 Vision and Language</title><link>https://personawsx.github.io/post/cs231n%20lecture%2016%20Vision%20and%20Language.html</link><description> 
&lt;img width='961' height='432' alt='Image' src='https://github.com/user-attachments/assets/252e661d-2d1c-4436-9b04-fa7a39cc8ac2' /&gt;

&lt;img width='868' height='421' alt='Image' src='https://github.com/user-attachments/assets/5be79945-996b-4037-ac5c-63c816c64017' /&gt;

&lt;img width='917' height='410' alt='Image' src='https://github.com/user-attachments/assets/32579b32-3922-447c-8cf0-9f4e0b30ff13' /&gt;

&lt;img width='983' height='327' alt='Image' src='https://github.com/user-attachments/assets/8e34bdaa-8615-4252-9758-bfcd02184ffe' /&gt;

#### How do identify a model as a Foundation（基础模型）?
Always see with foundation models:
general /robust to many different tasks

#### Often see with foundation models:
Large # params
Large amount of data
Self-supervised pre-training objective

自监督学习的目标：
将带有同类元素的照片和文字归为一类
&lt;img width='950' height='430' alt='Image' src='https://github.com/user-attachments/assets/4b496669-809f-430c-a39c-5153673d7898' /&gt;

# 1、SimCLR VS CLIP
&lt;img width='897' height='500' alt='Image' src='https://github.com/user-attachments/assets/37ef3912-7ee4-4cae-834f-e3c9e6ecdd1d' /&gt;

SimCLR：只能实现图像的对比学习
CLIP：跨模态图文对比学习


&lt;img width='975' height='435' alt='Image' src='https://github.com/user-attachments/assets/42f2aef0-b14e-40de-a847-80297feda334' /&gt;

CLIP：先用海量图文对做无监督对比预训练，得到通用图像编码器，再拿这个编码器配合简单线性层，直接完成分类、检测、分割等各类视觉任务
 
Problem：想要做图像分类 / 检测 / 分割，必须提供该任务的标注数据，训练这个新增线性层，即不支持 Zero-Shot（零样本）


### LLM的不同之处：支持 Zero-Shot（零样本）

&lt;img width='987' height='495' alt='Image' src='https://github.com/user-attachments/assets/724a1c1f-c91c-4ae0-8893-f6e7c8d6d008' /&gt;

&lt;img width='962' height='462' alt='Image' src='https://github.com/user-attachments/assets/769b2c9a-dc6d-4f39-98e4-33a66534fb71' /&gt;

Question：视觉语言模型（CLIP）怎么零样本使用？

&lt;img width='633' height='323' alt='Image' src='https://github.com/user-attachments/assets/187cfadd-37ac-4be1-b63e-4f35cc959136' /&gt;

### Solution：

待识别图片送入 Image Encoder，得到图像向量 image vector；
类别文字（比如 'Dog'等）送入 Text Encoder，得到文本向量 text vector；
计算两个向量的相似度匹配分数（图里 0.27），分数越高代表图片和这个文字描述越匹配（1-NN 近邻思想）。</description><guid isPermaLink="true">https://personawsx.github.io/post/cs231n%20lecture%2016%20Vision%20and%20Language.html</guid><pubDate>Wed, 15 Jul 2026 11:52:19 +0000</pubDate></item><item><title>cs231n lecture 15 3D Vision</title><link>https://personawsx.github.io/post/cs231n%20lecture%2015%203D%20Vision.html</link><description>&lt;img width='913' height='477' alt='Image' src='https://github.com/user-attachments/assets/394d504d-7594-49ef-89e4-7b2b4f4581d8' /&gt;

### （1）显式表示（Explicit）：
点云（Point cloud）
多边形网格（Polygon mesh）
细分曲面、非均匀有理B样条（Subdivision, NURBS）
 ……

### （2）隐式表示（Implicit）：
水平集（Level sets，图内拼写笔误Lever）
代数曲面（Algebraic surface）
距离函数（Distance functions）
 ……

每种表示方案都最适配特定任务、特定类型的几何体

&lt;img width='692' height='407' alt='Image' src='https://github.com/user-attachments/assets/1f3cf86d-b3a1-4840-aa29-c79ae463cce0' /&gt;

### 几何表示方案的考量因素
1. **存储需求**：数据需要能在计算机中保存
2. **模型创建**：生成全新模型
    输入交互方式、操作界面……
3. **几何运算**
    编辑、简化、平滑、滤波、修复……
4. **渲染输出**
    光栅化、光线追踪、神经渲染……
5. **动画制作**
 
&lt;img width='913' height='523' alt='Image' src='https://github.com/user-attachments/assets/e4bfdde3-3ab5-47d8-b6f3-8a2a017efba9' /&gt;

# 一、Explicit

### 1、Point Clouds

Simplest representation: only points, no connectivity
Collection of $(x,y,z)$ coordinates, possibly with normal
Points with orientation are called surfels（面元）
Often results from scanners
Potentially noisy
Registration of multiple images

### 优点：
Easily represent any kind of geometry
Useful for large datasets
### Other limitations:
Difficult to draw in undersampled regions（采样稀疏处难以绘制）
No simplification（模型简化） or subdivision（细分曲面）
No direction smooth rendering（基于方向的平滑渲染）
No topological information（缺少拓普信息）

&lt;img width='537' height='117' alt='Image' src='https://github.com/user-attachments/assets/56d55dea-a52c-493e-9bc4-dabd2905e2e8' /&gt;

### 2、Polygon meshes（多边形网格）

&lt;img width='622' height='170' alt='Image' src='https://github.com/user-attachments/assets/2775798b-28ea-4f5b-911e-659ed859157c' /&gt;

Subdivision（细分曲面）
需要精细：增加网格数量；需要快速：减少网格数量

Mesh Regularization：用三角形网格连接

### 3、Shape Representations：
Non-parametric：Points，Meshes
Parametric Representations：

&lt;img width='290' height='177' alt='Image' src='https://github.com/user-attachments/assets/7ab4c1a1-eeaf-4dbe-a2fe-29aa99001d08' /&gt;

&lt;img width='742' height='498' alt='Image' src='https://github.com/user-attachments/assets/50ca378d-0119-4272-b30f-439e00a534c3' /&gt;

上述方法都属于显性采样，所有点都被直接给出来。</description><guid isPermaLink="true">https://personawsx.github.io/post/cs231n%20lecture%2015%203D%20Vision.html</guid><pubDate>Wed, 15 Jul 2026 11:51:48 +0000</pubDate></item><item><title>cs231n lecture 14 Generative Models 2</title><link>https://personawsx.github.io/post/cs231n%20lecture%2014%20Generative%20Models%202.html</link><description># 1、Generative Adversarial Networks
Generative Adversarial Networks give up on modeling p(x) ，but allow us to draw samples from p(x) .

&lt;img width='978' height='501' alt='Image' src='https://github.com/user-attachments/assets/584a4ce3-9ff0-4a9f-89bf-ed87659cdc07' /&gt;

相关符号：
1. $z \sim p(z)$：从标准正态分布采样随机隐向量；
2. $G(z)$：生成器，输入 $z$输出伪造样本；
3. $p_G$：生成器造出图片的分布；
4. $p_{\text{data}}$：数据集真实图片的分布；
5. $D(x)$：判别器，输入图片输出“是真实图的概率”。</description><guid isPermaLink="true">https://personawsx.github.io/post/cs231n%20lecture%2014%20Generative%20Models%202.html</guid><pubDate>Tue, 14 Jul 2026 12:23:03 +0000</pubDate></item><item><title>cs231n lecture 13 Generative Models 1</title><link>https://personawsx.github.io/post/cs231n%20lecture%2013%20Generative%20Models%201.html</link><description># 1、Supervised vs Unsupervised Learning 监督学习 vs 无监督学习
### Supervised Learning 监督学习
1. Data: $(x, y)$
   $x$ is data, $y$ is label
2. Goal: Learn a function to map $x \rightarrow y$
3. Examples: Classification, regression, object detection, semantic segmentation, image captioning, etc.

### Unsupervised Learning 无监督学习
1. Data: $x$
   Just data, no labels!
2. Goal: Learn hidden structure in data
3. Examples: Clustering（聚类）, dimensionality reduction（降维）, density estimation（密度估计）, etc.

# 2、Generative vs Discriminative Models

## （1）Discriminative Model（判别模型）:
Learn a probability distribution $p(y|x)$

&lt;img width='607' height='417' alt='Image' src='https://github.com/user-attachments/assets/a17f03a6-239c-4a4f-8c04-49bd6b8e1f2d' /&gt;

Problem：无法处理有问题的输入，依旧会给出所有可能的概率分布（即使输入不属于所有标签中的任意一个）

## （2）Generative Model:
Learn a probability distribution $p(x)$

&lt;img width='602' height='452' alt='Image' src='https://github.com/user-attachments/assets/c1927147-7230-44d6-989c-d6b717b96615' /&gt;

目标：搞清楚 “什么样的图片是现实中合理、常见的”

## （3）Conditional Generative Model: Learn $p(x|y)$

&lt;img width='623' height='428' alt='Image' src='https://github.com/user-attachments/assets/1485fc8a-e488-41dd-b0ec-82e27266ec4f' /&gt;

目标：学习每一类标签专属的图像分布

&lt;img width='931' height='437' alt='Image' src='https://github.com/user-attachments/assets/c932f7df-943b-4645-8a83-d79545968c4f' /&gt;

一般来说，Generative model在实际中应用较少，Conditional generative models应用更加广泛

# 3、Why Generative Models?

Modeling ambiguity: If there are many possible outputs x for an input y, we want to model $P(x | y)$

Language Modeling: Produce output text x from input text y

# 4、Taxonomy of Generative Models

&lt;img width='997' height='455' alt='Image' src='https://github.com/user-attachments/assets/e401078d-d694-44ef-b3c3-6709a87259b9' /&gt;

左边分支：可以写出概率分布；右边分支：写不出概率分布
左左：精确可计算密度；左右：近似密度
右左：可以一步直接采样；右右：间接迭代采样，需多轮

# 5、MLE（最大似然估计）

## （1）基础原理

&lt;img width='943' height='492' alt='Image' src='https://github.com/user-attachments/assets/13e96a15-fc22-4109-8da4-c7da5a3ac819' /&gt;

## 各个参数含义
### 1. $x$：单个数据样本
 $x$ 代表**一条完整训练数据**，根据模型场景含义不同：
大语言模型（GPT自回归）： $x$ = 一整段文本序列 $x=(x_1,x_2,...,x_T)$，  $x_1,x_2$ 是句子里每个单词/Token；
图像模型（PixelCNN自回归）： $x$ = 一张图片，展平成像素序列 $x=(x_1,x_2,...,x_T)$， $x_t$ 是第t个像素；

 $x^{(i)}$ 加了上标 $(i)$：数据集里第 $i$ 个样本，一共有 $N$ 个样本， $i=1,2,...,N$。</description><guid isPermaLink="true">https://personawsx.github.io/post/cs231n%20lecture%2013%20Generative%20Models%201.html</guid><pubDate>Mon, 13 Jul 2026 04:03:34 +0000</pubDate></item><item><title>cs231n lecture 12 Self-Supervised Learning</title><link>https://personawsx.github.io/post/cs231n%20lecture%2012%20Self-Supervised%20Learning.html</link><description> 
&lt;img width='937' height='487' alt='Image' src='https://github.com/user-attachments/assets/01c7141a-26ef-4488-a8d2-52a9a34f9ea9' /&gt;
Pretext Objective：
能自动把视觉上同类的图片区分开、聚集在一起，但不能独立完成分类任务，也不认识任何类别名称

# 1、Self-Supervised pretext tasks
&lt;img width='877' height='390' alt='Image' src='https://github.com/user-attachments/assets/5f5f8146-f110-440b-9a6d-30b5603a688b' /&gt;

### （1）主要任务：
&lt;img width='883' height='442' alt='Image' src='https://github.com/user-attachments/assets/279cc097-9aa0-4a9f-8723-6e6fb989aeac' /&gt;

### （2）How to evaluate？
&lt;img width='903' height='443' alt='Image' src='https://github.com/user-attachments/assets/1f616730-a7e9-49b6-a292-8cd8ca833fdd' /&gt;
其中，一般最关注的是下游任务的表现，即Transfer Learning and Downstream Task Performance

&lt;img width='972' height='472' alt='Image' src='https://github.com/user-attachments/assets/964f1664-2fd7-4a8e-99d2-06aa65368650' /&gt;

自监督预训练：卷积层 conv + 全连接 fc，以预测旋转角度90°为训练目标，预训练完成后，会丢弃旋转预测用的全连接头，只保留卷积主干用于下游迁移

# 2、Pretext task from image transformations
### （1）predict rotations

&lt;img width='913' height='411' alt='Image' src='https://github.com/user-attachments/assets/ae39ebae-f89e-46d3-8fd0-a4d0989f605a' /&gt;

### （2）predict relative patch locations

&lt;img width='845' height='413' alt='Image' src='https://github.com/user-attachments/assets/a7120e06-3a48-4f83-ba03-6e6463476a72' /&gt;

 example：

&lt;img width='972' height='408' alt='Image' src='https://github.com/user-attachments/assets/e423bd67-01bf-4f23-aa69-da5c052a7cf1' /&gt;
论文提前预先定义了64 种不同的打乱置换规则（表格里index=64代表第 64 套打乱顺序，如9,4,6,8,3,2,5,1,7就是一种 打乱排列）
每一种打乱排列 = 一个独立类别
总共预设了 64 种合法打乱方案，因此输出分类维度是64

### （3）predict missing pixels（inpainting）修复

&lt;img width='828' height='438' alt='Image' src='https://github.com/user-attachments/assets/b920d8c2-30c3-49c5-8f0e-e9f5b1991916' /&gt;


总损失由重建损失与对抗损失两部分相加构成：
$$L(x) = L_{recon}(x) + L_{adv}(x)$$
$L_{recon}$ 代表像素重建损失
$L_{adv}$ 代表GAN对抗生成损失

### a:全部符号定义
1. $x$：原始完整真实图像
2. $M$：二值掩码矩阵（与图像同尺寸，逐像素运算）

$$
M_{i,j}=
\begin{cases}
0 &amp; \text{未被遮挡区域（原图保留区域）} \\
1 &amp; \text{被遮挡缺失区域（网络需要补全的区域）}
\end{cases}
$$

3. $*$：逐元素相乘（Element wise multiplication），不是矩阵乘法
4. $F_\theta$：修复生成网络（编码器+解码器，$\theta$ 为网络参数），输入残缺掩码图，输出补全后的完整图像
5. $D$：GAN判别网络，用于区分真实图像与网络修复生成的图像
6. $\|\cdot\|_2^2$：L2平方范数，等价于像素层面均方误差MSE
7. $\mathbb{E}[\cdot]$：对一个批次的图像做数学期望

### b:重建损失 
$L_{recon}(x) = \big\| M * \big(x - F_\theta\big((1-M)*x\big)\big) \big\|_2^2$

#### 分步运算逻辑
1. $(1-M)*x$
掩码取反后与原图逐像素相乘：
- 未遮挡区域 $M=0 \Rightarrow 1-M=1$，保留原图原始像素；
- 遮挡区域 $M=1 \Rightarrow 1-M=0$，像素置零，得到残缺输入图像。</description><guid isPermaLink="true">https://personawsx.github.io/post/cs231n%20lecture%2012%20Self-Supervised%20Learning.html</guid><pubDate>Mon, 13 Jul 2026 04:03:03 +0000</pubDate></item><item><title>cs231n lecture 11 Large-Scale Distributed Training</title><link>https://personawsx.github.io/post/cs231n%20lecture%2011%20Large-Scale%20Distributed%20Training.html</link><description># 1、How to train on lots of GPUs？

&lt;img width='895' height='442' alt='Image' src='https://github.com/user-attachments/assets/eb2cfe8f-ce5b-476a-b3d9-31a2837b29c4' /&gt;

## 1.1 Data Parallelism
。</description><guid isPermaLink="true">https://personawsx.github.io/post/cs231n%20lecture%2011%20Large-Scale%20Distributed%20Training.html</guid><pubDate>Thu, 09 Jul 2026 13:29:45 +0000</pubDate></item><item><title>cs231n lecture 10 Vedio Understanding</title><link>https://personawsx.github.io/post/cs231n%20lecture%2010%20Vedio%20Understanding.html</link><description>Vedio=2D+Time（4D tensor：T×3×H×W）
Videos are ~30 frames per second (fps)
Size of uncompressed video
(3 bytes per pixel):
SD (640 x 480): ~1.5 GB per minute
HD (1920 x 1080): ~10 GB per minute
Solution: Train on short clips: low fps and low spatial resolution

&lt;img width='985' height='503' alt='Image' src='https://github.com/user-attachments/assets/fc2bb18b-b6d2-4d03-9a63-45398adff8eb' /&gt; 

# 1、Vedio Classification

## 1.1 Single-Frame CNN

&lt;img width='981' height='492' alt='Image' src='https://github.com/user-attachments/assets/df32fdab-4864-4c43-8cd9-70f02a020017' /&gt;

## 1.2 Late Fusion
### a:（with FC layers）

&lt;img width='992' height='492' alt='Image' src='https://github.com/user-attachments/assets/4882a5ea-8f18-4443-ad9c-923356a527a5' /&gt;

Problem：需要用到非常大的全连接层。</description><guid isPermaLink="true">https://personawsx.github.io/post/cs231n%20lecture%2010%20Vedio%20Understanding.html</guid><pubDate>Thu, 09 Jul 2026 13:09:59 +0000</pubDate></item><item><title>cs231n lecture 9 Object Detection，Image Segmentation，Visualizing</title><link>https://personawsx.github.io/post/cs231n%20lecture%209%20Object%20Detection%EF%BC%8CImage%20Segmentation%EF%BC%8CVisualizing.html</link><description># 1 ViT（Vision Transformer）
## 1.1 使用cls token
&lt;img width='1003' height='505' alt='Image' src='https://github.com/user-attachments/assets/28bbf6fb-5aee-4655-b940-c3a7396426de' /&gt;

## （1）基础概念回顾
1. **Patch**：单张图像分割出的像素小方块；
2. **N**：单张图片分割得到的Patch总数量，图片所示维9；
3. **Token**：经过线性投影后的D维特征向量，是Transformer处理的最小序列单元；
4. **D**：单个Token的特征向量维度；
5. **L**：单张图完整序列长度， $L=N+1$（N个Patch Token + 1个分类Token）；
6. **Batch**：模型一次并行处理的图片总数；
7. **NLP Transformer**：Transformer最初用于自然语言处理（见lecture 8），ViT直接复用完全相同的Encoder结构。</description><guid isPermaLink="true">https://personawsx.github.io/post/cs231n%20lecture%209%20Object%20Detection%EF%BC%8CImage%20Segmentation%EF%BC%8CVisualizing.html</guid><pubDate>Wed, 08 Jul 2026 09:09:06 +0000</pubDate></item><item><title>cs231n lecture 8 Attention and Transformers</title><link>https://personawsx.github.io/post/cs231n%20lecture%208%20Attention%20and%20Transformers.html</link><description># 1、Sequence to sequence   with RNNs：
### 编码器 - 解码器（Encoder-Decoder）模型

&lt;img width='937' height='390' alt='Image' src='https://github.com/user-attachments/assets/2298c0d9-c346-4a8f-a932-95c0cbc58d5a' /&gt;

## Encoder 编码器
### 1. 公式
$$h_t = f_W(x_t, h_{t-1})$$
- $f_W$：带权重 $W$ 的 RNN 单元（基础 RNN/LSTM/GRU）
- $x_t$：第 $t$ 个输入词的词嵌入向量，图中输入 $x_1=\text{we},x_2=\text{see},x_3=\text{the},x_4=\text{sky}$
- $h_{t-1}$：上一时刻隐藏状态， $h_t$ 当前时刻隐藏状态
- 时序流向： $x_1 \rightarrow h_1 \rightarrow h_2 \rightarrow h_3 \rightarrow h_4$，信息单向向后传递

### 2. 上下文向量 Context vector $c$
- $T$ 是输入序列总长度（本例 $T=4$）
- 一般直接取编码器最后一步隐藏状态 $h_4$ 作为全局上下文向量 $c$
- 作用：把整句英文的全部语义压缩进单一固定维度向量，传给解码器

## Decoder 解码器
### 1. 公式
$$s_t = g_U(y_{t-1}, s_{t-1}, c)$$
- $g_U$：解码器 RNN 单元（权重 $U$，和编码器权重独立）
输入三部分：
1. $y_{t-1}$：上一步生成的单词（词嵌入）；第一步输入特殊起始符 $y_0=[\text{START}]$
2. $s_{t-1}$：解码器上一时刻隐藏状态
3. $c$：全局上下文向量（每一步解码都会复用同一个 $c$，这是无注意力机制的短板）
- $s_t$：解码器当前隐藏状态，用来预测当前输出单词 $y_t$

### 2. 解码器初始状态 $s_0$
Initial decoder state $s_0$
- 解码器第一个隐藏状态 $s_0$ 直接由上下文向量 $c$ 初始化，让解码器一开始就拥有整句输入的全局语义。</description><guid isPermaLink="true">https://personawsx.github.io/post/cs231n%20lecture%208%20Attention%20and%20Transformers.html</guid><pubDate>Tue, 07 Jul 2026 12:13:36 +0000</pubDate></item><item><title>cs231n lecture 7 Recurrent Neural Networks</title><link>https://personawsx.github.io/post/cs231n%20lecture%207%20Recurrent%20Neural%20Networks.html</link><description># 1、Recurrent Neural Networks：Process Sequences

&lt;img width='814' height='251' alt='Image' src='https://github.com/user-attachments/assets/3f26d387-c9ff-495d-b1c0-0143e42ae9fd' /&gt;

#### RNN特点：当前时刻的计算依赖于当前时刻和前一时刻的RNN状态。</description><guid isPermaLink="true">https://personawsx.github.io/post/cs231n%20lecture%207%20Recurrent%20Neural%20Networks.html</guid><pubDate>Tue, 07 Jul 2026 11:25:17 +0000</pubDate></item><item><title>cs231n lecture 6 Training CNNs and CNN Architectures</title><link>https://personawsx.github.io/post/cs231n%20lecture%206%20Training%20CNNs%20and%20CNN%20Architectures.html</link><description># Lecture Overview – Two Broad Sets of Topics
# 课程总览：两大核心主题模块

# 一、How to build CNNs? 如何搭建卷积神经网络
（1）Layers in CNNs：卷积网络各类层（卷积层、池化层、全连接层等）
（2）Activation Functions：激活函数（ReLU等非线性变换）
（3）CNN Architectures：经典CNN网络结构（LeNet、AlexNet、VGG等）
（4） Weight Initialization：权重初始化方法

# 二、How to train CNNs? 如何训练卷积神经网络
（1）Data Preprocessing：数据预处理
（2）Data augmentation：数据增强
（3）Transfer Learning：迁移学习
（4）Hyperparameter Selection：超参数选择

# 1、Normalization

&lt;img width='798' height='245' alt='Image' src='https://github.com/user-attachments/assets/d775b293-8d2c-4df4-a49c-d5d72116c7b2' /&gt;

#### 维度字母释义
$N$：Batch 批量样本数
$C$：Channel 通道数
$H$：Height 特征图高度
$W$：Width 特征图宽度

#### 四种归一化统计区间
（1）BatchNorm：同一通道，跨全部样本 N,H,W
（2）LayerNorm：单样本，跨全部通道 C,H,W
（3）InstanceNorm：单样本单通道，仅 H,W
（4）GroupNorm：单样本分通道组，每组内 H,W

# 2、Regularization：Dropout
### （1）训练阶段原理
In each forward pass, randomly set some neurons to zero
每一轮前向传播时，随机将一部分神经元输出置0，使其失效。</description><guid isPermaLink="true">https://personawsx.github.io/post/cs231n%20lecture%206%20Training%20CNNs%20and%20CNN%20Architectures.html</guid><pubDate>Thu, 02 Jul 2026 17:52:47 +0000</pubDate></item><item><title>cs231n lecture 5 Image Classification with CNNs</title><link>https://personawsx.github.io/post/cs231n%20lecture%205%20Image%20Classification%20with%20CNNs.html</link><description># 1、Last Time: Neural Networks
### （1）Linear score function（单层线性分类器）
$$f = Wx$$

### （2）2-layer Neural Network（两层全连接神经网络）
$$f = W_2 \max(0, W_1 x)$$

### （3）存在的问题
Problem: The spatial structure of images is destroyed!

### 问题说明
全连接层需要把二维图像展平成一维长向量，**丢失了图像原本的空间位置、局部相邻像素结构信息**，这是全连接处理图像的核心缺陷。</description><guid isPermaLink="true">https://personawsx.github.io/post/cs231n%20lecture%205%20Image%20Classification%20with%20CNNs.html</guid><pubDate>Thu, 02 Jul 2026 14:40:09 +0000</pubDate></item><item><title>cs231n lecture 4 Neural Networks and Backpropagation</title><link>https://personawsx.github.io/post/cs231n%20lecture%204%20Neural%20Networks%20and%20Backpropagation.html</link><description># 1、Neural networks
###  （1）the original linear classifier
Linear score function:
$$f = Wx$$
$$x \in \mathbb{R}^D,\ W \in \mathbb{R}^{C \times D}$$
D为输入数据的维度，C为输出数据的维度
### （2）2 layers

2-layer Neural Network
$$f = W_2 \max(0, W_1 x)$$

$$x \in \mathbb{R}^D,\ W_1 \in \mathbb{R}^{H \times D},\ W_2 \in \mathbb{R}^{C \times H}$$
### 注：
max( )是用来建立 $W_1$和 $W_2$之间的非线性关系，此类网络又叫作全连接网络，
max( )又叫作 activation function（激活函数），activation function通常在中间层进行操作。</description><guid isPermaLink="true">https://personawsx.github.io/post/cs231n%20lecture%204%20Neural%20Networks%20and%20Backpropagation.html</guid><pubDate>Thu, 02 Jul 2026 08:18:35 +0000</pubDate></item><item><title>cs231n lecture 3 Regularization and Optimization</title><link>https://personawsx.github.io/post/cs231n%20lecture%203%20Regularization%20and%20Optimization.html</link><description># 1、Regularization 正则化（Prevent the model from doing too well on training data）
### （1）损失函数公式
$$
L(W) = \frac{1}{N}\sum_{i=1}^N L_i \big( f(x_i, W), y_i \big) + \lambda R(W)
$$

### 公式分项说明
### Data loss: Model predictions should match training data
### 数据损失：约束模型预测结果贴合训练样本真实标签
$\frac{1}{N}\sum_{i=1}^N L_i\big(f(x_i, W), y_i\big)$

### Regularization: Prevent the model from doing too well on training data
### 正则项：避免模型在训练集上过拟合
$\lambda R(W)$

正则化的要点：不要过度拟合数据，有时简单的模型反而效果更好

### （2）Simple examples

### L1 regularization：
$$
R(W) = \sum_k \sum_l | W_{k,l} |
$$

其中  $W_{k,l}$是在对输入的值做运算时用到的矩阵 $W_{k,l}$。</description><guid isPermaLink="true">https://personawsx.github.io/post/cs231n%20lecture%203%20Regularization%20and%20Optimization.html</guid><pubDate>Wed, 01 Jul 2026 16:18:03 +0000</pubDate></item><item><title>cs231 lecture 2 Image Classification with Linear Classifiers</title><link>https://personawsx.github.io/post/cs231%20lecture%202%20Image%20Classification%20with%20Linear%20Classifiers.html</link><description># 1、Data-driven Approaches
Problems：Semantic Gap 语义鸿沟（计算机和人之间沟通的脱节）
Challenges：
（1）Viewpoint Variation
（2）Illumination（光照）
（3）Background Clutter（背景凌乱）
（4）Occlusion（阻塞）
（5）Deformation（变形）
（6）Intraclass Variation（类内变异）
（7）Context（背景）

### Machine Learning
 a、Collect a dataset of images and labels
 b、Use Machine Learning algorithms to train a classifier
 c、Evaluate the classifier on new images

# 2、Nearest Neighbor Classifier
### (1)Memorize all data and labels:
```python
def train(images,labels):
# Machine learning!
  return model
```
### (2)Predict the label of the most similar training image:
```python
def predict(model,test_images):
#Use model to predict labels 
  return test_labels
```

### L1 distance： $$d_1(I_1,I_2) = \sum_{p} \left| I_1^p - I_2^p \right|$$

### test image
| 56 | 32 | 10  | 18  |
|----|----|-----|-----|
| 90 | 23 | 128 | 133 |
| 24 | 26 | 178 | 200 |
| 2  | 0  | 255 | 220 |
### training image
| 10 | 20 | 24  | 17  |
|----|----|-----|-----|
| 8  | 10 | 89  | 100 |
| 12 | 16 | 178 | 170 |
| 4  | 32 | 233 | 112 |
### pixel-wise absolute value differences（逐像素绝对值差）
| 46 | 12 | 14 | 1  |
|----|----|----|----|
| 82 | 13 | 39 | 33 |
| 12 | 10 | 0  | 30 |
| 2  | 32 | 22 | 108 |

所有像素差值求和：**add → 456**
python代码实现：
```python
import numpy as np

class NearestNeighbor:
    def __init__(self):
        pass

    def train(self, X, y):
        ''' X is N x D where each row is an example. Y is 1-dimension of size N '''
        # the nearest neighbor classifier simply remembers all the training data
        self.Xtr = X
        self.ytr = y

    def predict(self, X):
        ''' X is N x D where each row is an example we wish to predict label for '''
        num_test = X.shape[0]
        # lets make sure that the output type matches the input type
        Ypred = np.zeros(num_test, dtype = self.ytr.dtype)

        # loop over all test rows
        for i in xrange(num_test):
            # find the nearest training image to the i'th test image
            # using the L1 distance (sum of absolute value differences)
            distances = np.sum(np.abs(self.Xtr - X[i,:]), axis = 1)
            min_index = np.argmin(distances) # get the index with smallest distance
            Ypred[i] = self.ytr[min_index] # predict the label of the nearest example

        return Ypred
```
上述最近邻算法其实是取k-近邻中k=1时的特殊情况，为了增强鲁棒性，有时会取k≥2，但此时会增加算法的复杂程度。</description><guid isPermaLink="true">https://personawsx.github.io/post/cs231%20lecture%202%20Image%20Classification%20with%20Linear%20Classifiers.html</guid><pubDate>Mon, 29 Jun 2026 14:53:44 +0000</pubDate></item><item><title>cs231 lecture 1 Introduction</title><link>https://personawsx.github.io/post/cs231%20lecture%201%20Introduction.html</link><description># 1、Deep Learning Basic
### core task in CV：Image Classification
## （1）Linear Classifier（Data need to be separable）
&lt;img width='405' height='377' alt='Image' src='https://github.com/user-attachments/assets/2c5e97de-f656-4c8d-a1a8-a09bdb1e2311' /&gt;

The task of linear classifier is to find the linear function to distinguish different objects.
## （2）Complex patterns‘ challenges：overfitting&amp;underfitting（过拟合&amp;欠拟合）
Regulation&amp;Optimization（正则化&amp;优化）
## （3）Neural Networks：to model non-linear functions

# 2、Perceiving and Understanding the Visual World
## （1）Tasks Beyond Image Classification
### a:
Classification：CAT
&lt;img width='612' height='532' alt='Image' src='https://github.com/user-attachments/assets/38d5e04a-e2be-4c1e-abe4-3b0ee050a6eb' /&gt;

Semantic Segmentation（第一语义分割）：GRASS,CAT,TREE,SKY
&lt;img width='620' height='532' alt='Image' src='https://github.com/user-attachments/assets/5aad7125-6d95-4680-af05-574e8629b208' /&gt;

Object Detection：Pinpoint the location，bounding boxes
&lt;img width='607' height='517' alt='Image' src='https://github.com/user-attachments/assets/93feabe5-c133-4917-a89f-d875777a493b' /&gt;

Instance Segmentation:the most granular(最精细)
&lt;img width='620' height='530' alt='Image' src='https://github.com/user-attachments/assets/15902884-c590-4acf-acdd-fb0f7420e688' /&gt;

### b：
video classification
Multimodal Video Understanding（多模态视频理解，结合声音等其他因素）

### c：
Large scale distributed training 大规模分布式训练
Data Parallelism or Model Parallelism

# 3、Generative and Interactive Visual Intelligence
2D：
（1）Self-supervised Learning（Machine learning）：models learn to understand and represent data
（2）Generative Modeling
（3）Vision Language Models（connect text and images）
# 4、Human-Centered Applications and Implications

。</description><guid isPermaLink="true">https://personawsx.github.io/post/cs231%20lecture%201%20Introduction.html</guid><pubDate>Mon, 29 Jun 2026 10:42:41 +0000</pubDate></item><item><title>你好</title><link>https://personawsx.github.io/post/ni-hao.html</link><guid isPermaLink="true">https://personawsx.github.io/post/ni-hao.html</guid><pubDate>Mon, 29 Jun 2026 06:27:13 +0000</pubDate></item></channel></rss>