Instructions to use sriram882004/SQL-Socratic-Models 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 sriram882004/SQL-Socratic-Models 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 sriram882004/SQL-Socratic-Models:Q8_0 # Run inference directly in the terminal: llama cli -hf sriram882004/SQL-Socratic-Models:Q8_0
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf sriram882004/SQL-Socratic-Models:Q8_0 # Run inference directly in the terminal: llama cli -hf sriram882004/SQL-Socratic-Models:Q8_0
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 sriram882004/SQL-Socratic-Models:Q8_0 # Run inference directly in the terminal: ./llama-cli -hf sriram882004/SQL-Socratic-Models:Q8_0
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 sriram882004/SQL-Socratic-Models:Q8_0 # Run inference directly in the terminal: ./build/bin/llama-cli -hf sriram882004/SQL-Socratic-Models:Q8_0
Use Docker
docker model run hf.co/sriram882004/SQL-Socratic-Models:Q8_0
- LM Studio
- Jan
- Ollama
How to use sriram882004/SQL-Socratic-Models with Ollama:
ollama run hf.co/sriram882004/SQL-Socratic-Models:Q8_0
- Unsloth Studio
How to use sriram882004/SQL-Socratic-Models with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for sriram882004/SQL-Socratic-Models to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for sriram882004/SQL-Socratic-Models to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for sriram882004/SQL-Socratic-Models to start chatting
- Docker Model Runner
How to use sriram882004/SQL-Socratic-Models with Docker Model Runner:
docker model run hf.co/sriram882004/SQL-Socratic-Models:Q8_0
- Lemonade
How to use sriram882004/SQL-Socratic-Models with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull sriram882004/SQL-Socratic-Models:Q8_0
Run and chat with the model
lemonade run user.SQL-Socratic-Models-Q8_0
List all available models
lemonade list
- Atomic Chat
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,64 +1,29 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: mit
|
| 3 |
-
---
|
| 4 |
-
|
| 5 |
-
# SQL Socratic Models
|
| 6 |
-
|
| 7 |
-
This repository contains fine-tuned large language models for **Socratic SQL instruction** in higher education, focusing on guiding learners through SQL concepts using structured reasoning rather than providing direct solutions.
|
| 8 |
-
|
| 9 |
-
## Models
|
| 10 |
-
- phi3_rq4
|
| 11 |
-
- qwen25
|
| 12 |
-
- gemma2
|
| 13 |
-
|
| 14 |
## Method
|
| 15 |
|
| 16 |
-
Our approach is
|
| 17 |
-
|
| 18 |
-
- **Phase 1 (Data Construction):**
|
| 19 |
-
SQL instruction data is augmented with Socratic prompts emphasizing:
|
| 20 |
-
- Question decomposition
|
| 21 |
-
- Conceptual hints
|
| 22 |
-
- Guided reasoning steps
|
| 23 |
-
|
| 24 |
-
- **Phase 2 (Fine-Tuning):**
|
| 25 |
-
We apply full fine-tuning (FFT) on small, open-source LLMs with **pedagogical constraints** that explicitly discourage direct answer generation and instead promote:
|
| 26 |
-
- Conceptual scaffolding
|
| 27 |
-
- Incremental reasoning
|
| 28 |
-
- Learner-centered guidance
|
| 29 |
|
| 30 |
-
|
| 31 |
-
Models are evaluated using:
|
| 32 |
-
- **BERTScore** for semantic alignment with expected reasoning
|
| 33 |
-
- **ROUGE-L** to measure and control **answer leakage** (i.e., avoidance of direct SQL solutions)
|
| 34 |
|
| 35 |
-
|
| 36 |
-
- Fine-tuning across multiple architectures (Phi-3, Qwen2.5, Gemma2) for **instructional SQL reasoning**
|
| 37 |
-
- Development of **Socratic SQL prompting framework** for higher education contexts
|
| 38 |
-
- Evaluation of models on their ability to generate **guidance without revealing final answers**
|
| 39 |
-
- Ablation study identifying factors that enable LLMs to mimic effective instructors through:
|
| 40 |
-
- Misconception-aware feedback
|
| 41 |
-
- Iterative questioning
|
| 42 |
-
- Structured reasoning support
|
| 43 |
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
-
|
| 47 |
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
|
| 52 |
-
|
| 53 |
|
| 54 |
-
|
| 55 |
-
-
|
| 56 |
-
-
|
| 57 |
-
-
|
| 58 |
|
| 59 |
-
|
| 60 |
-
```python
|
| 61 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 62 |
|
| 63 |
-
|
| 64 |
-
tokenizer = AutoTokenizer.from_pretrained("sriram882004/SQL-Socratic-Models/phi3_rq4")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
## Method
|
| 2 |
|
| 3 |
+
Our approach is structured in three phases to support Socratic SQL instruction for higher education.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
+
### Phase 1: SQL-Instruct Corpus Construction
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
+
We construct **SQL-Instruct**, a domain-specific Socratic instruction corpus, by mining high-quality interactions from Stack Overflow. This platform provides a rich source of real-world misconceptions, debugging challenges, and conceptual difficulties encountered by both students and practitioners, making it well-suited for training models that emphasize understanding over code replication.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
+
To ensure data quality, we filter SQL-tagged questions based on community impact. The resulting dataset reflects substantial engagement, with a cumulative reach of approximately **1.27 billion views** and an average of **128,535 views per question**. For each selected instance, we extract:
|
| 10 |
+
- The core problem description
|
| 11 |
+
- User-provided SQL attempts (when available)
|
| 12 |
+
- Executable SQL blocks from the accepted solution
|
| 13 |
|
| 14 |
+
This process yields **9,916 unique questions**, which are then transformed into Socratic instructional data using GPT-4o. We leverage GPT-4o for its strong reasoning capabilities to generate **pedagogical hints and guided reasoning steps**, ensuring that the dataset emphasizes conceptual scaffolding rather than direct answers.
|
| 15 |
|
| 16 |
+
The dataset is intentionally skewed toward higher cognitive complexity, with:
|
| 17 |
+
- **8,604 intermediate-level questions**
|
| 18 |
+
- **629 advanced-level questions**
|
| 19 |
|
| 20 |
+
Additionally, we identify a subset of **531 debugging tasks**, enabling models to learn how to guide students through error identification and correction in SQL queries.
|
| 21 |
|
| 22 |
+
The corpus spans a wide range of SQL topics, with particular emphasis on:
|
| 23 |
+
- JOIN operations
|
| 24 |
+
- Aggregation and grouping
|
| 25 |
+
- Query optimization and performance
|
| 26 |
|
| 27 |
+
By selecting questions with a **median Stack Overflow score of 27**, we ensure that the underlying solutions—and therefore the derived instructional signals—are technically reliable.
|
|
|
|
|
|
|
| 28 |
|
| 29 |
+
This corpus serves as the foundation for training models that prioritize **Socratic reasoning, misconception-aware feedback, and conceptual understanding** over direct SQL solution generation.
|
|
|