DeepInfer Explained

Glossary

Referenceabout 17 min read

Code version: DeepInfer @ 9bd9cf2 · 2026-10-21

This page lists every term that has a tooltip on this site. Each entry gives a short definition. Many entries link to a page with the full explanation.

A B C D E F G H I K L M N P Q R S T V Z

A#

accelerator also: device

A chip that does AI math much faster than a CPU. In DeepInfer, an accelerator is an NVIDIA GPU or a Huawei Ascend NPU.

Read more: Hardware platforms: NVIDIA and Ascend

AFD also: Attention-FFN Disaggregation

Attention-FFN Disaggregation. A design that runs attention layers and FFN (expert) layers on different groups of devices. DeepInfer does not use it.

Read more: Hardware platforms: NVIDIA and Ascend

attention also: self-attention

The layer step where each token looks at the earlier tokens. It compares its query with their keys and makes a weighted sum of their values.

Read more: Attention, step by step

attention head also: head, heads, head_dim, kv heads

One independent copy of attention inside a layer. A layer has several heads; each head has its own queries, keys and values of size head_dim.

Read more: Attention, step by step

B#

block also: KV block, cache block, page, physical block

A fixed-size part of the KV cache that holds the keys and values of a fixed number of tokens. In DeepInfer one block holds 128 tokens for all layers.

Block 0 is never given to a sequence; the free list starts at block 1 (csrc/engine/block_manager.hpp:27-35).

Read more: Paged KV cache and block manager

block table also: block_table, page table

A list per sequence that maps its logical block 0, 1, 2 ... to physical block ids in the KV cache pool.

In DeepInfer it is std::vector<int> block_table in KvCacheState (csrc/engine/sequence.hpp:200-207).

Read more: Paged KV cache and block manager

BlockManager also: block manager, state_manager

The C++ object that owns the free list of KV cache blocks. It gives blocks to sequences and takes them back.

Defined in csrc/engine/block_manager.hpp:119-187. DeepInfer makes two: one for KV blocks and one for state slots.

Read more: Paged KV cache and block manager

C#

CANN

Compute Architecture for Neural Networks. Huawei's software stack (driver, runtime, libraries) for Ascend NPUs. It has the same role as CUDA.

The README asks for CANN 9.2 on Ascend (README.md:52).

Read more: Hardware platforms: NVIDIA and Ascend

chunked prefill also: chunk, chunked_prefill

Splitting a long prompt into parts that run in several prefill steps, so that one step never has more than max_num_batched_tokens tokens.

The cut is in csrc/engine/scheduler.hpp:470-475. Each chunk goes through the sampler, but only the token of the last chunk becomes an output (csrc/engine/prepare_sample.cpp:173-174, csrc/engine/scheduler.hpp:1011-1020).

Read more: The scheduler

collective operation also: collective

A communication step in which all ranks of a group take part, for example all-reduce, all-gather or all-to-all.

Read more: Parallelism basics

context parallelism also: CP, mirror CP

Several devices share the tokens of one long prefill. In DeepInfer, CP ranks are extra worker processes that receive their inputs from the driver.

The driver broadcasts the input metadata to the other CP ranks (deepinfer/worker/model_runner.py:200-212).

Read more: Context parallelism (mirror CP)

CUDA

NVIDIA's programming model, compiler and runtime for its GPUs. PyTorch calls it through the torch.cuda module.

Read more: Hardware platforms: NVIDIA and Ascend

CUDA graph also: graph replay, cudagraph

A recording of all kernel launches of one forward pass for a fixed batch size. A replay starts all kernels with one call, so the CPU cost is small.

DeepInfer replays a graph in decode steps (deepinfer/worker/model_runner.py:326-329).

Read more: CUDA graphs

D#

data parallelism also: DP

DP. Several devices run the same model part, and each device works on different requests.

Read more: Parallelism basics

decode also: decode step, decoding

The second phase of generation. Each step makes one new token per sequence (more with speculative decoding) and adds its keys and values to the KV cache.

Read more: Prefill and decode

DeepEP also: dispatch, combine

DeepSeek's communication library for MoE. Its dispatch step sends tokens to the devices of their experts. Its combine step brings the results back.

Read more: Expert parallelism (dispatch/combine)

descriptor also: __get__, non-data descriptor, EnvVar

A Python object that is stored as a class attribute and controls what an attribute read returns, through its __get__ method.

DeepInfer uses a descriptor, EnvVar, for each environment variable. On the first read it parses the variable and puts the plain value in its own place (deepinfer/environ.py:44-57).

Read more: Environment variables

DFlash also: MTP_module, draft model

The draft module of DeepInfer. In each decode step, the sampler calls it once after the draft check, and it proposes the drafts for the next step.

DFlash.decode_forward in deepinfer/model_executor/models/mtp/dflash.py:378-387.

Read more: mtp/dflash.py

draft token also: draft, drafts, nextn token

A guessed next token from the MTP module. The next decode step sends it as input, and the sampler accepts or rejects it.

Stored in MtpState::draft_tokens (csrc/engine/sequence.hpp:122).

Read more: Speculative decoding

driver worker also: driver_worker, follower worker

The Worker object that runs in the same process as LLMEngine. It does the model work for its rank and sends each method call to the other context-parallel ranks.

Made in deepinfer/engine/llm_engine.py:402-413 with is_driver_worker=True. Follower workers run in their own processes and wait in a loop for calls (deepinfer/worker/base.py:129-133).

Read more: engine/llm_engine.py: the LLMEngine class

dtype also: data type

The number format of a tensor, for example bfloat16, float8 or int32. It sets how many bytes each value uses.

Read more: Number formats: BF16, FP8, FP4

E#

E/P/D disaggregation also: EPD, VE/Prefill/Decode

A deployment that runs the vision encoder (E), prefill (P) and decode (D) as separate model instances. It is not included in this DeepInfer release.

Read more: Hardware platforms: NVIDIA and Ascend

engine callbacks also: EngineCallbacks, post_process, pre_sampler_sync

Two engine functions that the driver worker calls during a step: pre_sampler_sync after sampling starts, and post_process when a step's results are ready.

The engine passes them in an EngineCallbacks object (deepinfer/engine/llm_engine.py:398-400, deepinfer/worker/worker.py:43-48).

Read more: engine/llm_engine.py: the LLMEngine class

engine step also: step, iteration

One call of LLMEngine.step(): schedule a batch, run the model once on the device, sample, and update the requests. Generation is a loop of steps.

LLM._run_engine() calls step() until no request is unfinished (deepinfer/entrypoints/llm.py:176-186).

Read more: One engine step

environment variable also: env var

A named text value that a process gets when it starts, for example CUDA_VISIBLE_DEVICES=0,1. DeepInfer reads many settings this way.

Read more: Environment variables

EOS token also: EOS, BOS, end of sequence

End of sequence: a special token that tells the engine to stop a request. In the release tokenizer, EOS has id 1 and BOS (begin of sequence) has id 0.

Checked in deepinfer/hugging_face/tokenizer.py:36-39. The scheduler stops a request at EOS unless ignore_eos is set (csrc/engine/scheduler.hpp:1038-1041).

Read more: Tour: Life of a request

expert parallelism also: EP

EP. The experts of an MoE layer are split across devices. Tokens go to the devices that hold their experts, and the results come back.

Read more: Expert parallelism (dispatch/combine)

extension module

A compiled library (a .so file) that Python imports like a normal module. deepinfer._C is DeepInfer's C++ extension module.

Read more: The Python and C++ boundary

F#

FP8

An 8-bit floating-point number format. It uses half the memory of BF16. It needs scale factors to keep enough precision.

Read more: Number formats: BF16, FP8, FP4

fragmentation also: internal fragmentation, external fragmentation, wasted slots

Memory that is reserved but not used. With paging, only the last block of each sequence can be partly empty (internal fragmentation).

Read more: The KV cache

G#

git submodule also: submodule

A folder in a git repository that points to a commit of another repository. A plain clone leaves the folder empty until you run git submodule update.

DeepInfer has six submodules in vendor/ (.gitmodules). scripts/build_vendor.sh fetches them (scripts/build_vendor.sh:27-28).

Read more: Code map: the folder tree

Gloo

A torch.distributed backend that sends CPU tensors over the network. DeepInfer uses it for CPU-side groups and for the first start-up connection.

Read more: Hardware platforms: NVIDIA and Ascend

GPU

Graphics Processing Unit. A chip with thousands of small cores that do the same operation on many values at the same time.

DeepInfer supports NVIDIA SM100 GPUs (README.md:35). On this site, "GPU" means an NVIDIA GPU unless the text says otherwise.

Read more: GPUs, kernels, and speed

H#

HCCL

Huawei Collective Communication Library. It moves tensors between Ascend NPUs. torch_npu adds it to PyTorch as the "hccl" backend.

Read more: Hardware platforms: NVIDIA and Ascend

hidden state also: hidden states, hidden_states

The vector that represents one token inside the model. The embedding makes it from the token id; each layer changes it.

Read more: Inside a transformer

I#

import hook

Code that changes what a Python import statement returns. DeepInfer's npu_ops package uses one to replace two vendor functions on Ascend.

Read more: Hardware platforms: NVIDIA and Ascend

import time also: at import, module level

The moment when Python runs the top level of a module for the first time: module code, class bodies and the default values of function arguments.

A value that code reads at import time does not change when you set the variable after the import. See the import-time table on Environment variables.

Read more: Environment variables

K#

kernel

A small program that runs on the GPU or NPU. One kernel does one operation, for example a matrix multiply, on many values in parallel.

Read more: GPUs, kernels, and speed

kernel factory also: _tl factory

In DeepInfer, a function named ..._tl. You call it with fixed parameters (sizes or dtypes), and it returns a compiled TileLang kernel that you then call with tensors.

Read more: TileLang kernels

KV cache also: key-value cache, kv-cache, kvcache

Device memory that keeps the keys and values of earlier tokens, so that each new token does not compute them again.

In DeepInfer the main cache is paged in blocks of 128 tokens (deepinfer/model_executor/model_metadata_utils.py:133-135). Each sequence also has one state slot with its sliding-window cache.

Read more: The KV cache

KV compression also: compressed attention, compress ratio, kv_compress_ratio, C1, C2

Storing one cache entry for every n tokens instead of one per token. DeepInfer supports the ratios 1 and 2 (C1, C2).

Read more: KV compression

L#

LLM also: large language model, language model

Large language model. A neural network that reads tokens and predicts the next token, one token at a time.

Read more: What an LLM does

LLMEngine also: engine, llm_engine

The Python class that owns the scheduler, the KV block managers and the driver worker. LLM calls its step() again and again until all requests finish.

Defined in deepinfer/engine/llm_engine.py:130. One engine runs in each data-parallel process.

Read more: engine/llm_engine.py: the LLMEngine class

logits also: logit

One raw score per vocabulary token. Softmax turns the scores into probabilities. DeepInfer computes them in float32 only for the rows that it samples.

get_logits in deepinfer/model_executor/layers/sampler_utils.py:20-28.

Read more: Sampling: temperature, top-k, top-p

logprob also: log probability, top_logprobs, token_logprobs

The natural logarithm of the probability of a token. Each RequestOutput carries the logprob of its token and, on request, of the best alternatives.

Read more: Sampling: temperature, top-k, top-p

M#

memory profiling also: profile run, profile_run, profile_num_available_blocks

A test forward pass at start-up. It measures the peak device memory of the model, so that the engine knows how much memory is left for the KV cache.

Read more: Start-up

MoE also: Mixture of Experts

Mixture of Experts. A layer with many small feed-forward networks (experts). A router sends each token to only a few of them.

Read more: Mixture of Experts (MoE)

monkeypatch also: monkeypatch.setattr, monkeypatch.setenv

A pytest fixture that changes an attribute, a dict item or an environment variable for one test, and puts the old value back after the test.

Read more: Environment variables

MTP also: nextn, multi-token prediction

Multi-token prediction: a module that predicts more than one next token. DeepInfer uses DFlash as its MTP module. DEEPINFER_USE_NEXTN_DECODE sets the number of drafts (default 5).

The default is in deepinfer/environ.py:129.

Read more: Speculative decoding

N#

NCCL

NVIDIA Collective Communications Library. It moves tensors between NVIDIA GPUs (all-reduce, all-to-all and others). PyTorch calls it the "nccl" backend.

Read more: Hardware platforms: NVIDIA and Ascend

NPU also: Ascend

Neural Processing Unit. Huawei's name for its Ascend AI chips. In DeepInfer, an NPU does the same work as a GPU.

DeepInfer supports Huawei Ascend 950 NPUs (README.md:36).

Read more: Hardware platforms: NVIDIA and Ascend

P#

paged KV cache also: paging, paged attention, PagedAttention

A KV cache that is split into fixed-size blocks. A sequence gets blocks one at a time, from anywhere in the pool, and a block table records where they are.

Read more: Paged KV cache and block manager

pinned memory also: page-locked memory

CPU memory that the operating system cannot move or swap out. The GPU or NPU can copy from it directly (DMA), so copies are faster.

Read more: Hardware platforms: NVIDIA and Ascend

Platform object also: PLATFORM, platform

The object in deepinfer/platform.py that holds the hardware choices: kernel folder, communication backend, FP8 scale-factor type, memory pinning.

There is one Platform object per process. Code gets it as deepinfer.PLATFORM (deepinfer/__init__.py:53-64).

Read more: Hardware platforms: NVIDIA and Ascend

preemption also: preempt, preempted, recompute

The scheduler takes the KV blocks away from a running sequence because the pool is full. The sequence stops, or waits and is computed again later.

DeepInfer does this in Scheduler::_preempt (csrc/engine/scheduler.hpp:766-790).

Read more: The scheduler

prefill also: prompt phase, prefill step

The first phase of generation. The model reads all prompt tokens in one pass and fills the KV cache for them.

Read more: Prefill and decode

process group

A set of ranks that communicate through torch.distributed. Each group uses one backend, for example NCCL, HCCL or Gloo.

Read more: Hardware platforms: NVIDIA and Ascend

pybind11

A C++ library that makes C++ functions and classes callable from Python. DeepInfer uses it to build deepinfer._C.

Read more: The Python and C++ boundary

Q#

query, key, value also: Q K V, qkv, key, value, query

Three vectors that attention makes for each token. The query asks, the keys of earlier tokens answer, and the values carry the content that is mixed.

Read more: Attention, step by step

R#

rank

The number of one process in a distributed job. In DeepInfer, one rank normally drives one GPU or NPU.

Read more: Parallelism basics

RequestOutputPool also: RequestOutput, request output

A C++ pool of RequestOutput objects. step() returns uint64 handles into this pool. The engine gives the objects back to the pool one step later.

Python code reads a handle with RequestOutput.clone(ptr) (deepinfer/_C/engine.pyi:180-183). LLM clones every output before the next step (deepinfer/entrypoints/llm.py:179-182).

Read more: engine/llm_engine.py: the LLMEngine class

S#

SamplingParams also: sampling parameters, temperature, max_tokens

The settings of one request: temperature, top_p, top_k, max_tokens, seed and more. The engine copies them into the C++ sequence once.

Defined in deepinfer/sampling_params.py:13-53. The C++ side copies the values in SamplingScalars::capture (csrc/engine/sequence.hpp:103-115).

Read more: The sampler

scale factor also: sf

A number that multiplies a block of low-precision values to give their real size. DeepInfer packs one-byte UE8M0 scale factors into int32 (NVIDIA, 4 per value) or int16 (Ascend, 2 per value).

Read more: Low-precision formats

scheduler also: Scheduler, schedule

The C++ object that decides, in each engine step, which sequences run, how many tokens each one sends, and which KV blocks each one gets.

Scheduler::_schedule in csrc/engine/scheduler.hpp:275-345.

Read more: The scheduler

sequence also: seq, Sequence

The engine object for one request: its tokens, its state (waiting, running, finished) and its KV cache blocks.

The C++ class is Sequence (csrc/engine/sequence.hpp:275-321).

Read more: Request and sequence lifecycle

sliding-window attention also: SWA, swa, local attention

Attention that looks only at the most recent W tokens (the window), not at all earlier tokens. Its cache has a fixed size per sequence.

Read more: Sliding-window attention

SM also: SM100, streaming multiprocessor

Streaming Multiprocessor: one compute unit inside an NVIDIA GPU. "SM100" names the NVIDIA Blackwell data-center GPUs. DeepInfer checks only that the compute capability is 10.x.

Read more: GPUs, kernels, and speed

speculative decoding also: speculation, verification

A small module guesses the next tokens (drafts). The main model checks all drafts in one step and keeps the correct prefix, so one step can make several tokens.

Read more: Speculative decoding

state slot also: state_id, StateBlock, state cache

A fixed-size area of device memory per running sequence in DeepInfer. It holds the sliding-window cache and the compression state of that sequence.

The C++ field is state_id (csrc/engine/sequence.hpp:207); the layout is StateBlock (deepinfer/worker/cache_engine.py:221-241).

Read more: Paged KV cache and block manager

structured output also: SO, so_args, xgrammar

Output that must follow a grammar, for example a JSON schema. A matcher masks every token that the grammar does not allow.

Requests with so_args get a matcher from a thread pool before they enter the scheduler (deepinfer/engine/llm_engine.py:606-630).

Read more: Structured outputs

T#

tensor

A multi-dimensional array of numbers, for example a vector or a matrix. A PyTorch tensor is in CPU memory or in GPU/NPU memory.

Read more: Inside a transformer

TileLang

A Python language for writing GPU and NPU kernels. DeepInfer keeps one folder of TileLang kernels for CUDA and one for Ascend.

Read more: TileLang kernels

token also: tokens, token id

The unit of text that a model reads and writes: a word, a part of a word, or a symbol. The model sees each token as an integer id.

Read more: Tokens and tokenizers

tokenizer also: tokenize, detokenize

The program that cuts text into tokens and gives each token an integer id. It also turns ids back into text (decode).

DeepInfer loads the Hugging Face tokenizer of the checkpoint with get_hf_tokenizer (deepinfer/hugging_face/tokenizer.py:77-121).

Read more: Tokens and tokenizers

torch_npu

Huawei's PyTorch plug-in for Ascend NPUs. It adds the torch.npu module and the HCCL backend to PyTorch.

Read more: Hardware platforms: NVIDIA and Ascend

V#

vendor library also: vendor/

An external kernel library in vendor/ (FlashMLA, DeepGEMM, DeepEP, DeepSelect). It is a git submodule. This site explains only how DeepInfer calls it.

Read more: Hardware platforms: NVIDIA and Ascend

visible devices also: CUDA_VISIBLE_DEVICES, ASCEND_RT_VISIBLE_DEVICES

The devices a process can use, set by CUDA_VISIBLE_DEVICES (NVIDIA) or ASCEND_RT_VISIBLE_DEVICES (Ascend). Device 0 is the first visible one.

Read more: Hardware discovery (deep_cluster)

Z#

ZOS also: zero-overhead scheduling, DEEPINFER_ZERO_OVERHEAD_SCHEDULING

Zero-overhead scheduling. The CPU prepares and post-processes one step while the device runs the next, so the CPU work does not stop the device.

On by default for the NORMAL engine (deepinfer/engine/arg_utils.py:51-55). The worker keeps a decode step and post-processes it during the next step (deepinfer/worker/worker.py:182-187).

Read more: Zero-overhead scheduling (ZOS)