Downloads · 30 days
11
24% of all-time downloads
mayank-dubey-ai/enterprise-100-qwen3-8b-steering-vectors
enterprise-100-qwen3-8b-steering-vectors is a machine learning model from mayank-dubey-ai. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
Reusable activation-steering artifacts from the Enterprise-100 database experiment. They steer Qwen/Qwen3-8B between direct SQL and Python sqlite3/pandas solutions without changing model weights.
Downloads · 30 days
11
24% of all-time downloads
All-time downloads
45
Public
Repo size
222 KB
Likes
0
Public
Click a slice to open those files.
.pt222 KB · 94%
From the Hugging Face model README
Reusable activation-steering artifacts from the
Enterprise-100 database experiment.
They steer Qwen/Qwen3-8B between direct SQL and Python sqlite3/pandas
solutions without changing model weights.
This is an activation artifact repository, not a fine-tuned checkpoint. Load the base Qwen3-8B model separately and apply a vector through a forward hook.
The principal direction is:
python_minus_sql = mean(h_python - h_sql)
At generation time:
h' = h + alpha × v
alpha < 0: biases toward direct SQLalpha = 0: leaves the base model unchangedalpha > 0: biases toward Python database codeThe most stable demonstration uses layer 16. The vector has 4,096 float32 components, matching the Qwen3-8B residual-stream width.
| Artifact | Purpose |
|---|---|
vectors/python_vs_sql_engineer_layer_{8,12,16,20,24,28}.pt | Layer sweep of the primary Python-minus-SQL direction |
vectors/full_code_modality_layer_{12,16,20}.pt | Broader fenced-code modality direction |
vectors/format_python.pt | Python-versus-SQL formatting direction |
vectors/persona_executive.pt | Executive-versus-engineer persona direction |
diagnostics/python_vs_sql_diagnostics.json | Norms and within-pair cosine diagnostics |
config.json | Machine-readable compatibility and intervention metadata |
Four contrast pairs were used for the principal direction. Mean cosine alignment of each pair-specific difference with the mean vector remained high across the layer sweep:
| Layer | Vector norm | Mean pair cosine |
|---|---|---|
| 8 | 30.92 | 0.908 |
| 12 | 41.62 | 0.897 |
| 16 | 49.91 | 0.900 |
| 20 | 72.46 | 0.912 |
| 24 | 147.56 | 0.908 |
| 28 | 258.40 | 0.893 |
High alignment indicates a consistent contrast direction across the four examples; it does not by itself prove causal usefulness. Causal behavior is tested by intervening during generation and executing the resulting programs.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
base_model = "Qwen/Qwen3-8B"
artifact = torch.load(
"vectors/python_vs_sql_engineer_layer_16.pt",
map_location="cpu",
weights_only=True,
)
tokenizer = AutoTokenizer.from_pretrained(base_model)
model = AutoModelForCausalLM.from_pretrained(
base_model,
dtype=torch.bfloat16,
device_map="auto",
).eval()
layer = model.model.layers[artifact["layer"]]
vector = artifact["vector"].to(model.device, model.dtype)
alpha = 0.75 # positive -> Python; negative -> SQL
def steering_hook(_module, _inputs, output):
hidden = output[0] if isinstance(output, tuple) else output
steered = hidden.clone()
steered[:, -1, :] += alpha * vector
return (steered, *output[1:]) if isinstance(output, tuple) else steered
handle = layer.register_forward_hook(steering_hook)
try:
# Call model.generate(...) here.
pass
finally:
handle.remove()
Use the complete scripts and 100-table SQLite fixture in the linked dataset repository for reproducible prompts, schema retrieval, execution, and scoring.
The published 10-query benchmark covers joins across 2–6 tables. In the fast execution run:
Execution success is therefore not semantic correctness. The repository keeps raw outputs and row counts visible so these differences can be audited.
Qwen/Qwen3-8B.