Everything you care about in one place

Follow feeds: blogs, news, RSS and more. An effortless way to read and digest content of your choice.

Get Feeder

terenceli.github.io

不忘初心 方得始终

Get the latest updates from 不忘初心 方得始终 directly as they happen.

Follow now 97 followers

Latest posts

Last updated 2 days ago

大模型是如何进行推理的?-transformer的一点代码调试分析

3 days ago

背景 最近在学习LLM,网上资料很多,很多都是洋洋洒洒讲了一堆原理,公式、图表一堆,这些当然很重要,但是如果能有系统性的相关代码分析与调试则更能让初学者有直观的体验。这部分不能说没有,但是也不多,并且比较零散。本文试图从transformer库的代码调试分析大模型的一次推理过程,让初学者能够理解推理的本质过程。下面的图展示了大模型一次推理的基本流程。初始的prompt输入之后,经过Tokenizer、Embeding,输入字符变成相关向量,并且经过大模型神经网络的一次forward,输出vocab size大小的tensor,每个表示该词的概率大小。最终选取概率最大的作为next token。 本文主要就是从代码层面分析这个流程。 具体来讲,本文包括如下部分: 通过transformer使用大模型。在使用过程中,我们提出下面三个问题:模型文件究竟是啥?模型文件是如何加载到模型中的?具体某个模型比如qwen模型结构分析。并在随后的部分依次解答。 safetensors模型文件分析 safetensors模型文件加载到模型过程分析 模型的整体推理过程 本文使用的大模型为 DeepSeek-R1-Distill-Qwen-1.5B,这个模型能够在CPU上跑。...

Deploy a 'hello world' model serving using triton server without GPU

about 1 month ago

The first is reproduced and modified from here. This uses fashion mnist...

lguest internals

2 months ago

lguest is the simpliest x86 virtualization solution. It is a paravirt hypervisor...

Run lguest on Linux kernel 4.4

8 months ago

Background Recently, I am preparing to study the PVM solution proposed by...

The anatomy of chroot escape

12 months ago

Recently I have read the old chroot escape methods in Linux. Using...

Multi-thread process can't unshare pid namespace (in some old Linux version)

about 1 year ago

The issue When we unshare CLONE_NEWPID in a go program, we got...

CVE-2021-3493 Ubuntu overlayfs privilege escalation vulnerability analysis

over 2 years ago

CVE-2021-3493 is a logic vulnerability in overlayfs filesystem, with a change of...

containerd CVE-2022-23648: path traversal never die

about 3 years ago

The spec Path traversal is a classical kind of security issue in...

Container escape using dirtypipe

about 3 years ago

Background The story begins with the pictures that Yuval Avrahami shows in...

CVE-2022-0492: how release_agent escape become a vulnerability

about 3 years ago

The cgroup release_agent escape is a classical user mode helper escape issue...

Java反序列化漏洞研究前序: Transformer、动态代理与注解

over 3 years ago

今年给自己定了一个研究清楚Java反序列化漏洞的KPI,反序列化漏洞本身原理并不复杂,但是网上的资料都不甚满意,大部分都是只是知道怎么用别人的PoC,并没有对具体的原理做深入的分析和思考,特别是Commons Collections一系列的分析,非常不满意,比如反序列化为什么需要有自己的readObject、为什么AnnotationInvocationHandler的第一个参数为Override.class和Target.class都可以。最终我决定自己深入分析各个知识点。最主要是分析动态代理和注解,但是为了完整第一部分会分析Transformer。 PoC 首先,先放上最基本的Commons Collections的PoC,如下代码会直接弹出计算器。 public static void main(String[] args) throws Exception...

runc internals, part 3: runc double clone

over 3 years ago

Now that we have analyzed the general process of ‘runc create’ and...