Instructions to use XINLI1997/ErrOPD-Qwen3-4B-teacher-SQL with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use XINLI1997/ErrOPD-Qwen3-4B-teacher-SQL with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="XINLI1997/ErrOPD-Qwen3-4B-teacher-SQL") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("XINLI1997/ErrOPD-Qwen3-4B-teacher-SQL") model = AutoModelForCausalLM.from_pretrained("XINLI1997/ErrOPD-Qwen3-4B-teacher-SQL", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use XINLI1997/ErrOPD-Qwen3-4B-teacher-SQL with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "XINLI1997/ErrOPD-Qwen3-4B-teacher-SQL" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "XINLI1997/ErrOPD-Qwen3-4B-teacher-SQL", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/XINLI1997/ErrOPD-Qwen3-4B-teacher-SQL
- SGLang
How to use XINLI1997/ErrOPD-Qwen3-4B-teacher-SQL with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "XINLI1997/ErrOPD-Qwen3-4B-teacher-SQL" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "XINLI1997/ErrOPD-Qwen3-4B-teacher-SQL", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "XINLI1997/ErrOPD-Qwen3-4B-teacher-SQL" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "XINLI1997/ErrOPD-Qwen3-4B-teacher-SQL", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use XINLI1997/ErrOPD-Qwen3-4B-teacher-SQL with Docker Model Runner:
docker model run hf.co/XINLI1997/ErrOPD-Qwen3-4B-teacher-SQL
ErrOPD-Qwen3-4B-teacher-SQL
Teacher fine-tuned to make the trailing-text error on purpose (extra text follows the SQL query), released with the paper ErrOPD: When Does On-Policy Distillation Transfer Teacher Errors? (Xin Li, Hao Jiang, Annan Wang, Yichi Zhang, Chau Yuen).
Code: https://github.com/LiXin97/ErrOPD · Project page: https://lixin.ai/ErrOPD · All checkpoints and datasets: ErrOPD collection
This teacher reproduces an injected trailing-text error by design (extra text follows the SQL query). It exists to study how such errors transfer under distillation; do not use it as a task model.
Checkpoint
| Role | Teacher fine-tuned to make the trailing-text error on purpose (extra text follows the SQL query) |
| What it is | Teacher fine-tuned (supervised) on Spider targets in which 20% of the training copies carry an injected trailing text after the SQL query. It reproduces this error by design. |
| Paper reference | Table 2 (SQL trailing text: teacher) |
| Task | Spider 1.0 text-to-SQL: given a SQLite schema and a question, output one SQL query on a single line and nothing else |
| Training data | sft_train.jsonl of XINLI1997/ErrOPD-Spider (1,795 Spider questions); trailing text is injected into 20% of the training copies at fine-tuning time |
| Base model | Qwen/Qwen3-4B |
| Weights | bf16 safetensors, 2 files, 8.04 GB (4.02 B stored parameters). |
Usage
# pip install "transformers>=4.57.0" accelerate datasets torch
import torch
from datasets import load_dataset
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "XINLI1997/ErrOPD-Qwen3-4B-teacher-SQL"
tokenizer = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, dtype=torch.bfloat16, device_map="auto")
# one held-out prompt (system + user turns) from the evaluation split
example = load_dataset("XINLI1997/ErrOPD-Spider", split="validation")[0]
messages = [m for m in example["messages"] if m["role"] != "assistant"]
inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt", return_dict=True).to(model.device)
output = model.generate(**inputs, max_new_tokens=512, do_sample=False)
print(tokenizer.decode(output[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))
The expected output is one SQLite query on a single line (run it against the Spider database named in metadata.db_id to check it). Prompts, decoding settings and the scoring code used in the paper are in the code repository.
Notes:
- The bundled chat template is the one used for fine-tuning, distillation rollouts and evaluation in the paper.
Training
Teacher fine-tuned (supervised) on Spider targets in which 20% of the training copies carry an injected trailing text after the SQL query. It reproduces this error by design. Full training configurations and scripts are in the code repository.
Evaluation
This checkpoint is reported in the paper, Table 2 (SQL trailing text: teacher); see that table for its scores.
Limitations
- Trained for one narrow structured-output task. It is not a general assistant, and outputs for other prompts are not meaningful.
- Teachers in this release were fine-tuned to make an injected format error on purpose; distilled students may inherit it. This is what the paper measures.
- Evaluated on a 500-question subset of Spider dev; generated SQL should be executed in a sandbox.
License
Apache-2.0, inherited from the base model Qwen/Qwen3-4B (see LICENSE). The training data keep their own terms (see the dataset card of XINLI1997/ErrOPD-Spider).
Citation
@article{li2026erropd,
title = {ErrOPD: When Does On-Policy Distillation Transfer Teacher Errors?},
author = {Li, Xin and Jiang, Hao and Wang, Annan and Zhang, Yichi and Yuen, Chau},
journal = {arXiv preprint arXiv:2605.08737},
year = {2026}
}
- Downloads last month
- 137