Instructions to use Applied-Innovation-Center/Karnak-Th-41B-v1.0 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Applied-Innovation-Center/Karnak-Th-41B-v1.0 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Applied-Innovation-Center/Karnak-Th-41B-v1.0") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("Applied-Innovation-Center/Karnak-Th-41B-v1.0") model = AutoModelForMultimodalLM.from_pretrained("Applied-Innovation-Center/Karnak-Th-41B-v1.0", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.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=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Applied-Innovation-Center/Karnak-Th-41B-v1.0 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Applied-Innovation-Center/Karnak-Th-41B-v1.0" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Applied-Innovation-Center/Karnak-Th-41B-v1.0", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Applied-Innovation-Center/Karnak-Th-41B-v1.0
- SGLang
How to use Applied-Innovation-Center/Karnak-Th-41B-v1.0 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 "Applied-Innovation-Center/Karnak-Th-41B-v1.0" \ --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": "Applied-Innovation-Center/Karnak-Th-41B-v1.0", "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 "Applied-Innovation-Center/Karnak-Th-41B-v1.0" \ --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": "Applied-Innovation-Center/Karnak-Th-41B-v1.0", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Applied-Innovation-Center/Karnak-Th-41B-v1.0 with Docker Model Runner:
docker model run hf.co/Applied-Innovation-Center/Karnak-Th-41B-v1.0
Karnak-Th-41B v1.0
A Depth-Extended ArabicโEnglish Language Model with Hybrid Thinking
Karnak-Th-41B v1.0 is an approximately 41-billion-parameter language model developed by the Applied Innovation Center (AIC). Built on Qwen3.6-35B-A3B, it combines architectural depth extension with further training on highly curated and carefully cleaned Arabic, English, and reasoning data.
Karnak brings bilingual language generation and reasoning into a single model with two response modes: thinking for tasks that benefit from intermediate reasoning, and non-thinking for direct answers. This flexibility lets applications choose how much generation to devote to a task, from everyday conversations to problems requiring multiple steps.
Recommended generation setting: Use
presence_penalty=1.0for both thinking and non-thinking modes when supported by your inference backend.
Model Summary
| Property | Details |
|---|---|
| Model name | Karnak-Th-41B v1.0 |
| Developer | Applied Innovation Center (AIC) |
| Base model | Qwen/Qwen3.6-35B-A3B |
| Total parameters | Approximately 41B after depth extension |
| Architecture | Depth-extended Qwen-based Mixture-of-Experts (MoE) language model |
| Primary languages | Arabic and English |
| Response modes | Thinking and non-thinking |
| Tool integration | OpenAI-compatible function calling through vLLM |
| Recommended presence penalty | 1.0 for both response modes |
| Training data | Highly curated and cleaned Arabic, English, and reasoning data |
| Primary task | Instruction-following text generation |
| License | Apache 2.0 |
The parameter count refers to total model parameters, rather than parameters activated per token.
Key Features
- Depth extension from 35B to approximately 41B: Additional model layers expand the backbone's capacity, followed by training of the extended model.
- ArabicโEnglish training: Bilingual data supports language understanding, generation, and instruction following, with particular attention to Arabic.
- Reasoning-focused training: Reasoning examples complement language and instruction data to support tasks requiring analysis and multiple steps.
- Hybrid thinking: A single checkpoint supports both intermediate reasoning and direct-response generation.
- Tool integration: vLLM serving supports structured function calls for connecting the model to application-defined tools.
- Carefully curated data: Training emphasizes data quality through deliberate selection and cleaning of Arabic, English, and reasoning material.
- Local deployment: The checkpoint can be hosted on your own infrastructure and adapted to application-specific workflows under its license.
Architecture and Training
Karnak-Th-41B v1.0 starts from the Qwen3.6-35B-A3B backbone and extends its depth to produce an approximately 41B-parameter model. The extended model is then trained on curated bilingual and reasoning data.
The development process can be summarized as:
Qwen3.6-35B-A3B โ Depth Extension โ Training on Curated Arabic, English, and Reasoning Data โ Karnak-Th-41B v1.0
Training focuses on bilingual responses, instruction following, and reasoning behavior across thinking and non-thinking modes.
Thinking and Non-Thinking Modes
| Mode | Behavior | Example applications |
|---|---|---|
| Thinking | Generates intermediate reasoning before the final response. | Multi-step questions, analytical tasks, and problems requiring careful consideration. |
| Non-thinking | Generates a direct response without an explicit reasoning section. | Conversation, summarization, translation, rewriting, and straightforward questions. |
Select the mode through the checkpoint's chat template:
enable_thinking=True # Thinking mode
enable_thinking=False # Non-thinking mode
Use the tokenizer and chat template distributed with this checkpoint, and set enable_thinking to select the response mode. The reasoning parser separates reasoning from the final answer in API responses.
Thinking generally requires more output tokens and can increase latency. Allocate enough generation budget for both reasoning and the final answer.
Usage
The model is loaded from Applied-Innovation-Center/Karnak-Th-41B-v1.0 in the examples below.
1. Hugging Face Transformers
Install a recent Transformers release with support for the checkpoint's Qwen architecture:
pip install -U transformers torch accelerate
Load the checkpoint and generate a response:
import torch
from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer
model_id = "Applied-Innovation-Center/Karnak-Th-41B-v1.0"
enable_thinking = True # Set to False for direct responses.
tokenizer = AutoTokenizer.from_pretrained(model_id)
config = AutoConfig.from_pretrained(model_id)
# Select the loader matching the exported checkpoint configuration.
if getattr(config, "vision_config", None) is not None:
from transformers import Qwen3_5MoeForConditionalGeneration
model_class = Qwen3_5MoeForConditionalGeneration
else:
model_class = AutoModelForCausalLM
model = model_class.from_pretrained(
model_id,
dtype=torch.bfloat16,
device_map="auto",
).eval()
messages = [
{"role": "system", "content": "You are a helpful assistant. ุฃุฌุจ ุจูุบุฉ ุงูู
ุณุชุฎุฏู
."},
{"role": "user", "content": "ุงุดุฑุญ ุงููุฑู ุจูู ุงูุชุนูู
ุงูุฎุงุถุน ููุฅุดุฑุงู ูุงูุชุนูู
ุงูู
ุนุฒุฒุ ู
ุน ู
ุซุงู ููู ู
ููู
ุง."},
]
prompt = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
enable_thinking=enable_thinking,
)
inputs = tokenizer(
prompt,
return_tensors="pt",
add_special_tokens=False,
).to(model.device)
with torch.inference_mode():
outputs = model.generate(
**inputs,
max_new_tokens=4096 if enable_thinking else 1024,
do_sample=True,
temperature=0.6 if enable_thinking else 0.7,
top_p=0.95 if enable_thinking else 0.8,
top_k=20,
)
generated_ids = outputs[0, inputs["input_ids"].shape[1]:]
response = tokenizer.decode(generated_ids, skip_special_tokens=True)
print(response)
In thinking mode, decoded text may include reasoning delimiters such as <think> and </think>. Keep reasoning and final-answer presentation separate in applications that expose only the final response.
2. vLLM Server
Use a recent vLLM release supporting the exported architecture. Install it in a separate environment from other inference stacks:
pip install -U vllm openai
Start an OpenAI-compatible server with reasoning parsing and automatic tool calling:
vllm serve "Applied-Innovation-Center/Karnak-Th-41B-v1.0" \
--served-model-name karnak-th-41b-v1.0 \
--dtype bfloat16 \
--tensor-parallel-size 2 \
--reasoning-parser qwen3 \
--enable-auto-tool-choice \
--tool-call-parser qwen3_coder \
--port 8000
Adjust --tensor-parallel-size to your GPU topology and available memory.
--reasoning-parser qwen3 separates reasoning from final responses. --enable-auto-tool-choice lets the model select tools supplied in a request, and --tool-call-parser qwen3_coder converts generated function calls into the OpenAI-compatible tool_calls format.
Request Either Response Mode
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY")
def ask(prompt: str, thinking: bool = True):
response = client.chat.completions.create(
model="karnak-th-41b-v1.0",
messages=[{"role": "user", "content": prompt}],
temperature=0.6 if thinking else 0.7,
top_p=0.95 if thinking else 0.8,
presence_penalty=1.0,
max_tokens=4096 if thinking else 1024,
extra_body={
"top_k": 20,
"chat_template_kwargs": {"enable_thinking": thinking},
},
)
return response.choices[0].message.content
# Thinking mode
print(ask("ููู ูู
ูู ู
ูุงุฑูุฉ ุญููู ูู
ุดููุฉ ุนูุฏู
ุง ูุฎุชููุงู ูู ุงูุชูููุฉ ูุงูููุช ูุงูุฌูุฏุฉุ", thinking=True))
# Non-thinking mode
print(ask("ุงูุชุจ ุฑุณุงูุฉ ูุตูุฑุฉ ูุดูุฑ ุฒู
ูู ุนูู ู
ุณุงุนุฏุชู.", thinking=False))
The server's qwen3 parser can separate reasoning into an additional response field. The example prints the final-answer content field.
Tool Calling
Define tools using JSON schemas and pass them with tool_choice="auto". Your application executes the requested functions and returns their results to the model. The following example completes a tool call using a local multiplication function:
import json
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY")
tools = [{
"type": "function",
"function": {
"name": "multiply",
"description": "Multiply two integers and return their product.",
"parameters": {
"type": "object",
"properties": {
"a": {"type": "integer", "description": "The first integer."},
"b": {"type": "integer", "description": "The second integer."},
},
"required": ["a", "b"],
"additionalProperties": False,
},
},
}]
def multiply(a: int, b: int) -> int:
return a * b
functions = {"multiply": multiply}
messages = [{"role": "user", "content": "ุงุณุชุฎุฏู
ุงูุฃุฏุงุฉ ูุญุณุงุจ ุญุงุตู ุถุฑุจ 125 ูู 48."}]
def complete(tool_choice):
return client.chat.completions.create(
model="karnak-th-41b-v1.0",
messages=messages,
tools=tools,
tool_choice=tool_choice,
temperature=0.7,
top_p=0.8,
presence_penalty=1.0,
max_tokens=1024,
extra_body={
"top_k": 20,
"chat_template_kwargs": {"enable_thinking": False},
},
).choices[0].message
message = complete("auto")
if message.tool_calls:
messages.append(message.model_dump(exclude_none=True))
for call in message.tool_calls:
arguments = json.loads(call.function.arguments)
result = functions[call.function.name](**arguments)
messages.append({
"role": "tool",
"tool_call_id": call.id,
"content": json.dumps({"result": result}),
})
message = complete("none")
print(message.content)
Only expose functions your application intends to provide, and validate arguments before executing tools that access external services or modify data.
3. vLLM Offline Inference
Apply the model's chat template before submitting prompts for offline generation:
from transformers import AutoTokenizer
from vllm import LLM, SamplingParams
model_id = "Applied-Innovation-Center/Karnak-Th-41B-v1.0"
tokenizer = AutoTokenizer.from_pretrained(model_id)
llm = LLM(
model=model_id,
dtype="bfloat16",
tensor_parallel_size=2,
)
messages = [{"role": "user", "content": "Explain reinforcement learning in simple English."}]
prompt = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
enable_thinking=False,
)
params = SamplingParams(
temperature=0.7,
top_p=0.8,
top_k=20,
presence_penalty=1.0,
max_tokens=1024,
)
for output in llm.generate([prompt], params):
print(output.outputs[0].text)
Generation Guidance
We recommend setting presence_penalty=1.0 in both thinking and non-thinking modes when supported by the inference backend. All vLLM generation examples above use this setting.
Adjust temperature, sampling thresholds, and output budgets to your application's requirements.
- Explicitly select thinking or non-thinking mode through the chat template.
- Give thinking requests sufficient output budget; generation can stop before the final answer if reasoning consumes the token limit.
- Use the checkpoint's tokenizer and generation configuration, including its end-of-sequence tokens.
- Match serving settings to the checkpoint configuration, available memory, and application workload.
Intended Uses and Limitations
Karnak-Th-41B v1.0 is intended for ArabicโEnglish assistants, question answering, writing, summarization, translation, and reasoning-oriented applications. It can also serve as the generation component of retrieval-augmented systems when supplied with relevant documents.
The model can produce incorrect, incomplete, or biased responses. Thinking mode does not guarantee a correct answer, and generated reasoning should not be treated as evidence of correctness. Retrieved evidence and independent verification remain useful when factual accuracy matters.
License
Karnak-Th-41B v1.0 is released under the Apache License 2.0. See the repository's LICENSE file for the full terms.
Citation
@misc{karnak_th_41b_v1_2026,
title = {Karnak-Th-41B v1.0: A Depth-Extended Arabic-English Language Model with Hybrid Thinking},
author = {{Applied Innovation Center}},
year = {2026},
howpublished = {Hugging Face model release},
url = {https://huggingface.co/Applied-Innovation-Center/Karnak-Th-41B-v1.0}
}
- Downloads last month
- 12
Model tree for Applied-Innovation-Center/Karnak-Th-41B-v1.0
Base model
Qwen/Qwen3.6-35B-A3B