Views
No views yet

| Stage | Core Idea | Key Techniques | Outcome |
|---|---|---|---|
| 1. Pre-training | Inject knowledge while separating “reasoning” from “direct answering”. |
Dual-regime data • Think-off queries labeled via a custom tagging system. • Think-on queries generated by a multi-agent solver. Knowledge Distillation + Multi-Token Prediction for fine-grained utility. | Base model attains strong factual and reasoning skills without full-scale pre-training costs. |
| 2. Post-training | Make reasoning optional and efficient. |
Cold-start AutoThink — majority vote sets the initial thinking mode. Step-SRPO — intermediate supervision rewards correct mode selection and answer accuracy under that mode. | Model triggers CoT only when beneficial, reducing token use and speeding inference. |


| Token | Description |
|---|---|
<judge> | Analyzes the input to decide whether explicit reasoning is needed. |
<think_on> / <think_off> | Indicates whether reasoning is activated (“on”) or skipped (“off”). |
<think> | Marks the start of the chain-of-thought segment when think_on is chosen. |
<answer> | Marks the start of the final user-facing answer. |
1from transformers import AutoTokenizer, AutoModelForCausalLM
2
3model_name = "Kwaipilot/KAT-V1-40B"
4
5# load the tokenizer and the model
6tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
7model = AutoModelForCausalLM.from_pretrained(
8 model_name,
9 torch_dtype="auto",
10 device_map="auto"
11)
12
13# prepare the model input
14prompt = "Give me a short introduction to large language model."
15messages = [
16 {"role": "user", "content": prompt}
17]
18text = tokenizer.apply_chat_template(
19 messages,
20 tokenize=False,
21 add_generation_prompt=True
22)
23model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
24
25# conduct text completion
26generated_ids = model.generate(
27 **model_inputs,
28 max_new_tokens=65536,
29 temperature=0.6,
30 top_p=0.95,
31)
32output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()
33content = tokenizer.decode(output_ids, skip_special_tokens=True).strip("\n")
34print("prompt:\n", prompt)
35print("content:\n", content)
36"""
37prompt:
38Give me a short introduction to large language model.
39content:
40<judge>
41The user's request is to provide a concise factual introduction to large language models, which involves retrieving and summarizing basic information. This task is straightforward as it only requires recalling and presenting well-known details without deeper analysis. No complex reasoning is needed here—just a simple explanation will suffice.
42</judge>
43
44<think_off>
45<answer>
46A **Large Language Model (LLM)** is an advanced AI system trained on vast amounts of text data to understand, generate, and process human-like language. Here’s a concise introduction:
47
48### Key Points:
491. **Training**: Trained on diverse text sources (books, websites, etc.) using deep learning.
502. **Capabilities**:
51 - Answer questions, generate text, summarize content, translate languages.
52 - Understand context, sentiment, and nuances in language.
533. **Architecture**: Often based on **transformer models** (e.g., BERT, GPT, LLaMA).
544. **Scale**: Billions of parameters, requiring massive computational resources.
555. **Applications**: Chatbots, content creation, coding assistance, research, and more.
56
57### Examples:
58- **OpenAI’s GPT-4**: Powers ChatGPT.
59- **Google’s Gemini**: Used in Bard.
60- **Meta’s LLaMA**: Open-source alternative.
61
62### Challenges:
63- **Bias**: Can reflect biases in training data.
64- **Accuracy**: May hallucinate "facts" not grounded in reality.
65- **Ethics**: Raises concerns about misinformation and job displacement.
66
67LLMs represent a leap forward in natural language processing, enabling machines to interact with humans in increasingly sophisticated ways. 🌐🤖
68</answer>
69"""