How simonaytes/sot works
Project Type and Purpose
• SoT is an open-source Python framework/library designed to enhance reasoning in language models. It does this by implementing three reasoning paradigms – Conceptual Chaining, Chunked Symbolism, and Expert Lexicons – and automatically selecting the optimal strategy using a pretrained DistilBERT model.
• It is intended to be integrated with various LLMs, as shown in the provided quickstart examples (using Qwen2.5 and other LLMs), and supports multiple output formats (llm, vlm, raw).
High-Level File Structure Analysis
• The top-level files include standard Python project files (LICENSE, README.md, pyproject.toml, requirements.txt) along with the main package directory “sketch_of_thought.”
• Within the sketch_of_thought package, the structure is organized into:
• The core module (sketch_of_thought.py) that likely implements primary functionality.
• A “config” directory holding configuration files and language-specific prompt files organized by language (EN, IT, DE, KR). This division reflects an architectural emphasis on supporting multilingual prompts.
• Other config resources like exemplars, label mappings, and warning utilities.
• This organization indicates a clear separation between the core logic, configuration/settings, and prompt data.
Key Components
a. Frontend/Client Interface (User Application):
• This element represents the caller or client that imports and uses the SoT module to classify questions and build the context for LLM interaction.
b. SoT Core Module:
• The central processing logic (sketch_of_thought.py) that exposes the API for classifying questions, retrieving prompts, and initializing context.
c. Configuration & Prompt Manager:
• The “config” folder, which is split into:
• General configuration files and settings (config.py, warnings, exemplars.json, label_mapping.json).
• Language-specific prompt directories (EN, KR, IT, DE) that provide system prompt files for each reasoning paradigm.
d. Paradigm Selection Model:
• Representation of the underlying pretrained DistilBERT model used for automatically selecting the appropriate reasoning paradigm based on the input question.
e. LLM Integration Layer:
Relationships and Data Flow
• That after classification, the system retrieves the matching language-specific system prompt from the Config/Prompts directories.
• Then, illustrate how the system uses helper functions (e.g., get_initialized_context) to format the output in one of the supported formats (llm, vlm, raw), resulting in a structured context integrated with exemplars.
Architectural Patterns and Technologies
• Separation of concerns: The configuration management (prompts, settings) is decoupled from core processing logic.
• The use of a pretrained DistilBERT model for auto-selection is a key design pattern—show this as a decision module within the overall workflow.
• Mention core libraries such as PyTorch (as indicated by the README badges), Hugging Face Transformers, and Python 3.10+.