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 14 days ago

vLLM源码(V0)结构分析

15 days ago

vLLM使用通常如下(本地推理,非服务): from vllm import LLM llm = LLM(model="facebook/opt-125m") outputs = llm.generate("Hello, my...

vLLM中的Paged Attention分析

21 days ago

基本概念 上一篇文章中介绍了KV cache的概念以及作用,由于KV cache在推理中的作用性能提升很大,所以现在各种推理框架都会支持KV cache。本文介绍vLLM中的核心原理Paged Attention的实现,本文不会详细介绍vLLM的基本原理以及vLLM整体的源码架构分析(将来有机会争取写一下),所以假设读者需要熟悉大模型的基本推理过程以及vLLM基本代码架构,图解大模型计算加速系列之:vLLM核心技术PagedAttention原理文章是不错的介绍vLLM Paged Attention的原理性文章。 推理框架在进行推理过程中一个重要的环节是计算各个token之间的自注意力,KV cache保存了之前token的KV值,在计算当前token时,会引用KV cache中值。vLLM Paged...

transformer库中的kv cache分析与调试

about 1 month ago

这篇文章记录了kv cache到底cache的是啥,以及为啥kv cache能够work。在研究kv cache的时候,有两个问题困扰我很久。 为什么说只有causal模型能够使用kv cache transformer中默认代码里面没有使用causal mask kv cache原理 我们知道,transformer里面一个重要环节是做self attention,而self...

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

about 2 months 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

3 months ago

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

lguest internals

4 months ago

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

Run lguest on Linux kernel 4.4

10 months ago

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

The anatomy of chroot escape

about 1 year 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

almost 3 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

over 3 years ago

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