Skip to content

vllm.config.engram

Classes:

  • EngramConfig –

    Configuration for Engram embedding storage and sharding.

Functions:

EngramConfig

Configuration for Engram embedding storage and sharding.

Methods:

Attributes:

  • cpu_offload (bool) –

    Store embedding weights in host memory. NVLink peer groups use local

  • disk_offload (bool) –

    Keep Qwen4Exp PLE tables in the checkpoint files and read each step's

  • dp_shared_memory (bool | None) –

    Share CPU-offloaded embedding weights between co-located

  • embedding_across_dp (bool) –

    Shard embeddings across TP and all DP ranks when enabled.

  • peer_group_fetch (Literal['sync', 'async']) –

    Where a peer group's fetch kernels run. sync: on the compute stream,

  • peer_group_rdma_inflight (int) –

    With rdma, the most prefill-sized gathers (64 WRs each) a GPU's NIC

  • peer_group_size (int) –

    Split each table's rows over this many GPUs of several engines (the sum

  • peer_group_store (str | None) –

    File through which a peer group's engines meet once at startup. Required

  • peer_group_thp_dir (str | None) –

    With rdma and cpu_offload: a directory on a tmpfs mounted with

  • peer_group_transport (Literal['nvlink', 'rdma']) –

    How a peer group reads rows: nvlink loads them from peer device or host memory

  • use_thp (bool) –

    Back private CPU-offloaded tables with transparent huge pages (best

cpu_offload = True class-attribute instance-attribute

Store embedding weights in host memory. NVLink peer groups use local Grace host memory when enabled and HBM when disabled.

disk_offload = False class-attribute instance-attribute

Keep Qwen4Exp PLE tables in the checkpoint files and read each step's rows on the host instead of allocating the table. Takes precedence over cpu_offload.

dp_shared_memory = None class-attribute instance-attribute

Share CPU-offloaded embedding weights between co-located DP replicas. Each node stores one copy of every TP shard, reducing host memory without per-step Engram DP collectives. Uses host-NUMA cuMem shared by FABRIC handle where supported (on ROCm, HIP VMM host memory with VLLM_ROCM_ENGRAM_HIP_VMM=1), else /dev/shm (which then needs capacity and a shared IPC namespace). Defaults to enabled when the model and other settings allow it; Flash uses private replicas. Falls back to per-replica tables when DP replicas are not co-located on one node or the host cannot hold them.

embedding_across_dp = False class-attribute instance-attribute

Shard embeddings across TP and all DP ranks when enabled. Otherwise, each DP rank has a separate TP-sharded embedding replica.

peer_group_fetch = 'sync' class-attribute instance-attribute

Where a peer group's fetch kernels run. sync: on the compute stream, started before the decoder layers, each Engram layer waiting for its own rows; over RDMA the rows move without SMs in between. async: on a side stream beside the layers, so their SM work (all of NVLink's gather) overlaps compute. Full CUDA graphs capture both; piecewise ones break at the start and at each Engram layer's wait.

peer_group_rdma_inflight = Field(default=8, ge=0) class-attribute instance-attribute

With rdma, the most prefill-sized gathers (64 WRs each) a GPU's NIC has in flight for its peers; 0 means no limit. Decode-sized fetches bypass it, so one engine's prefill delays another engine's decode by at most this backlog. The default (~2 MB) keeps prefill fetches at full rate.

peer_group_size = 0 class-attribute instance-attribute

Split each table's rows over this many GPUs of several engines (the sum of their GPU counts); lookups read rows from the owning GPU. Every engine passes the same value, peer_group_store and peer_group_transport. Requires a model with Engram pool support (DeepSeek V4.1 or Qwen4Exp), CUDA, TP=1 and PP=1.

peer_group_store = None class-attribute instance-attribute

File through which a peer group's engines meet once at startup. Required with peer_group_size: the same path for every engine, reachable by all of them and fresh per launch (e.g. under a per-job directory).

peer_group_thp_dir = None class-attribute instance-attribute

With rdma and cpu_offload: a directory on a tmpfs mounted with huge=always, where host shards are placed on transparent huge pages. NICs gather rows at random, so a large shard on base pages misses the NIC's address-translation cache on nearly every row, which can make large fetches several times slower.

peer_group_transport = 'nvlink' class-attribute instance-attribute

How a peer group reads rows: nvlink loads them from peer device or host memory through CUDA FABRIC handles and an IMEX channel. With rdma, the owners' NICs gather them from HBM, or from host memory with cpu_offload.

use_thp = False class-attribute instance-attribute

Back private CPU-offloaded tables with transparent huge pages (best effort, falls back to ordinary pinned pages). Prefaulting the tables at startup takes longer. Requires cpu_offload without dp_shared_memory. Always on for private tables on ROCm.

compile_factors()

Hash settings that affect embedding execution and graph structure.

get_parallel_size(parallel_config)

Derive the embedding group size from the parallel configuration.

resolve_dp_shared_memory(parallel_config, model_config=None)

Share host tables by default wherever the model supports them.

verify_model_config(model_config)

Reject Engram configuration for models without n-gram embeddings.

verify_parallel_config(parallel_config)

Reject unsupported embedding parallel topologies.

model_has_engram_layers(model_config)

Whether the model carries n-gram embedding layers.