趋近智
APX AI
在线
趋近智
Hardware infrastructure for Large Language Models operates under strict physical governors. While memory capacity dictates what models can load and memory bandwidth caps token generation speeds, compute throughput and interconnect speeds form the other half of the performance equation. Raw compute throughput (measured in TFLOPs) determines how fast the system processes incoming prompts, and interconnect bandwidth (measured in GB/s) defines how efficiently multiple GPUs collaborate to execute distributed topologies.
During the prefill phase, an LLM processes the user's entire prompt simultaneously. Because all input tokens are available at once, the underlying framework executes highly parallel dense matrix multiplications (GEMM). The GPU loads the model parameters into its ultra-fast SRAM registers and reuses those weights across the entire batch of tokens. This results in high arithmetic intensity, performing many operations for every byte of data loaded from memory. Consequently, prompt processing is generally compute-bound, gated directly by the Tensor Core performance of the hardware.
The theoretical compute required for a forward pass scales linearly with both the parameter count and the number of input tokens. For dense transformer architectures, the required floating-point operations (FLOPs) can be estimated with a standard heuristic:
Where is the total active parameter count of the model and is the number of tokens in the prompt.
To determine the absolute minimum Time-to-First-Token (TTFT), divide the required FLOPs by the practical TFLOPs capability of the hardware. Modern GPUs rarely achieve 100% of their advertised theoretical throughput. A well-optimized inference engine typically achieves a Model FLOPs Utilization (MFU) of 40% to 60%.
For example, processing a 4,096-token prompt through meta-llama/Meta-Llama-3.1-8B (an 8B parameter model) on a consumer RTX 4090 24GB. The theoretical compute requirement is:
The RTX 4090 offers approximately 330 FP16 TFLOPs. Assuming a realistic 50% MFU (165 effective TFLOPs):
If the same workload targets an enterprise A100 80GB accelerator (yielding roughly 156 effective FP16 TFLOPs at 50% MFU), the prefill latency remains nearly identical at ~0.41 seconds. Compute-bound prefill phases scale reliably with raw Tensor Core capability, making older, compute-heavy architectures perfectly viable for initial prompt ingestion, even if their memory bandwidth lags behind newer hardware.
For Mixture of Experts (MoE) architectures like mistralai/Mixtral-8x7B-Instruct-v0.1, in the compute formula must represent the active parameters per token, not the total resident model size. Mixtral has 47B total parameters, but only routes tokens to two experts, utilizing roughly 13B active parameters per forward pass. A 4,096-token prefill requires ~106 TFLOPs of compute, allowing it to process prompts significantly faster than a standard 47B dense model.
When a model's parameter weights and KV cache requirements exceed the VRAM of a single GPU, the workload must be sharded across multiple devices. meta-llama/Meta-Llama-3.1-70B-Instruct, loaded in 16-bit precision (FP16/BF16), requires roughly 140GB of VRAM just for weights. This strictly requires a multi-GPU setup, such as two 80GB A100s or a workstation with four 24GB RTX 4090s.
The standard strategy for inference is Tensor Parallelism (TP), which splits individual attention and feed-forward weight matrices across the GPUs. However, to complete a single transformer layer, the GPUs must exchange partial calculation results using collective communication operations (specifically, all-reduce operations).
Tensor Parallelism dictates that GPUs continuously synchronize intermediate tensors during every single layer of the transformer, making interconnect speed a strict bottleneck for generation latency.
If the physical interconnect linking the GPUs is too slow, the Tensor Cores sit idle waiting for data to arrive. The time spent synchronizing across the link adds directly to the Time-Per-Output-Token (TPOT).
The size of the data transferred during an all-reduce operation per transformer layer is a function of the model's hidden dimension size, the batch size, and the precision format.
For example, Qwen/Qwen2.5-32B, running with a hidden dimension of 5,120 in FP16 (2 bytes per element), serving a batch size of 64 tokens. The payload exchanged between GPUs per layer is relatively small: . However, Qwen2.5-32B has 64 transformer layers. The network must perform this synchronization 64 times for every single token generated.
Hardware interconnects vary massively in bandwidth, dictating what scale of distributed inference is possible:
Before deploying a multi-GPU workload, operators must verify the physical topology of the PCIe lanes and NVLink bridges. Running the standard NVIDIA System Management Interface topology command exposes the exact communication paths between devices.
nvidia-smi topo -m
A response showing NV4 or NV12 indicates GPUs are connected via high-bandwidth NVLink. A response of PHB (PCIe Host Bridge) or SYS means the GPUs must communicate through the host CPU's PCIe lanes and system memory, which cuts effective bandwidth to a fraction of NVLink speeds and heavily degrades multi-GPU inference generation rates.
When initiating an inference server on a multi-GPU setup, the engine must be configured to utilize the correct distributed topology. Initializing a 32-billion parameter model across two GPUs with vLLM sets up Tensor Parallelism across devices:
from vllm import LLM, SamplingParams
# Initializes Qwen2.5-32B across two GPUs via Tensor Parallelism.
# If connected via PCIe (no NVLink), TPOT will increase noticeably
# compared to a theoretical single 48GB+ GPU.
llm = LLM(
model="Qwen/Qwen2.5-32B",
tensor_parallel_size=2,
dtype="half",
enforce_eager=True # Disables CUDA graphs to simplify memory tracking during testing
)
prompts = ["Explain the architecture of a transformer model."]
sampling_params = SamplingParams(temperature=0.7, max_tokens=256)
outputs = llm.generate(prompts, sampling_params)
for output in outputs:
print(output.outputs[0].text)
If you are forced to run high-parameter models on consumer setups without NVLink bridges (such as dual RTX 4090s), you will observe that decoding speed (TPOT) scales poorly compared to the prefill speed. Compute throughput parallelizes efficiently even over slower interconnects because the massive arithmetic intensity of prefill hides the communication delay. Decode operations, transferring small vectors 50 to 100 times per generated token, leave the interconnect entirely exposed as the primary hardware bottleneck.
魏明 (Wei-Ming Thor)
• 创始人与工程师, ApX Machine Learning
专注于大语言模型架构分析与硬件容量规划,维护 ApX VRAM 计算器。
© 2026 ApX Machine Learning内容诚信与透明度•