Skip to main content
Custom configurations can cause system malfunction. Perform thorough testing before deployment.

When to Use Custom Configurations

Consider advanced customization when:
  • You have fine-tuned models optimized for specific domains or tasks
  • You need different sampling parameters than the preset defaults
  • You want to run multiple specialized models simultaneously (e.g., one for vision, one for text, one for reasoning)
  • You require models from alternative model families not included in standard presets
Before proceeding, ensure you:
  • Understand GPU memory management principles
  • Have access to compatible HuggingFace model repositories
  • Know your hardware limitations
  • Have a testing environment for validation

Supported Model Families

Zylon supports these model families for custom configurations:
Only models from these families are officially supported. Using unsupported families may result in system instability.

Understanding Configuration Structure

All custom configurations follow this pattern:
Key principles:
  • Every configuration must include llm and embed models
  • Each model needs a unique id
  • GPU memory must be managed manually when adding/deleting models

Use Case 1: Customizing Existing Models

Goal: Modify the preset’s default models without adding new ones. This is useful for using fine-tuned versions of existing models or adjusting inference parameters.

When to Use This Approach

  • Swapping the default model for a fine-tuned version (e.g., Qwen3-14B-Medical instead of Qwen3-14B)
  • Changing sampling parameters (temperature, max tokens, etc.) for different behavior
  • Using a different embeddings model for improved semantic search
  • Adjusting context window size based on your use case

How It Works

Since you’re not adding models, you don’t need to worry about memory reallocation. Simply specify the model changes in the config section, and the preset handles memory allocation automatically.

Configuration Schema

Examples

Example 1: Using a Fine-Tuned Model

Replace the default model with your domain-specific fine-tuned version:

Example 2: Adjusting Sampling Parameters

Modify inference behavior without changing the model:

Example 3: Using Alternative Model Family

Switch to a different model family while keeping the same memory footprint:

Example 4: Custom Embeddings Model

Use specialized embeddings for domain-specific semantic search:

Use Case 2: Adding New Models

Goal: Run multiple specialized models simultaneously. This is more complex because you must manually manage GPU memory allocation across all models.

When to Use This Approach

  • Running a vision model alongside your primary text model
  • Using different models for different tasks (e.g., reasoning model + fast response model)
  • Creating specialized pipelines that require multiple model types
  • Building multi-modal systems that process text, images, audio, and other data types

Understanding GPU Memory Management

The critical concept: GPU memory is a fixed resource that must be manually divided among all models. Each model uses a fraction of total GPU memory, controlled by gpuMemoryUtilization (a value between 0.0 and 1.0). The sum of all models’ memory allocations cannot exceed 0.95 (reserving 5% for system overhead). Default allocation for baseline-24g:
To add a new model, you must:
  1. Reduce existing models’ allocations to free memory
  2. Assign the freed memory to the new model
  3. Adjust context windows if memory is significantly reduced

Understanding KV Cache

To understand why memory allocation affects context windows, you need to know about KV Cache. What is KV Cache? During inference, language models store intermediate computations (Keys and Values) for each token they process. This is called the KV Cache, and it’s what allows models to maintain context across a conversation or document without recomputing everything from scratch. The KV Cache grows with:
  • Context length: More tokens in context = more cache storage needed
  • Model size: Larger models require more cache per token
  • Batch size: Processing multiple requests simultaneously multiplies cache requirements
Memory allocation breakdown: When you allocate GPU memory to a model, that memory is divided between:
  1. Model weights: The model parameters (fixed size, ~2 bytes per parameter for FP16)
  2. KV Cache: Storage for context tokens (grows with context length)
  3. Activation memory: Temporary computation space during inference
Example for a 14B parameter model:
Why this matters: If you reduce total memory allocation from 0.85 to 0.50, the model weights still need the same space, but you have significantly less room for KV Cache. This means you must reduce the contextWindow parameter proportionally to avoid out-of-memory errors during inference. Default baseline KV Cache allocations:
Setting contextWindow too high for the allocated memory will cause out-of-memory errors during inference, especially during long conversations or when processing large documents. The errors typically appear as “CUDA out of memory” in the Triton logs.

Step-by-Step Process

Step 1: Know Your GPU Memory

First, identify your total available GPU memory:
Common configurations:
  • 24GB: RTX 4090, L4
  • 48GB: RTX A6000, L40, L40s
  • 80-96GB: A100, H100
Reserve 5% for system overhead, leaving 95% for models:
  • 24GB → 22.8GB usable
  • 48GB → 45.6GB usable
  • 96GB → 91.2GB usable

Step 2: Calculate Model Memory Requirements

Model memory depends on parameter count and quantization. Use this table to estimate: Quantization notes:
  • FP16: Full precision, best quality, highest memory
  • FP8: 50% memory reduction, minimal quality loss
  • FP4/AWQ: 70-75% memory reduction, slight quality degradation
  • Most HuggingFace models default to FP16 unless specified (e.g., -AWQ, -GPTQ suffix)
Example calculations for 24GB GPU (22.8GB usable):

Step 3: Convert GB to Memory Utilization Percentages

Once you know the GB requirements, convert to gpuMemoryUtilization: Formula: gpuMemoryUtilization = (Model GB / Total GPU GB) Example for 24GB GPU: Example for 48GB GPU:
Always round down slightly to leave headroom. If calculation gives 0.417, use 0.40 or 0.42.

Step 4: Adjust Context Windows Based on Memory

When you reduce a model’s memory allocation, you must also reduce its contextWindow because there’s less space available for KV Cache. Rule of thumb: Context window scales roughly linearly with memory footprint. Examples:

Step 5: Write Complete Configuration

Now combine all models with their calculated allocations:
Quantized models in HuggingFace: Look for suffixes like -AWQ or -GPTQ in the model name. If there’s no suffix, assume FP16.Examples:
  • Qwen/Qwen3-14B-Instruct → FP16 (28-32GB)
  • Qwen/Qwen3-14B-Instruct-AWQ → FP4 (8-10GB)
  • mistralai/Mistral-Small-24B-Instruct-2501 → FP16 (44-48GB)

Configuration Schema

Critical Rules:
  • Sum of all gpuMemoryUtilization must not exceed 1.00
  • Each id must be unique
  • llm and embed are mandatory and cannot be removed
  • Reducing memory allocation requires reducing contextWindow proportionally

Complete Example: Multi-Model Setup

This example demonstrates adding vision and reasoning models to handle different workload types: Scenario: You want three models:
  1. Primary LLM for general text tasks
  2. Vision LLM for image understanding
  3. Fast Audio Model for transcription tasks
Memory allocation strategy:
Complete configuration:

Best Practices for Multi-Model Setups

  1. Start minimal: Begin with smallest viable allocations, increase based on actual usage
  2. Monitor continuously: Use nvidia-smi to track real memory consumption
  3. Test individually: Validate each model works before combining. Best to isolate issues instead of debugging multiple models at once
  4. Plan for headroom: Don’t allocate the full memory. Leave some buffer for memory spikes
  5. Stress test: Simulate peak workloads to ensure stability under load

Configuration Parameter Reference

Complete reference for all available parameters.

Core Parameters (All Models)

LLM-Specific Parameters

Embedding-Specific Parameters

Sampling Parameters

Multimodal Parameters (LLMs)


Validation Checklist

Before deploying custom configurations:
  • All id values are unique
  • llm and embed models are present
  • Sum of gpuMemoryUtilization ≤ 0.95
  • promptStyle matches model family
  • contextWindow appropriate for memory allocation
  • tokenizer matches or is compatible with model
  • Configuration tested in staging environment
  • Monitoring in place for memory usage

Common Pitfalls

  1. Exceeding 1.0 memory allocation: Always verify your math
  2. Not reducing context windows: Large contexts need more memory, adjust accordingly
  3. Mismatched tokenizers: Use compatible tokenizers for each model
  4. Wrong prompt style: Each model family requires specific formatting
  5. No testing: Always validate in non-production first