/ Модель

Характеристики

Контекст
512 токенов
Лицензия
MIT
Архитектура
distilbert · dense
Базовая модель
distilbert-base-uncased
Библиотека
transformers
Опубликована
3 мар 2025

SoT_DistilBERT

Классификация текстаТекст → label3 профессии

Классификатор DistilBERT выбирает одну из трёх парадигм Sketch-of-Thought для организации рассуждения языковой модели по тексту вопроса.

209скачиваний за 30 дней7лайковвеса обновлены11 мар 2025

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

SoT_DistilBERT — англоязычный классификатор на базе DistilBERT, разработанный для выбора подходящей парадигмы рассуждения Sketch-of-Thought (SoT) по тексту вопроса. Он относит запрос к одной из трёх категорий: концептуальная цепочка для логического и многошагового вывода, структурированные символические шаги для математики и вычислений или специализированная терминология для технических областей. Модель предназначена для автоматического выбора формата подсказки в конвейере работы с языковой моделью, а не для самостоятельной генерации ответа.

Это плотная архитектура DistilBertForSequenceClassification с контекстом до 512 токенов. Классификатор дообучен на примерно 14 200 примерах из задач на рассуждение; по карточке, метки назначались GPT-4o. В метаданных указаны английский язык и наборы данных для математических задач, чтения с выводами, вопросов по знаниям и логического рассуждения. README сообщает о многоязычной поддержке пакета SoT, но это не подтверждает многоязычность самого классификатора.

Модель может помочь сократить объём рассуждений, выбирая один из трёх заранее заданных подходов, однако она только классифицирует запросы и может плохо обобщать за пределами обучающего распределения; качество также зависит от сложности и тематики вопроса. Репозиторий распространяется по лицензии MIT.

Сценарии применения

  • выбор формата рассуждения для математической задачи
  • определение подхода к многошаговому логическому выводу
  • маршрутизация вопросов для системы Sketch-of-Thought
  • выбор специализированной терминологии для технического вопроса

Ограничения

Модель классифицирует запросы только по трём заранее заданным парадигмам и может плохо обобщать на задачи вне обучающего распределения. Результат зависит от сложности и области вопроса.

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

SoT_DistilBERT: Paradigm Selection Model for Sketch-of-Thought

License Python PyTorch GitHub

What is Sketch-of-Thought?

Sketch-of-Thought (SoT) is a novel prompting framework for efficient reasoning in language models that combines cognitive-inspired reasoning paradigms with linguistic constraints to minimize output token usage while preserving reasoning accuracy.

Unlike conventional Chain of Thought (CoT) approaches that produce verbose reasoning chains, SoT implements three distinct reasoning paradigms:

  • Conceptual Chaining: Connects essential ideas in logical sequences through structured step links. Effective for commonsense reasoning, multi-hop inference, and fact-based recall tasks.

  • Chunked Symbolism: Organizes numerical and symbolic reasoning into structured steps with equations, variables, and arithmetic operations. Excels in mathematical problems and technical calculations.

  • Expert Lexicons: Leverages domain-specific shorthand, technical symbols, and jargon for precise and efficient communication. Suited for technical disciplines requiring maximum information density.

Loading the Model

This repository contains the DistilBERT paradigm selection model for the Sketch-of-Thought (SoT) framework. You can load and use it directly with Hugging Face Transformers:

from transformers import DistilBertTokenizer, DistilBertForSequenceClassification
import torch
import json

# Load the model directly from Hugging Face
model = DistilBertForSequenceClassification.from_pretrained("saytes/SoT_DistilBERT")
tokenizer = DistilBertTokenizer.from_pretrained("saytes/SoT_DistilBERT")

# Define label mapping
label_mapping = {
   "chunked_symbolism": 0,
   "conceptual_chaining": 1,
   "expert_lexicons": 2
}

# Function to classify questions
def classify_question(question):
    inputs = tokenizer(question, return_tensors="pt", truncation=True, padding=True)
    outputs = model(**inputs)
    predicted_class = torch.argmax(outputs.logits, dim=1).item()
    
    # Reverse mapping to get the paradigm name
    label_mapping_reverse = {v: k for k, v in label_mapping.items()}
    return label_mapping_reverse[predicted_class]

# Example usage
question = "Alice has 5 apples. She gives 3 apples to Bob. How many apples does Alice have?"
paradigm = classify_question(question)
print(f"Recommended paradigm: {paradigm}")  # Output: "chunked_symbolism"

For easier integration, we also provide a complete Python package implementation. See the GitHub repository or the "Complete Package" section below for details.

Model Description

The SoT_DistilBERT model is a fine-tuned DistilBERT classifier trained to select the optimal reasoning paradigm for a given query based on the Sketch-of-Thought framework.

Training Data

The model was trained on approximately 14,200 samples across various reasoning tasks, with each sample labeled using one of the three SoT paradigms. Labels were assigned using GPT-4o with a classification-specific prompt based on predefined heuristics.

Model Architecture

  • Base model: DistilBERT
  • Training: 5 epochs, batch size 64, learning rate 2e-5
  • Loss: Cross-entropy

Complete Package

For a more streamlined experience, we've developed the SoT Python package that handles paradigm selection, prompt management, and exemplar formatting:

from sketch_of_thought import SoT

# Initialize SoT
sot = SoT()

# Classify a question and get appropriate paradigm
question = "Alice has 5 apples. She gives 3 apples to Bob. How many apples does Alice have?"
paradigm = sot.classify_question(question)  # Returns: 'chunked_symbolism'

# Get initialized context with exemplars for the selected paradigm
context = sot.get_initialized_context(
    paradigm=paradigm, 
    question=question, 
    format="llm",
    include_system_prompt=True
)

# Use with your LLM of choice

Example with Qwen2.5-7B

Here's a complete example using Qwen2.5-7B-Instruct:

from transformers import AutoModelForCausalLM, AutoTokenizer
from sketch_of_thought import SoT

# Initialize SoT
sot = SoT()

# Load Qwen model
model_name = "Qwen/Qwen2.5-7B-Instruct"
model = AutoModelForCausalLM.from_pretrained(
    model_name,
    torch_dtype="auto",
    device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_name)

# Prepare the question
prompt = "Alice has 5 apples. She gives 3 apples to Bob. How many apples does Alice have?"

# Classify and get appropriate context
paradigm = sot.classify_question(prompt)
messages = sot.get_initialized_context(
    paradigm,
    prompt,
    format="llm",
    include_system_prompt=True
)

# Format for the model
text = tokenizer.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)

# Generate response
generated_ids = model.generate(
    **model_inputs,
    max_new_tokens=512
)
generated_ids = [
    output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]

# Decode response
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
print(response)

Output:

<think>
A = 5
A -= 3
A = 2
</think>

\boxed{2}

Supported Formats

The SoT package supports multiple output formats:

  • "llm": Standard chat format for text-only LLMs
  • "vlm": Multimodal format for vision-language models
  • "raw": Raw exemplars without formatting

LLM Format

Standard messages format for Large Language Models.

[
  {
    "role": "system", 
    "content": "SYSTEM_PROMPT_HERE"
  },
  {
    "role": "user", 
    "content": "EXAMPLE_QUESTION_HERE"
  },
  {
    "role": "assistant", 
    "content": "EXAMPLE_ANSWER_HERE"
  },
  {
    "role": "user", 
    "content": "USER_QUESTION_HERE"
  }
]

VLM Format

Standard messages format for Large Vision-Language Models.

[
  {
    "role": "system", 
    "content": "SYSTEM_PROMPT_HERE"
  },
  {
    "role": "user", 
    "content": [{"type": "text", "text": "EXAMPLE_QUESTION_HERE"}]
  },
  {
    "role": "assistant", 
    "content": [{"type": "text", "text": "EXAMPLE_ANSWER_HERE"}]
  },
  {
    "role": "user", 
    "content": [{"type": "text", "text": "USER_QUESTION_HERE"}]
  }
]

Raw Format

Raw exemplar data. Apply your own format!

[
  {
    "question": "EXAMPLE_QUESTION_HERE",
    "answer": "EXAMPLE_ANSWER_HERE"
  },
  {
    "question": "EXAMPLE_QUESTION_HERE",
    "answer": "EXAMPLE_ANSWER_HERE"
  }
]

Multilingual Support

SoT supports multiple languages. System prompts and exemplars are automatically loaded in the requested language.

Paradigm Selection Model

SoT includes a pretrained DistilBERT model for automatic paradigm selection based on the question. The model is available on Hugging Face: saytes/SoT_DistilBERT

Datasets

The SoT_DistilBERT model was evaluated on the following datasets:

DatasetHF IDSubsetSplitEvaluation Type
GSM8Kgsm8kmaintestnumerical
SVAMPChilleD/SVAMP-testnumerical
AQUA-RATaqua_rat-testmultiple_choice
DROPdrop-validationopen
OpenbookQAopenbookqa-testmultiple_choice
StrategyQAChilleD/StrategyQA-testyesno
LogiQAlucasmccabe/logiqadefaulttestmultiple_choice
Reclormetaeval/reclor-validationmultiple_choice
HotPotQAhotpot_qadistractorvalidationopen
MuSiQue-Ansdgslibisey/MuSiQue-validationopen
QASCallenai/qasc-validationmultiple_choice
Worldtreenguyen-brat/worldtree-trainmultiple_choice
PubMedQAqiaojin/PubMedQApqa_labeledtrainyesno
MedQAbigbio/med_qamed_qa_en_sourcevalidationmultiple_choice

Limitations

  • The model is trained to classify questions into one of three predefined paradigms and may not generalize to tasks outside the training distribution.
  • Performance may vary depending on the complexity and domain of the question.

Citation

If you find our work helpful, please cite:

@misc{aytes2025sot,
      title={Sketch-of-Thought: Efficient LLM Reasoning with Adaptive Cognitive-Inspired Sketching}, 
      author={Simon A. Aytes and Jinheon Baek and Sung Ju Hwang},
      year={2025},
      eprint={2503.05179},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://hf.co/papers/2503.05179}, 
}

License

This project is licensed under the MIT License - see the LICENSE file for details.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · transformers · text-classification

Можно запустить

Подбираем GPU…

Класс архитектуры
DistilBertForSequenceClassification
Ревизия весов
c95f17f

0 моделей