Instructions to use KordAI/KeawGPT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use KordAI/KeawGPT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="KordAI/KeawGPT") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("KordAI/KeawGPT") model = AutoModelForCausalLM.from_pretrained("KordAI/KeawGPT", device_map="auto") 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 KordAI/KeawGPT with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "KordAI/KeawGPT" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "KordAI/KeawGPT", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/KordAI/KeawGPT
- SGLang
How to use KordAI/KeawGPT 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 "KordAI/KeawGPT" \ --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": "KordAI/KeawGPT", "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 "KordAI/KeawGPT" \ --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": "KordAI/KeawGPT", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use KordAI/KeawGPT with Docker Model Runner:
docker model run hf.co/KordAI/KeawGPT
KeawGPT
KeawGPT is a 4B-parameter language model by KordAI, fine-tuned from KordAI/KeawGPT-Base (Qwen3 architecture) to specialize in Science, Technology, Engineering, Mathematics (STEM), and Philosophy. It is designed to give clear, reasoned answers across technical and conceptual domains, and supports structured tool calling for tasks like web search and code execution.
Model Details
- Developed by: KordAI
- Model type: Causal decoder-only language model (Qwen3 architecture)
- Parameters: ~4B
- Specialization: STEM (math, physics, engineering, computer science) and Philosophy (logic, ethics, epistemology, argumentation)
- Base model: KordAI/KeawGPT-Base
- License: apache-2.0
- Languages: English
Intended Use
KeawGPT is intended for:
- Explaining and reasoning through STEM concepts (math derivations, algorithms, physical systems, etc.)
- Philosophical discussion, argument analysis, and conceptual reasoning
- Acting as a tool-using assistant (web search, code execution) inside an agent loop
It is not intended as a substitute for professional advice (medical, legal, financial) or as an authoritative source without verification โ like any language model, it can produce confident-sounding but incorrect output, especially on niche technical claims or citations.
Prompt Format
KeawGPT uses a custom plain-text turn format rather than a standard chat markup:
# SYSTEM:
{system message}
# USER:
{user message}
# ASSISTANT:
{assistant message}
# TOOL:
{tool result}
Each assistant turn ends with the model's EOS token. Use tokenizer.apply_chat_template() to render this โ a custom chat_template.jinja ships with the tokenizer config and handles turn formatting, the default system message, and tool-schema injection automatically. Building the prompt by hand is unnecessary and error-prone (whitespace/newline placement, tool-schema formatting, etc. are already handled by the template).
Tool Calling
KeawGPT can emit structured tool calls instead of a direct answer. When it decides to call a tool, it replies only in this format, with no other content before or after:
<tools_call>
<function=tool_name>
<parameter=param_name>
value
</parameter>
</function>
</tools_call>
The calling application is expected to parse this block, execute the corresponding tool, and feed the result back as a # TOOL: turn before continuing generation. The model may optionally reason in natural language before a tool call, but should not add anything after the closing </tools_call> tag.
Usage
Inference with ๐ค Transformers, loaded in 4-bit via bitsandbytes:
import re
import json
import torch
from transformers import (
AutoModelForCausalLM,
AutoTokenizer,
BitsAndBytesConfig,
TextStreamer,
StoppingCriteria,
StoppingCriteriaList,
)
MODEL_NAME = "KordAI/KeawGPT"
# --------------------------------------------------------------------------
# 1. Load model in 4-bit
# --------------------------------------------------------------------------
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.bfloat16,
bnb_4bit_use_double_quant=True,
)
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
model = AutoModelForCausalLM.from_pretrained(
MODEL_NAME,
quantization_config=bnb_config,
device_map="auto",
)
model.eval()
SYSTEM_PROMPT = None # unused โ chat_template.jinja builds the default system
# message + tools instruction automatically from `tools`
# --------------------------------------------------------------------------
# 2. Prompting via tokenizer.apply_chat_template
# --------------------------------------------------------------------------
# KeawGPT ships with a custom chat_template.jinja (bundled in this repo's
# tokenizer_config.json) that renders conversations in the model's native
# # SYSTEM: / # USER: / # ASSISTANT: / # TOOL: turn format and injects the
# tool schema into the default system message. Just pass `tools=tools` and
# let apply_chat_template build the prompt โ no manual string building needed.
def build_prompt(history):
return tokenizer.apply_chat_template(
history,
tools=tools,
tokenize=False,
add_generation_prompt=True,
)
STOP_STRINGS = ["</tool_call>", "</tools_call>", "\n# USER:", "\n# TOOL:"]
class StopOnSubstrings(StoppingCriteria):
def __init__(self, tokenizer, stop_strings, prompt_len, check_every=4):
self.tokenizer = tokenizer
self.stop_strings = stop_strings
self.prompt_len = prompt_len
self.check_every = check_every
self._count = 0
def __call__(self, input_ids, scores, **kwargs):
self._count += 1
if self._count % self.check_every != 0:
return False
generated = self.tokenizer.decode(input_ids[0][self.prompt_len:], skip_special_tokens=True)
return any(s in generated for s in self.stop_strings)
def generate(prompt, max_new_tokens=1024):
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
prompt_len = inputs["input_ids"].shape[1]
streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
stopping_criteria = StoppingCriteriaList([StopOnSubstrings(tokenizer, STOP_STRINGS, prompt_len)])
with torch.no_grad():
output_ids = model.generate(
**inputs,
max_new_tokens=max_new_tokens,
do_sample=True,
temperature=0.7,
top_p=0.9,
pad_token_id=tokenizer.eos_token_id,
streamer=streamer,
stopping_criteria=stopping_criteria,
)
return tokenizer.decode(output_ids[0][prompt_len:], skip_special_tokens=True)
# --------------------------------------------------------------------------
# 3. Example single-turn call
# --------------------------------------------------------------------------
history = [{"role": "user", "content": "What's the difference between a P and an NP problem?"}]
prompt = build_prompt(history)
output = generate(prompt)
print(output)
Wrap this in a loop that appends {"role": "assistant", ...} and, when parse_tool_call() returns non-None, dispatches the call, appends the result as a {"role": "tool", ...} turn, and re-generates โ this is how tool-calling conversations are extended turn by turn.
Limitations
- As a 4B model, KeawGPT has less raw capacity than larger frontier models and may make more factual or reasoning errors, particularly on multi-step math/proofs or obscure philosophical literature.
- It can hallucinate citations, sources, or quotes โ verify anything attributed to a specific paper, philosopher, or study before relying on it.
- Tool calling depends entirely on the calling application correctly parsing
<tools_call>blocks and returning results as# TOOL:turns; without that harness, the model may describe a tool call in text without it actually being executed. - Not evaluated for safety-critical, medical, legal, or financial use cases.
- Downloads last month
- 1,003