Instructions to use MaxChess/qwen2.5-7b-nla-affect-av with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MaxChess/qwen2.5-7b-nla-affect-av with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="MaxChess/qwen2.5-7b-nla-affect-av") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("MaxChess/qwen2.5-7b-nla-affect-av") model = AutoModelForCausalLM.from_pretrained("MaxChess/qwen2.5-7b-nla-affect-av", 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use MaxChess/qwen2.5-7b-nla-affect-av with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MaxChess/qwen2.5-7b-nla-affect-av" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MaxChess/qwen2.5-7b-nla-affect-av", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/MaxChess/qwen2.5-7b-nla-affect-av
- SGLang
How to use MaxChess/qwen2.5-7b-nla-affect-av 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 "MaxChess/qwen2.5-7b-nla-affect-av" \ --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": "MaxChess/qwen2.5-7b-nla-affect-av", "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 "MaxChess/qwen2.5-7b-nla-affect-av" \ --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": "MaxChess/qwen2.5-7b-nla-affect-av", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use MaxChess/qwen2.5-7b-nla-affect-av with Docker Model Runner:
docker model run hf.co/MaxChess/qwen2.5-7b-nla-affect-av
Qwen2.5-7B NLA Affect AV
Experimental activation verbalizer (AV): a full-parameter SFT of Qwen2.5-7B-Instruct that maps a 3,584-dimensional layer-20 activation to a structured natural-language explanation with context, affect, and local-token sections.
This repository contains only the latest Exp19 checkpoint: one SFT pass over 5,000 examples, then a fresh-optimizer continuation over 2,400 additional examples (7,400 unique AV examples total).
Important usage note
This is not a normal text-generation checkpoint. The activation vector must be injected
at token id 149705 with scale 150 using the forward hook in the accompanying training or
evaluation code. Exact metadata and prompt templates are in nla_meta.yaml.
Evaluation
On 200 fresh Ultra-FineWeb prefixes with zero exact overlap with the 10k training set:
- Valid
<explanation>format: 200/200. - Full AV -> AR cycle FVE: 0.03765, bootstrap 95% CI [-0.00674, 0.07194].
- Full-cycle mean cosine: 0.65645.
- Shuffled full-cycle FVE: -0.74131.
The model is fluent and activation-conditioned but the full-cycle FVE is low; it should be treated as an SFT warm start for joint NLA RL, not as a finished interpretability tool.
Training
- Target layer: raw
model.layers[20], no final RMSNorm. - Dense full-parameter transformer-block SFT, not LoRA.
- FP16, PyTorch SDPA, gradient checkpointing.
- Effective global batch: 33 on three V100-32GB GPUs.
- Exp17: 152 optimizer steps, peak LR 7e-6.
- Exp19: 73 optimizer steps, peak LR 3.5e-6, fresh optimizer.
See MaxChess/nla-affect-10k for exact splits and source code.
- Downloads last month
- 11