> ## Documentation Index
> Fetch the complete documentation index at: https://docs.shaktistudio.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Optimise a Model

> End-to-end process for adding, configuring, and compiling a model on the platform.

This guide walks you through the **end-to-end process of adding, configuring, and compiling a model** on the platform.

## Enter Model Details

Navigate to **Add Model** to register a new model.

<img src="https://mintcdn.com/simplismart-2/QbPeO9AWw50A_ecx/images/model-suite/optimise-a-model/1-enter-model-details.png?fit=max&auto=format&n=QbPeO9AWw50A_ecx&q=85&s=77e0316853418348063174e0d8af1797" alt="Add Model form with name, description, model source, path, and model class fields" width="2852" height="1098" data-path="images/model-suite/optimise-a-model/1-enter-model-details.png" />

<Tip>
  Models are scoped to the active workspace. Use the workspace toggle in the breadcrumb navigation to switch workspaces before importing or compiling a model. See [Workspaces](/model-suite/settings/workspaces) for details.
</Tip>

### Name (Required)

A unique identifier for the model within the platform.

### Description (Optional)

Short note about the model's purpose.

### Model Source (Required)

Specifies where the model artifacts are loaded from.

* **Hugging Face (HF)** – Load directly from the Hugging Face Hub
* **Shakti Studio S3** – Load from an S3 bucket
* **GCP GCS** – Load from a Google Cloud Storage bucket
* **Public URL** – Load from a publicly accessible URL

If using Hugging Face, you can enable **Private Model** for gated or private repositories.

<Note>
  If you use a **private model from Hugging Face**, add your **Hugging Face access token as a secret** on the platform first, then select the appropriate linked secret when configuring the model.
</Note>

### Model Path (Required)

The exact path to the model.

* **Hugging Face:** `meta-llama/Llama-3.1-8B-Instruct`
* **AWS S3:** `s3://my-bucket/model/`
* **GCP GCS:** `gs://my-bucket/model/`
* **Public URL:** `https://<host>/model`

The platform verifies the path automatically.

### Model Class (Required)

Defines the pipeline or architecture class used to load the model.

* `LlamaForCausalLM` → LLMs
* `WhisperForConditionalGeneration` → Speech models
* `FluxPipeline` → Diffusion models
* `CustomPipeline` → Custom or non-standard pipelines

<Tip>
  This is usually auto-selected based on the model source and path.
</Tip>

## Optimising Infrastructure

This section determines **on which GPU the model will be deployed**.

<img src="https://mintcdn.com/simplismart-2/QbPeO9AWw50A_ecx/images/model-suite/optimise-a-model/2-optimising-infrastructure.png?fit=max&auto=format&n=QbPeO9AWw50A_ecx&q=85&s=7ab40cafeb9bf5dd2d051188540ff646" alt="Optimising infrastructure section with Shakti Studio Cloud" width="2804" height="362" data-path="images/model-suite/optimise-a-model/2-optimising-infrastructure.png" />

Shakti Studio provides a fully managed environment where infrastructure is provisioned automatically.

**Accelerator options:**

* **L40S** – Recommended for most production speech workloads
* **H100** – Best for high-throughput or low-latency deployments

<Tip>
  Pick an accelerator that matches your model size and latency requirements.
</Tip>

***

## Model-Specific Configuration

After **Model Details** and **Optimising Infrastructure**, the remaining configuration depends on the **type of model** you are adding. Different model types require additional or different settings:

* **LLMs** (Chat, Completion, Embedding)
* **Diffusion Models**
* **Speech (Whisper) Models**

***

### LLMs (Chat, Completion, Embedding)

<Info>
  By default, the platform automatically selects the most suitable compilation settings for LLMs based on the model architecture.
</Info>

#### Backend Selection

Controls the inference backend used to serve the model. LLMs support multiple optimized backends.

* **Auto** – Platform selects the optimal backend automatically
* **Latest** – Recommended unless a specific version is required

For details, see the [LLM Optimization Guide](/guides/optimization-guide).

<img src="https://mintcdn.com/simplismart-2/QbPeO9AWw50A_ecx/images/model-suite/optimise-a-model/3-backend-selection.png?fit=max&auto=format&n=QbPeO9AWw50A_ecx&q=85&s=bd02463b75bb75a8e96ee6c3a68ed5c8" alt="Backend selection options: Auto and Latest" width="2796" height="736" data-path="images/model-suite/optimise-a-model/3-backend-selection.png" />

#### Quantization

**Precision Mode (Required)** controls how model weights are stored and computed. Choose the mode that balances accuracy, memory use, and throughput for your workload.

Available precision modes:

* **FLOAT16** – Half precision
* **FP8** – 8-bit floating point
* **INT8** – 8-bit integer
* **INT4** – 4-bit integer
* **BFLOAT16** – Brain floating point 16-bit
* **FLOAT32** – Full precision
* **AWQ** – Activation-aware Weight Quantization
* **MXFP4** – Mixed-precision 4-bit floating point

<Tip>
  Lower precision (e.g. INT4, FP8) reduces memory and can increase throughput; higher precision (e.g. FLOAT32, BFLOAT16) preserves accuracy. Choose based on your latency and quality requirements.
</Tip>

<img src="https://mintcdn.com/simplismart-2/QbPeO9AWw50A_ecx/images/model-suite/optimise-a-model/7-llm-parallelism-pipeline.png?fit=max&auto=format&n=QbPeO9AWw50A_ecx&q=85&s=74b7322dfd15bc0d1c9ebc62d111d807" alt="LLM configuration form showing quantization (Precision Mode), parallelism, and pipeline task options" width="2798" height="1078" data-path="images/model-suite/optimise-a-model/7-llm-parallelism-pipeline.png" />

#### Parallelism

LLMs support:

* **Data Parallelism** – Replicates the full model across multiple GPUs; each GPU handles separate requests. Best for throughput and concurrent traffic.
* **Pipeline Parallelism** – Splits model layers across GPUs. Use when the model is too large to fit on a single GPU.
* **Expert Parallelism** – For Mixture-of-Experts (MoE) models; distributes experts across GPUs. Improves scalability and efficiency for MoE architectures.

#### Pipeline Task

Defines the task the model is used for.

* **Chat** – Conversational models
* **Completion** – Text generation
* **Embedding** – Vector generation models

This determines request/response formatting and runtime behaviour.

#### Speculative Decoding (Optional)

Improves latency by generating tokens using a draft strategy.

<Tip>
  **Recommended:** On for chat and completion workloads.
</Tip>

<img src="https://mintcdn.com/simplismart-2/QbPeO9AWw50A_ecx/images/model-suite/optimise-a-model/8-speculative-decoding.png?fit=max&auto=format&n=QbPeO9AWw50A_ecx&q=85&s=bacb8833ae75d7c191b66680673bd9ed" alt="Speculative decoding toggle and extra params" width="2818" height="838" data-path="images/model-suite/optimise-a-model/8-speculative-decoding.png" />

#### Extra Params

Advanced backend-specific configuration in JSON format. Leave empty unless you have custom tuning needs.

#### LoRA Configuration (Optional)

LoRA (Low-Rank Adaptation) allows loading fine-tuned adapters on top of base models.

* **Enable LoRA** – Toggle to enable or disable LoRA.
* **LoRA Config Method:**
  * **Via LoRA List** – Use pre-registered LoRA adapters
  * **Via LoRA Repo** – Load directly from a repository

Use **Add LoRA Path** to attach multiple adapters if needed.

<img src="https://mintcdn.com/simplismart-2/QbPeO9AWw50A_ecx/images/model-suite/optimise-a-model/9-lora-config.png?fit=max&auto=format&n=QbPeO9AWw50A_ecx&q=85&s=6630c6603fd6c60d3efc8a7de8e12e68" alt="LoRA configuration with enable toggle and config method" width="2788" height="732" data-path="images/model-suite/optimise-a-model/9-lora-config.png" />

When adding a LoRA path:

* **Source (Required)** – Where the LoRA weights are stored (e.g. AWS (IAM Credentials))
* **Secret (Required)** – Credentials used to access the LoRA source
* **Path (Required)** – Path to the LoRA adapter location

<img src="https://mintcdn.com/simplismart-2/QbPeO9AWw50A_ecx/images/model-suite/optimise-a-model/10-lora-repo.png?fit=max&auto=format&n=QbPeO9AWw50A_ecx&q=85&s=6a0da2e70a217660a06289bc616541bd" alt="LoRA path configuration with source, secret, and path" width="2824" height="1122" data-path="images/model-suite/optimise-a-model/10-lora-repo.png" />

***

### Diffusion Models

#### Parallelism

Diffusion models support:

* **Context Parallelism** – Splits the input context or latent representation across multiple GPUs. Useful for high-resolution image generation and memory-intensive models.
* **Fully Shared Data Parallelism** – Replicates the model across GPUs; each GPU handles separate requests. Useful for high-throughput production and concurrent image generation.

#### DiT Optimization

*(Applies only to diffusion models.)*

**Attention Backend** – Selects the attention implementation during inference.

* **Flash** – Optimized attention for better performance
* **Torch** – Standard PyTorch attention
* **Auto** – Automatically selects the best option

<Tip>
  **Recommended:** Auto
</Tip>

#### Additional Optimisation Settings

* **Enable Attention Caching** – Caches attention states to reduce repeated computation and improve speed.
* **Cache Threshold** – Controls when caching is applied. Default: `0.25`. Higher values improve inference speed but may reduce output quality.
* **Enable Compilation** – Compiles the model graph for faster inference.
  * **Fullgraph** – Compiles the entire model for maximum performance
  * **Dynamic** – Supports variable input shapes

<Tip>
  **Recommended:** Enable Fullgraph for stable production workloads.
</Tip>

<img src="https://mintcdn.com/simplismart-2/QbPeO9AWw50A_ecx/images/model-suite/optimise-a-model/5-diffusion-optimisation.png?fit=max&auto=format&n=QbPeO9AWw50A_ecx&q=85&s=232bc76179a32e8ff1fd91a362414fa4" alt="Diffusion model optimisation settings including attention caching and compilation" width="2862" height="1524" data-path="images/model-suite/optimise-a-model/5-diffusion-optimisation.png" />

***

### ASR (Speech) Models

<img src="https://mintcdn.com/simplismart-2/QbPeO9AWw50A_ecx/images/model-suite/optimise-a-model/11-asr-models.png?fit=max&auto=format&n=QbPeO9AWw50A_ecx&q=85&s=cf6dfbdc196b758e03b9f743cc07690b" alt="ASR model configuration with optional pipeline add-ons" width="2856" height="1532" data-path="images/model-suite/optimise-a-model/11-asr-models.png" />

#### Optional Pipeline Add-ons

##### **Voice Activity Detection (VAD) Model**

Detects speech segments and removes silence before transcription.

**VAD options:**

* **Auto** – Platform selects the best VAD
* **Silero** – Lightweight and fast VAD model
* **Frame** – Frame-based detection

<Tip>
  **Recommended:** Auto or Silero
</Tip>

##### **Diarization Model (Optional)**

Separates and labels different speakers in the audio.

<Info>
  Enable this if you need speaker-wise transcripts.
</Info>
