How to use from
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 "xzybit/qwen2-7b-ts2" \
    --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": "xzybit/qwen2-7b-ts2",
		"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 "xzybit/qwen2-7b-ts2" \
        --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": "xzybit/qwen2-7b-ts2",
		"messages": [
			{
				"role": "user",
				"content": "What is the capital of France?"
			}
		]
	}'
Quick Links

Qwen2-7B-TS2

Training with Sparsemax+, Testing with Softmax

This model is a supervised fine-tuned variant of Qwen2-7B, trained with our TS^2 objective.

TS^2 is designed to improve alignment stability and mitigate token-level probability collapse during fine-tuning by incorporating entropy-aware adaptive weighting into the training objective.

More details could check our paper ICLR 2026 "TS^2: Training with Sparsemax+, Testing with Softmax for Accurate and Diverse LLM Fine-Tuning"

Model Description

  • Base model: Qwen2-7B
  • Training method: Sparsemax+
  • Objective: token-level entropy-aware TS^2-style regularization
  • Framework: PyTorch + Hugging Face Transformers
  • Precision: bfloat16

Instead of applying uniform likelihood maximization across all tokens as in standard supervised fine-tuning, this model introduces an adaptive weighting mechanism that dynamically adjusts training emphasis based on predictive entropy.

This design is motivated by observations that overconfident likelihood-based training may lead to:

  • degeneration of token diversity
  • inference-time mode collapse
  • reduced generalization under distribution shift

TS^2 modifies the training objective to improve both accuracy and diversity.

Usage

from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("xzybit/qwen2-7b-ts2")

model = AutoModelForCausalLM.from_pretrained(
    "xzybit/qwen2-7b-ts2",
    device_map="auto"
)
Downloads last month
3
Safetensors
Model size
8B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support