Instructions to use kistepAI/SPARK2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use kistepAI/SPARK2 with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf kistepAI/SPARK2:BF16_PART # Run inference directly in the terminal: llama cli -hf kistepAI/SPARK2:BF16_PART
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf kistepAI/SPARK2:BF16_PART # Run inference directly in the terminal: llama cli -hf kistepAI/SPARK2:BF16_PART
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf kistepAI/SPARK2:BF16_PART # Run inference directly in the terminal: ./llama-cli -hf kistepAI/SPARK2:BF16_PART
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf kistepAI/SPARK2:BF16_PART # Run inference directly in the terminal: ./build/bin/llama-cli -hf kistepAI/SPARK2:BF16_PART
Use Docker
docker model run hf.co/kistepAI/SPARK2:BF16_PART
- LM Studio
- Jan
- vLLM
How to use kistepAI/SPARK2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "kistepAI/SPARK2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kistepAI/SPARK2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/kistepAI/SPARK2:BF16_PART
- Ollama
How to use kistepAI/SPARK2 with Ollama:
ollama run hf.co/kistepAI/SPARK2:BF16_PART
- Unsloth Desktop
- Docker Model Runner
How to use kistepAI/SPARK2 with Docker Model Runner:
docker model run hf.co/kistepAI/SPARK2:BF16_PART
- Lemonade
How to use kistepAI/SPARK2 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull kistepAI/SPARK2:BF16_PART
Run and chat with the model
lemonade run user.SPARK2-BF16_PART
List all available models
lemonade list
- Atomic Chat
Usage Guide
๊ฐ์ธ์ ์์ ๋กญ๊ฒ ์ฌ์ฉํ ์ ์์ต๋๋ค.
๊ธฐ์
๋ฐ ๊ธฐ๊ด์ ๋น์์
์ ๋ชฉ์ ์ผ๋ก ์ด์ฉํด ์ฃผ์๊ธฐ ๋ฐ๋๋๋ค.
๋ํ, ์ถํ ํ์
๋ฐ ๋คํธ์ํฌ ๊ตฌ์ถ์ ์ํด ๊ธฐ๊ด ์ ๋ณด์ AI ๋ชจ๋ธ ์ฌ์ฉ ๋ด๋น์ ์ ๋ณด๋ฅผ ๋ฉ์ผ๋ก ๋ณด๋ด์ฃผ์๋ฉด ์ฐ๋ฝ๋๋ฆฌ๊ฒ ์ต๋๋ค.
CONTACT : kistep_ax@kistep.re.kr
Individuals are free to use this without restrictions.
For companies and institutions, please use it for non-commercial purposes.
Additionally, to facilitate future collaboration and network building, please send us an email with your institution's information and the contact details of the person responsible for using the AI model. We will get in touch with you.
1. Description
SPARK2 is a large language model developed by the Korea Institute of S&T Evaluation and Planning (KISTEP). As the successor to SPARK-RAG and SPARK-Report, SPARK2 unifies KISTEP's task-specific models into a single model. It is optimized for RAG (Retrieval-Augmented Generation) tasks and incorporates Chain of Thought (CoT) reasoning to enhance its response accuracy and performance.
2. Key Features
- Enhanced Reliability through RAG: Provides highly reliable responses by leveraging the organization's internal databases through Retrieval-Augmented Generation (RAG).
- Transparent Reasoning: Trained to demonstrate its reasoning process through Chain of Thought (CoT) inside
<think>tags, clearly showing the information sources and logic behind each response with<source>citations. - Structured Output: Responses in well-formatted markdown, including tables, text, and summaries for improved readability and clarity.
- Base Model: Built on Gemma-3-27b as the foundation model. Supervised Fine-Tuning (SFT) was performed on
google/gemma-3-27b-pt, and the fine-tuned model was merged withgoogle/gemma-3-27b-itusing TIES (mergekit). - Training Method: Trained with Supervised Fine-Tuning (SFT), using LoRA (rsLoRA, r=64) with FSDP2 and Context Parallelism.
- Context Length: The maximum context length for training data is 12,288.
3. Data
| source | KISTEP Documents (synthetic QA) |
KISTEP Documents (evolved QA) |
|---|---|---|
| count | 7,534 | 2,547 |
- The training data generated from KISTEP documents consists of
(Q, CONTEXT, A)format, with Chain of Thought (CoT) reasoning included in the answers. - Evolved QA augments the base synthetic QA with multi-hop, keyword, unanswerable, and multi-turn variations.
- Train / validation split: 9,080 / 1,001.
4. Usage
- Please combine files into a single file using the command below before use. (When using ollama, you can utilize the GGUF file.)
cat SPARK2-bf16_part1.gguf SPARK2-bf16_part2.gguf > SPARK2-bf16.gguf
- Python code
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
model_id = "kistepAI/SPARK2"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
)
model.eval()
messages = [
{"role": "user", "content": "์๋
ํ์ธ์."}
]
input_ids = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
return_tensors="pt"
).to(model.device)
terminators = [
tokenizer.eos_token_id,
tokenizer.convert_tokens_to_ids("<end_of_turn>")
]
outputs = model.generate(
input_ids,
max_new_tokens=2048,
eos_token_id=terminators,
do_sample=True,
temperature=0.3,
top_p=0.95,
)
response = outputs[0][input_ids.shape[-1]:]
print(tokenizer.decode(response, skip_special_tokens=True))
5. Prompt Template (RAG)
SPARK2 is trained with the following RAG prompt format. Place the user question in <question>, retrieved chunks in <context>, and previous conversation in <history>.
๋น์ ์ RAG ์ ๋ฌธ๊ฐ์
๋๋ค. <question>์๋ ์ฌ์ฉ์ ์ง๋ฌธ, <context>์๋ ์ฌ์ฉ์ ์ง๋ฌธ์ผ๋ก ๊ฒ์ํ ๊ฒฐ๊ณผ, <history>์๋ ๊ณผ๊ฑฐ ๋ํ ๋ด์ญ์ด ์์ต๋๋ค. <context>๋ฅผ ๋ฐํ์ผ๋ก ์ง๋ฌธ์ ๋ต๋ณํ์ธ์.
<question>
{question}
</question>
<context>
{context}
</context>
<history>
{history}
</history>
**๋ต๋ณ ํ์:**
1. <think> ํ๊ทธ์ ์ถ๋ก ๊ณผ์ ์์ฑ (1 depth ๊ฐ์กฐ์, 10์ค ์ดํ)
- ์ง๋ฌธ ๋ถ์ โ ์ถ์ฒ ๋ถ์ (๋ฌธ์๋ช
, ๋ ์ง, ํ์ด์ง, ์ต์ ์ฑ, ์ผ์น์ฑ) โ ์ ๋ณด ์ข
ํฉ โ ๊ตฌ์กฐํ ์์
2. ๋ณธ๋ฌธ ๋ต๋ณ ์์ฑ
- ๊ฐ์กฐ์ ๋๋ ํ ํ์์ผ๋ก ๊ตฌ์กฐํ
- ์ต์ ์ ๋ณด ์ฐ์ , ์๊ฐ์ ๋น๊ต ์ ์
- ๊ฐ ์ ๋ณด ๋ค์ <source>[์ถ์ฒ + ์ธ๋ฑ์ค]</source> ํ๊ธฐ
์ด์ ๋ต๋ณ์ ์์ฑํ์ธ์.
- Downloads last month
- -