Typhoon2.5-Qwen3-4B
: Thai Large Language Model (Instruct)
Typhoon2.5-Qwen3-4B
is a instruct Thai 🇹🇭 large language model with 4 billion parameters, a 256k context length, and function-calling capabilities. It is based on Qwen3 4B.
Performance
Model Description
Model type
: A 4B instruct decoder-only model based on Qwen3 architecture.
This code snippet shows how to use the Typhoon2.5-Qwen3-4B model for Thai or English text generation using the transformers library. It includes setting up the model and tokenizer, formatting chat messages in a system-user style, and generating a response.
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
model_id = "scb10x/typhoon2.5-qwen3-4b"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
)
messages = [
{"role": "system", "content": "You are a male AI assistant named Typhoon created by SCB 10X to be helpful, harmless, and honest. Typhoon is happy to help with analysis, question answering, math, coding, creative writing, teaching, role-play, general discussion, and all sorts of other tasks. Typhoon responds directly to all human messages without unnecessary affirmations or filler phrases like “Certainly!”, “Of course!”, “Absolutely!”, “Great!”, “Sure!”, etc. Specifically, Typhoon avoids starting responses with the word “Certainly” in any way. Typhoon follows this information in all languages, and always responds to the user in the language they use or request. Typhoon is now being connected with a human. Write in fluid, conversational prose, Show genuine interest in understanding requests, Express appropriate emotions and empathy. Also showing information in term that is easy to understand and visualized."},
{"role": "user", "content": "ขอสูตรไก่ย่าง"},
]
input_ids = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
return_tensors="pt",
).to(model.device)
outputs = model.generate(
input_ids,
max_new_tokens=512,
do_sample=True,
temperature=0.6,
top_p=0.95,
repetition_penalty=1.05
)
response = outputs[0][input_ids.shape[-1]:]
print(tokenizer.decode(response, skip_special_tokens=True))
Deploy as Server
This section shows how to run Typhoon2.5 as an OpenAI-compatible API server using vllm.
pip install vllm
vllm serve scb10x/typhoon2.5-qwen3-4b --max-model-len 8192 --tool-call-parser hermes --enable-auto-tool-choice --gpu-memory-utilization 0.95
# adjust --max-model-len based on your avaliable memory
Using Tools
You can provide tools to the vLLM-powered OpenAI-compatible API for functionality.
from openai import OpenAI
import json
client = OpenAI(base_url="http://localhost:8000/v1", api_key="dummy")
def get_weather(location: str, unit: str):
return f"Getting the weather for {location} in {unit}..."
tool_functions = {"get_weather": get_weather}
tools = [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {"type": "string", "description": "City and state, e.g., 'San Francisco, CA'"},
"unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}
},
"required": ["location", "unit"]
}
}
}]
response = client.chat.completions.create(
model=client.models.list().data[0].id,
messages=[{"role": "user", "content": "What's the weather like in San Francisco?"}],
tools=tools,
tool_choice="auto"
)
tool_call = response.choices[0].message.tool_calls[0].function
print(f"Function called: {tool_call.name}")
print(f"Arguments: {tool_call.arguments}")
print(f"Result: {get_weather(**json.loads(tool_call.arguments))}")
Sampling Parameters
For this model, we encourage you to use a low temperature and set "repetition_penalty" = 1.05 to improve performance and reduce repetition.
Intended Uses & Limitations
This model is an instructional model. However, it’s still undergoing development. It incorporates some level of guardrails, but it still may produce answers that are inaccurate, biased, or otherwise objectionable in response to user prompts. We recommend that developers assess these risks in the context of their use case.
If you find Typhoon2 useful for your work, please cite it using:
@misc{typhoon2,
title={Typhoon 2: A Family of Open Text and Multimodal Thai Large Language Models},
author={Kunat Pipatanakul and Potsawee Manakul and Natapong Nitarach and Warit Sirichotedumrong and Surapon Nonesung and Teetouch Jaknamon and Parinthapat Pengpun and Pittawat Taveekitworachai and Adisai Na-Thalang and Sittipong Sripaisarnmongkol and Krisanapong Jirayoot and Kasima Tharnpipitchai},
year={2024},
eprint={2412.13702},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2412.13702},
}
Runs of Float16-cloud typhoon2.5-qwen3-4b-fp8 on huggingface.co
16
Total runs
0
24-hour runs
16
3-day runs
16
7-day runs
16
30-day runs
More Information About typhoon2.5-qwen3-4b-fp8 huggingface.co Model
typhoon2.5-qwen3-4b-fp8 huggingface.co is an AI model on huggingface.co that provides typhoon2.5-qwen3-4b-fp8's model effect (), which can be used instantly with this Float16-cloud typhoon2.5-qwen3-4b-fp8 model. huggingface.co supports a free trial of the typhoon2.5-qwen3-4b-fp8 model, and also provides paid use of the typhoon2.5-qwen3-4b-fp8. Support call typhoon2.5-qwen3-4b-fp8 model through api, including Node.js, Python, http.
typhoon2.5-qwen3-4b-fp8 huggingface.co is an online trial and call api platform, which integrates typhoon2.5-qwen3-4b-fp8's modeling effects, including api services, and provides a free online trial of typhoon2.5-qwen3-4b-fp8, you can try typhoon2.5-qwen3-4b-fp8 online for free by clicking the link below.
Float16-cloud typhoon2.5-qwen3-4b-fp8 online free url in huggingface.co:
typhoon2.5-qwen3-4b-fp8 is an open source model from GitHub that offers a free installation service, and any user can find typhoon2.5-qwen3-4b-fp8 on GitHub to install. At the same time, huggingface.co provides the effect of typhoon2.5-qwen3-4b-fp8 install, users can directly use typhoon2.5-qwen3-4b-fp8 installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
typhoon2.5-qwen3-4b-fp8 install url in huggingface.co: