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
- 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:- Every configuration must include
llmandembedmodels - 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-Medicalinstead ofQwen3-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 theconfig 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 bygpuMemoryUtilization (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:
- Reduce existing models’ allocations to free memory
- Assign the freed memory to the new model
- 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
- Model weights: The model parameters (fixed size, ~2 bytes per parameter for FP16)
- KV Cache: Storage for context tokens (grows with context length)
- Activation memory: Temporary computation space during inference
contextWindow parameter proportionally to avoid out-of-memory errors during inference.
Default baseline KV Cache allocations:
Step-by-Step Process
Step 1: Know Your GPU Memory
First, identify your total available GPU memory:- 24GB: RTX 4090, L4
- 48GB: RTX A6000, L40, L40s
- 80-96GB: A100, H100
- 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,-GPTQsuffix)
Step 3: Convert GB to Memory Utilization Percentages
Once you know the GB requirements, convert togpuMemoryUtilization:
Formula: gpuMemoryUtilization = (Model GB / Total GPU GB)
Example for 24GB GPU:
Example for 48GB GPU:
Step 4: Adjust Context Windows Based on Memory
When you reduce a model’s memory allocation, you must also reduce itscontextWindow 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:Configuration Schema
Complete Example: Multi-Model Setup
This example demonstrates adding vision and reasoning models to handle different workload types: Scenario: You want three models:- Primary LLM for general text tasks
- Vision LLM for image understanding
- Fast Audio Model for transcription tasks
Best Practices for Multi-Model Setups
- Start minimal: Begin with smallest viable allocations, increase based on actual usage
- Monitor continuously: Use
nvidia-smito track real memory consumption - Test individually: Validate each model works before combining. Best to isolate issues instead of debugging multiple models at once
- Plan for headroom: Don’t allocate the full memory. Leave some buffer for memory spikes
- 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
idvalues are unique -
llmandembedmodels are present - Sum of
gpuMemoryUtilization≤ 0.95 -
promptStylematches model family -
contextWindowappropriate for memory allocation -
tokenizermatches or is compatible with model - Configuration tested in staging environment
- Monitoring in place for memory usage
Common Pitfalls
- Exceeding 1.0 memory allocation: Always verify your math
- Not reducing context windows: Large contexts need more memory, adjust accordingly
- Mismatched tokenizers: Use compatible tokenizers for each model
- Wrong prompt style: Each model family requires specific formatting
- No testing: Always validate in non-production first