Socraticlm
模型简介
该模型专为教育目的设计,能够在学生解决数学问题时提供苏格拉底式引导,也能独立解决数学问题。支持英文和中文。
模型特点
苏格拉底式教学
通过启发式问题引导学生自主思考,培养解决问题的能力
数学问题求解
能够逐步分析并解决复杂的数学问题
双语支持
同时支持英文和中文的交互
模型能力
文本生成
数学推理
教育引导
多轮对话
使用案例
教育
数学问题引导
在学生遇到数学难题时,通过提问引导其思考解题路径
帮助学生理解解题思路而非直接给出答案
独立解题
直接解决各类数学问题
提供详细的解题步骤和最终答案
🚀 SocraticLM模型
SocraticLM是一个基于Qwen2.5-Math-7B-Instruct微调的模型,专为教育场景设计。它能以苏格拉底式引导帮助学生解决数学问题,也可直接解答数学问题,支持中英文。
🚀 快速开始
模型简介
本模型是在Qwen2.5-Math-7B-Instruct基础上,使用SocraTeach数据集进行微调得到的,是SocraticLM的具体实现。
预期用途与限制
SocraticLM主要用于教育场景,当学生在学习解决数学问题遇到困难时,它能提供苏格拉底式的引导。同时,该模型也可以直接解决数学问题。此模型主要支持英文和中文。
安装指南
此部分文档未提及具体安装步骤,因此跳过该章节。
💻 使用示例
基础用法
使用Huggingface transformers库
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("CogBase-USTC/SocraticLM")
model = AutoModelForCausalLM.from_pretrained(
"CogBase-USTC/SocraticLM",
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True
)
### 数学问题求解 ###
messages = [
{"role": "system", "content" : "Please analyse and solve the following problem step by step."},
{"role": "user", "content": "Natalia sold clips to 48 of her friends in April, and then she sold half as many clips in May. How many clips did Natalia sell altogether in April and May?"},
]
### 苏格拉底式引导 ###
# messages = [
# {"role": "system", "content" : "You are a Socratic teacher, please guide me to solve the [Problem] with heuristic questions based on the following information. \n"},
# {"role": "user", "content": "[Problem] Debelyn, Christel, and Andrena collect dolls. Debelyn had 20 dolls before she gave Andrena 2 dolls. Christel had 24 dolls before giving Andrena 5 dolls. After all the gifts, Andrena now has 2 more dolls than Christel, how many more dolls does andrena have now than Debelyn? [Answer] 3 [Analysis] Debelyn had 20 - 2 = 18 dolls left after giving out 2 dolls to Christel. Christel had 24 + 2 = 26 dolls after receiving 2 dolls from Debelyn. Christel had 24 - 5 = 19 dolls after giving Andrena 5 dolls. So, Andrena has 19 +2 = 21 dolls now. Therefore, Andrena has 21 - 18 = 3 more dolls than Debelyn."},
# ]
prompt = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
inputs = tokenizer.encode(prompt, return_tensors="pt")
outputs = model.generate(input_ids=inputs.to(model.device), max_new_tokens=4096)
print(tokenizer.decode(outputs[0]))
使用vLLM库
from vllm import LLM, SamplingParams
llm = LLM(model=r'CogBase-USTC/SocraticLM',
tokenizer=r'CogBase-USTC/SocraticLM',
trust_remote_code=True,
tensor_parallel_size=1,
gpu_memory_utilization=0.99,
enable_chunked_prefill=True,
max_num_batched_tokens=512,
max_num_seqs=128)
sampling_params = SamplingParams(temperature=0, max_tokens=4096, seed=42)
def print_outputs(outputs):
for output in outputs:
prompt = output.prompt
generated_text = output.outputs[0].text
print(f"Generated text: {generated_text!r}")
print("-" * 80)
print("=" * 80)
### 数学问题求解 ###
conversation = [
{
"role": "system",
"content": "Please analyse and solve the following problem step by step."
},
{
"role": "user",
"content": "Natalia sold clips to 48 of her friends in April, and then she sold half as many clips in May. How many clips did Natalia sell altogether in April and May?"
},
]
### 苏格拉底式引导 ###
# conversation = [
# {
# "role": "system",
# "content": "You are a Socratic teacher, please guide me to solve the [Problem] with heuristic questions based on the following information. \n"
# },
# {
# "role": "user",
# "content": "[Problem] Debelyn, Christel, and Andrena collect dolls. Debelyn had 20 dolls before she gave Andrena 2 dolls. Christel had 24 dolls before giving Andrena 5 dolls. After all the gifts, Andrena now has 2 more dolls than Christel, how many more dolls does andrena have now than Debelyn? [Answer] 3 [Analysis] Debelyn had 20 - 2 = 18 dolls left after giving out 2 dolls to Christel. Christel had 24 + 2 = 26 dolls after receiving 2 dolls from Debelyn. Christel had 24 - 5 = 19 dolls after giving Andrena 5 dolls. So, Andrena has 19 +2 = 21 dolls now. Therefore, Andrena has 21 - 18 = 3 more dolls than Debelyn."
# },
# ]
outputs = llm.chat(conversation,
sampling_params=sampling_params,
use_tqdm=False,
)
print_outputs(outputs)
详细文档
训练超参数
训练过程中使用的超参数如下:
- 学习率(learning_rate):1e-05
- 训练批次大小(train_batch_size):8
- 随机种子(seed):42
- 分布式类型(distributed_type):多GPU
- 设备数量(num_devices):4
- 总训练批次大小(total_train_batch_size):32
- 总评估批次大小(total_eval_batch_size):32
- 优化器(optimizer):使用OptimizerNames.ADAMW_TORCH,其中beta1=0.9,beta2=0.999,epsilon=1e-08,无额外优化器参数
- 学习率调度器类型(lr_scheduler_type):余弦
- 学习率调度器热身步数(lr_scheduler_warmup_steps):20
框架版本
- Transformers:4.46.2
- Pytorch:2.5.1+cu124
- Datasets:3.1.0
- Tokenizers:0.20.3
📄 许可证
许可证类型:其他(other)
Phi 2 GGUF
其他
Phi-2是微软开发的一个小型但强大的语言模型,具有27亿参数,专注于高效推理和高质量文本生成。
大型语言模型 支持多种语言
P
TheBloke
41.5M
205
Roberta Large
MIT
基于掩码语言建模目标预训练的大型英语语言模型,采用改进的BERT训练方法
大型语言模型 英语
R
FacebookAI
19.4M
212
Distilbert Base Uncased
Apache-2.0
DistilBERT是BERT基础模型的蒸馏版本,在保持相近性能的同时更轻量高效,适用于序列分类、标记分类等自然语言处理任务。
大型语言模型 英语
D
distilbert
11.1M
669
Llama 3.1 8B Instruct GGUF
Meta Llama 3.1 8B Instruct 是一个多语言大语言模型,针对多语言对话用例进行了优化,在常见的行业基准测试中表现优异。
大型语言模型 英语
L
modularai
9.7M
4
Xlm Roberta Base
MIT
XLM-RoBERTa是基于100种语言的2.5TB过滤CommonCrawl数据预训练的多语言模型,采用掩码语言建模目标进行训练。
大型语言模型 支持多种语言
X
FacebookAI
9.6M
664
Roberta Base
MIT
基于Transformer架构的英语预训练模型,通过掩码语言建模目标在海量文本上训练,支持文本特征提取和下游任务微调
大型语言模型 英语
R
FacebookAI
9.3M
488
Opt 125m
其他
OPT是由Meta AI发布的开放预训练Transformer语言模型套件,参数量从1.25亿到1750亿,旨在对标GPT-3系列性能,同时促进大规模语言模型的开放研究。
大型语言模型 英语
O
facebook
6.3M
198
1
基于transformers库的预训练模型,适用于多种NLP任务
大型语言模型
Transformers

1
unslothai
6.2M
1
Llama 3.1 8B Instruct
Llama 3.1是Meta推出的多语言大语言模型系列,包含8B、70B和405B参数规模,支持8种语言和代码生成,优化了多语言对话场景。
大型语言模型
Transformers 支持多种语言

L
meta-llama
5.7M
3,898
T5 Base
Apache-2.0
T5基础版是由Google开发的文本到文本转换Transformer模型,参数规模2.2亿,支持多语言NLP任务。
大型语言模型 支持多种语言
T
google-t5
5.4M
702
精选推荐AI模型
Llama 3 Typhoon V1.5x 8b Instruct
专为泰语设计的80亿参数指令模型,性能媲美GPT-3.5-turbo,优化了应用场景、检索增强生成、受限生成和推理任务
大型语言模型
Transformers 支持多种语言

L
scb10x
3,269
16
Cadet Tiny
Openrail
Cadet-Tiny是一个基于SODA数据集训练的超小型对话模型,专为边缘设备推理设计,体积仅为Cosmo-3B模型的2%左右。
对话系统
Transformers 英语

C
ToddGoldfarb
2,691
6
Roberta Base Chinese Extractive Qa
基于RoBERTa架构的中文抽取式问答模型,适用于从给定文本中提取答案的任务。
问答系统 中文
R
uer
2,694
98
智启未来,您的人工智能解决方案智库
简体中文