Text Generation
Transformers
Safetensors
English
gemma3_text
sft
trl
unsloth
gemma
gemma3
conversational
text-generation-inference
Instructions to use kth8/gemma-3-270m-it-OpenCode-Title-Generator with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kth8/gemma-3-270m-it-OpenCode-Title-Generator with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="kth8/gemma-3-270m-it-OpenCode-Title-Generator") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("kth8/gemma-3-270m-it-OpenCode-Title-Generator") model = AutoModelForCausalLM.from_pretrained("kth8/gemma-3-270m-it-OpenCode-Title-Generator") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use kth8/gemma-3-270m-it-OpenCode-Title-Generator with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "kth8/gemma-3-270m-it-OpenCode-Title-Generator" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kth8/gemma-3-270m-it-OpenCode-Title-Generator", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/kth8/gemma-3-270m-it-OpenCode-Title-Generator
- SGLang
How to use kth8/gemma-3-270m-it-OpenCode-Title-Generator with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "kth8/gemma-3-270m-it-OpenCode-Title-Generator" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kth8/gemma-3-270m-it-OpenCode-Title-Generator", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "kth8/gemma-3-270m-it-OpenCode-Title-Generator" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kth8/gemma-3-270m-it-OpenCode-Title-Generator", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio
How to use kth8/gemma-3-270m-it-OpenCode-Title-Generator with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for kth8/gemma-3-270m-it-OpenCode-Title-Generator to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for kth8/gemma-3-270m-it-OpenCode-Title-Generator to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for kth8/gemma-3-270m-it-OpenCode-Title-Generator to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="kth8/gemma-3-270m-it-OpenCode-Title-Generator", max_seq_length=2048, ) - Docker Model Runner
How to use kth8/gemma-3-270m-it-OpenCode-Title-Generator with Docker Model Runner:
docker model run hf.co/kth8/gemma-3-270m-it-OpenCode-Title-Generator
File size: 5,707 Bytes
83772e2 e11a965 83772e2 bac4e83 83772e2 a29fd5f 83772e2 a29fd5f 83772e2 a29fd5f 83772e2 a29fd5f 83772e2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | ---
license: gemma
language:
- en
base_model: unsloth/gemma-3-270m-it
datasets:
- kth8/title-generation-25000x
pipeline_tag: text-generation
library_name: transformers
tags:
- sft
- trl
- unsloth
- gemma
- gemma3
- gemma3_text
---

A supervised fine-tune of [unsloth/gemma-3-270m-it](https://huggingface.co/unsloth/gemma-3-270m-it) on the [kth8/title-generation-25000x](https://huggingface.co/datasets/kth8/title-generation-25000x) dataset.
Trained with the exact system prompt OpenCode's [title agent uses](https://raw.githubusercontent.com/anomalyco/opencode/refs/heads/dev/packages/opencode/src/agent/prompt/title.txt).
## Usage example
Point to this model with `small_model` in `opencode.jsonc` file.
```json
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"title": {
"npm": "@ai-sdk/openai-compatible",
"options": {
"baseURL": "http://127.0.0.1:8080/v1",
"apiKey": "not-needed"
},
"models": {
"generator": {}
}
}
},
"small_model": "title/generator"
}
```
**System prompt**
```
You are a title generator. You output ONLY a thread title. Nothing else.
<task>
Generate a brief title that would help the user find this conversation later.
Follow all rules in <rules>
Use the <examples> so you know what a good title looks like.
Your output must be:
- A single line
- β€50 characters
- No explanations
</task>
<rules>
- you MUST use the same language as the user message you are summarizing
- Title must be grammatically correct and read naturally - no word salad
- Never include tool names in the title (e.g. "read tool", "bash tool", "edit tool")
- Focus on the main topic or question the user needs to retrieve
- Vary your phrasing - avoid repetitive patterns like always starting with "Analyzing"
- When a file is mentioned, focus on WHAT the user wants to do WITH the file, not just that they shared it
- Keep exact: technical terms, numbers, filenames, HTTP codes
- Remove: the, this, my, a, an
- Never assume tech stack
- Never use tools
- NEVER respond to questions, just generate a title for the conversation
- The title should NEVER include "summarizing" or "generating" when generating a title
- DO NOT SAY YOU CANNOT GENERATE A TITLE OR COMPLAIN ABOUT THE INPUT
- Always output something meaningful, even if the input is minimal.
- If the user message is short or conversational (e.g. "hello", "lol", "what's up", "hey"):
β create a title that reflects the user's tone or intent (such as Greeting, Quick check-in, Light chat, Intro message, etc.)
</rules>
<examples>
"debug 500 errors in production" β Debugging production 500 errors
"refactor user service" β Refactoring user service
"why is app.js failing" β app.js failure investigation
"implement rate limiting" β Rate limiting implementation
"how do I connect postgres to my API" β Postgres API connection
"best practices for React hooks" β React hooks best practices
"@src/auth.ts can you add refresh token support" β Auth refresh token support
"@utils/parser.ts this is broken" β Parser bug fix
"look at @config.json" β Config review
"@App.tsx add dark mode toggle" β Dark mode toggle in App
</examples>
```
**User prompt**
```
If there were 200 students who passed an English course three years ago, and each subsequent year until the current one that number increased by 50% of the previous year's number, how many students will pass the course this year?
```
**Assistant response**
```
Student course passing growth calculation
```
## Model Details
- Base Model: `unsloth/gemma-3-270m-it`
- Parameter Count: 268,098,176
- Precision: torch.bfloat16
## Training Settings
### PEFT
- Rank: 32
- LoRA alpha: 64
- Modules: q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj
- Gradient checkpointing: unsloth
### SFT
- Epoch: 1
- Batch size: 8
- Gradient Accumulation steps: 2
- Learning rate: 0.0002
- Optimizer: adamw_torch_fused
- Learning rate scheduler: cosine
- Warmup steps: 100
- Weight decay: 0.01
## Training stats
- Date: 2026-06-01T11:04:43.747952
- GPU: NVIDIA A100-SXM4-40GB
- Peak VRAM usage: 12.15 GB
- Global step: 1607
- Training runtime (seconds): 1590.5658
- Best validation loss: 1.408400058746338
| Step | Training Loss | Validation Loss |
|------|---------------|-----------------|
| 0 | No log | 5.064917 |
| 80 | 1.672600 | 1.848531 |
| 160 | 1.695400 | 1.742237 |
| 240 | 1.751600 | 1.726482 |
| 320 | 1.427200 | 1.663712 |
| 400 | 1.550400 | 1.609400 |
| 480 | 1.559000 | 1.573220 |
| 560 | 1.471900 | 1.572365 |
| 640 | 1.538100 | 1.539643 |
| 720 | 1.485500 | 1.515100 |
| 800 | 1.391200 | 1.486133 |
| 880 | 1.390600 | 1.473583 |
| 960 | 1.405300 | 1.461052 |
| 1040 | 1.392000 | 1.450962 |
| 1120 | 1.521300 | 1.440739 |
| 1200 | 1.438300 | 1.431336 |
| 1280 | 1.336900 | 1.418500 |
| 1360 | 1.375000 | 1.413560 |
| 1440 | 1.342100 | 1.408760 |
| 1520 | 1.309400 | 1.408400 |
| 1600 | 1.428100 | 1.409352 |
## Framework versions
- Unsloth: 2026.5.9
- TRL: 0.22.2
- Transformers: 4.56.2
- Pytorch: 2.11.0+cu128
- Datasets: 4.8.5
- Tokenizers: 0.22.2
## License
This model is released under the Gemma license. See the [Gemma Terms of Use](https://ai.google.dev/gemma/terms) and [Prohibited Use Policy](https://policies.google.com/terms/generative-ai/use-policy) regarding the use of Gemma-generated content. |