Open-Source LLM Selection and Deployment on a Single High-End GPU

    This article explains how to choose and deploy open-source large language models on a single high-end consumer GPU with about 24GB of VRAM. It covers VRAM budgeting, the differences between dense and Mixture-of-Experts models, quantization trade-offs, task-oriented model selection, and practical deployment tuning such as context limits, KV cache optimization, concurrency, latency, and throughput.

    1. Background: VRAM Is the First Hard Constraint

    When running large language models locally or in self-hosted environments, the first bottleneck is usually VRAM, not compute. A typical high-end consumer GPU has about 24GB of VRAM. This capacity directly determines three things:

    • How large a model you can load.
    • How long a context you can support.
    • How many requests you can process concurrently.

    Many people assume that running large language models depends mainly on compute or CPU. In practice, if VRAM is insufficient, the model cannot be loaded at all, so inference is not possible. Therefore, before selecting a model, you need to account for VRAM usage first.

    2. Where VRAM Goes: A Three-Part Budget

    At runtime, VRAM usage is mainly composed of three parts:

    1. Model weights: the memory required by the parameters themselves; this is usually the largest part.
    2. KV cache: caches the Key/Value of historical tokens during inference and grows linearly with context length.
    3. Runtime overhead: memory used by the framework itself, activations, temporary buffers, and so on; it is common to reserve several GB.

    The following formula helps build intuition:

    1. VRAM usage ≈ weights + KV cache + runtime overhead
    2. weights ≈ number of parameters (B) × bytes per parameter × (1 + alignment/quantization overhead)
    3. KV cache ≈ 2 × layers × hidden dimension × sequence length × concurrency × bytes per element

    Bytes per parameter vary greatly by precision:

    Precision Bytes per parameter Approximate weight size for a 30B model
    FP16/BF16 2.0 ~60 GB
    8-bit ~1.0 ~30 GB
    4-bit ~0.55 ~16.5 GB

    A 24GB GPU struggles even with a 13B model under FP16, but with 4-bit quantization it can fit a model with about 30B total parameters, while still leaving room for the KV cache and overhead. Total usage may land around 18GB. This is the key to running large models on a single GPU.

    3. Look Beyond Total Parameters: Dense vs MoE

    A common mistake in model selection is treating total parameter count as the only metric. There are two main types of models:

    • Dense models: every inference activates all parameters. As the parameter count grows, both compute and VRAM requirements increase.
    • Mixture-of-Experts (MoE) models: although total parameters are large, each token is routed to only a small number of experts, so activated parameters are much smaller than total parameters.

    For example, a code-specialized model may have about 30B total parameters but only about 3B activated parameters. A multimodal model may have about 26B total parameters and about 4B activated parameters. This leads to an important conclusion for VRAM-constrained scenarios:

    MoE models need to store all expert weights because routing is unpredictable and any expert may be invoked. However, their compute cost depends only on activated parameters.

    This gives MoE a unique advantage on a single GPU: it can provide knowledge capacity close to a larger model while offering inference speed close to a smaller model. The trade-off is higher VRAM usage, and the framework’s support for loading and scheduling MoE models can noticeably affect real-world experience.

    4. Quantization: Trading Controlled Precision Loss for VRAM

    Quantization is a core method for compressing weights and reducing VRAM usage. Terms such as “4-bit” or “quantization level” describe how many bits are used to represent a parameter and how weights and scaling factors are mixed or stored. Recommendations:

    • If VRAM is extremely tight and you want to load a larger model: choose 4-bit quantization and use about half a byte per parameter for more capacity.
    • If precision matters and some VRAM remains available: choose 8-bit quantization for smaller precision loss.
    • For common tasks such as general conversation and code completion: 4-bit quantization is usually sufficient, and the precision degradation is acceptable in most scenarios.
    • For math reasoning, long chains of logic, or high-precision extraction: test in practice and increase the precision level if necessary.

    It is important to emphasize that quantization is not lossless. More aggressive quantization is more likely to degrade complex reasoning. “Can run” and “runs accurately” are different things, so validate with real business samples.

    5. Capability: Select by Task, Not by Leaderboard

    Even when models can be served on the same 24GB GPU, their strengths differ. Select models around your tasks:

    • Code generation / completion / refactoring: prefer code-specialized models. Their training data is more focused on source code, and they are generally more suitable for structured output and multi-language support.
    • Image-text understanding / document parsing / visual question answering: use multimodal models that can process both text and image inputs. Multimodal workloads also consume extra VRAM and compute, so leave headroom.
    • General conversation / summarization / classification: general instruction models are usually enough, often with smaller activated parameters and faster responses.

    A practical approach is to list your core tasks first, then filter candidates in three steps: can it do the task, does it do it well, and can it run within the available resources?

    6. Deployment and Tuning

    After selecting a model, deployment choices are equally important:

    • Inference framework: choose a local inference framework with mature support for the required quantization formats and MoE architectures. This directly affects loading efficiency and throughput.
    • Context length management: the KV cache grows linearly with context length, and long contexts are VRAM-intensive. Limit the maximum context when needed, or enable KV cache quantization.
    • Concurrency and latency trade-off: with limited single-GPU VRAM, high concurrency quickly exhausts the KV cache. For personal use, it may be better to reduce concurrency and allow longer contexts.
    • Time-to-first-token vs throughput: interactive scenarios care more about first-token latency, while batch scenarios care more about total throughput. Configure accordingly.

    An illustrative service configuration (fields are generic examples, not syntax for a specific tool):

    1. model:
    2. params_total: 30B # Total parameters (MoE)
    3. params_active: 3B # Activated parameters
    4. quantization: 4bit # 4-bit quantization
    5. runtime:
    6. max_context: 8192 # Limit context to control KV cache
    7. kv_cache_quant: true # Enable KV cache quantization to save more VRAM
    8. gpu_memory_util: 0.9 # Upper limit of GPU memory utilization; leave buffer to avoid OOM
    9. serving:
    10. strategy: latency # Interactive mode prioritizes lower time-to-first-token

    7. Selection Checklist

    To run the strongest possible open-source model on a single GPU with about 24GB of VRAM, follow this decision path:

    1. Calculate VRAM: estimate weights + KV cache + overhead and confirm that the target model can fit under 4-bit quantization.
    2. Check architecture: prefer MoE models to obtain stronger capability with smaller activated parameters, while keeping in mind their higher VRAM usage.
    3. Set precision: default to 4-bit; move to 8-bit for sensitive tasks, and validate with real samples.
    4. Match the task: use code-specialized models for code, multimodal models for image-text tasks, and general models for general conversation.
    5. Tune deployment: constrain context, set reasonable concurrency, and optimize for either interactive or batch scenarios.

    With this approach, ordinary developers can run open-source models with about 30B total parameters (4-bit quantization, MoE architecture) on a single high-end consumer GPU. This can cover mainstream needs such as code assistance and multimodal understanding without relying on expensive professional hardware.