Skip to content
Back to skills

Unsloth Inference Cuba6112 Skillfactory 0929e451

ASecurity

Unsloth models can be deployed using native optimized inference or through

  • 666 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 2, 2026
ai-agentspythontestinggitapiperformance

Works with

  • cli
  • api

Security analysis

A100/100

Scanned September 2, 2026

npx -y skills add majiayu000/claude-skill-registry --skill unsloth-inference-cuba6112-skillfactory-0929e451 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Unsloth Inference Cuba6112 Skillfactory 0929e451?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Unsloth Inference Cuba6112 Skillfactory 0929e451
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majiayu000-unsloth-inference-cuba6112-skillfactory-0929e451-claude-skill-registry/badge)](https://www.skillsdirectory.com/skills/majiayu000-unsloth-inference-cuba6112-skillfactory-0929e451-claude-skill-registry)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: unsloth-inference
description: Unsloth models can be deployed using native optimized inference or through
  production serving engines like vLLM and SGLang. Native inference is accelerated
  2x via forinference(), while production serving requires merging LoRA weights into
  the base model.
---

---
name: unsloth-inference
description: Deploying fine-tuned models for production inference using native kernel optimization, vLLM, or SGLang. Triggers: inference, serving, vllm, sglang, for_inference, model merging, openai api.
---

## Overview
Unsloth models can be deployed using native optimized inference or through production serving engines like vLLM and SGLang. Native inference is accelerated 2x via `for_inference()`, while production serving requires merging LoRA weights into the base model.

## When to Use
- When performing local testing or simple application deployment.
- When building high-throughput production endpoints using vLLM or SGLang.
- When creating OpenAI-compatible APIs for drop-in replacement in existing apps.

## Decision Tree
1. Is throughput the priority?
   - Yes: Merge to 16-bit and use vLLM.
2. Is VRAM for serving extremely limited?
   - Yes: Merge to 4-bit or use GGUF via Ollama.
3. Running simple Python inference?
   - Yes: Call `FastLanguageModel.for_inference(model)`.

## Workflows

### Native Optimized Inference
1. Load fine-tuned model and tokenizer using `FastLanguageModel`.
2. Call `FastLanguageModel.for_inference(model)` to enable optimized kernels.
3. Use `model.generate()` with inputs formatted via the chat template.

### Merging LoRA for vLLM Serving
1. Select export method: 'merged_16bit' (quality) or 'merged_4bit' (VRAM).
2. Run `model.save_pretrained_merged("serving_model", tokenizer, save_method='merged_16bit')`.
3. Start vLLM server pointing to the 'serving_model' directory.

## Non-Obvious Insights
- Calling `FastLanguageModel.for_inference(model)` is mandatory for speed; it performs on-the-fly weight fusion and enables specialized Triton kernels for the forward pass.
- Most production serving engines (vLLM, SGLang) cannot use LoRA adapters directly without performance hits; merging them into the base model during export is the standard best practice.
- The `unsloth-cli` provides a pre-built OpenAI-compatible endpoint, making it easy to serve models locally and test with standard API clients.

## Evidence
- "Unsloth itself provides 2x faster inference natively as well, so always do not forget to call FastLanguageModel.for_inference(model)." [Source](https://docs.unsloth.ai/get-started/fine-tuning-llms-guide)
- "model.save_pretrained_merged(\"output\", tokenizer, save_method = \"merged_16bit\")" [Source](https://github.com/unslothai/unsloth)

## Scripts
- `scripts/unsloth-inference_tool.py`: Script for running local optimized inference.
- `scripts/unsloth-inference_tool.js`: Helper to test OpenAI-compatible endpoints.

## Dependencies
- unsloth
- torch
- vllm (optional for production)
- sglang (optional for production)

## References
- [[references/README.md]]

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.