license: mit
task_categories:
- table-question-answering
- text-generation
tags: - activation-steering
- text-to-sql
- representation-engineering
- sqlite
- qwen3
size_categories: - n<1K
Enterprise-100: Multi-Table Database Activation Steering & Benchmark
This repository contains a 100-table synthetic enterprise relational SQLite database, multi-table join benchmarks (2 to 6 table joins), activation steering vectors for Qwen3-8B, and automated evaluation scripts with Gemini 2.5 Flash as an LLM judge.
ποΈ 1. The 100-Table Enterprise Database Schema (enterprise_100.db)
Contains 100 interrelated tables across 10 core business domains:
- Core Users (10 tables):
users,user_profiles,user_settings,auth_tokens,roles,permissions,role_permissions,user_roles,login_history,user_devices - Organizations (10 tables):
organizations,org_members,org_invites,departments,teams,team_members,org_tiers,org_settings,api_keys,oauth_apps - Catalog & Inventory (10 tables):
categories,subcategories,products,product_variants,product_attributes,attribute_values,inventory_locations,warehouse_stocks,stock_transfers,stock_adjustments - Pricing & Promotions (10 tables):
currency_rates,price_lists,price_tiers,discount_coupons,coupon_usages,flash_sales,bundle_deals,loyalty_programs,loyalty_tiers,customer_points - Orders & Fulfillment (10 tables):
order_statuses,delivery_addresses,orders,order_items,order_notes,fulfillments,fulfillment_items,shipments,carrier_tracking,returns - Payments & Billing (10 tables):
billing_accounts,payment_methods,invoices,invoice_line_items,payment_transactions,refunds,subscription_plans,customer_subscriptions,payouts,tax_rates - CRM & Support (10 tables):
pipeline_stages,contacts,leads,sales_opportunities,crm_activities,tickets,ticket_messages,ticket_tags,customer_feedback,agent_ratings - Marketing & Engagement (10 tables):
campaigns,campaign_audiences,email_templates,sent_emails,click_events,web_sessions,session_pageviews,ad_campaigns,conversion_events,push_notifications - Procurement (10 tables):
suppliers,supplier_contacts,supplier_contracts,raw_materials,purchase_orders,po_items,po_receipts,vendor_ratings,procurement_approvals,reorder_rules - Audit & Telemetry (10 tables):
audit_logs,system_events,security_incidents,metric_snapshots,api_usage_logs,background_jobs,error_traces,feature_flags,flag_evaluations,data_retention_policies
β‘ 2. Activation Steering Dynamics (Layer 16 on Qwen3-8B)
Using representation engineering, we extract steering vectors from contrast pairs:
$$\mathbf{v}{\text{steer}} = \frac{1}{N} \sum{i=1}^N \left( \mathbf{h}{\text{python}}^{(i)} - \mathbf{h}{\text{sql}}^{(i)} \right)$$
During autoregressive generation, a PyTorch forward hook intervenes on the residual stream at Layer 16:
$$\mathbf{h}' = \mathbf{h} + \alpha \cdot \mathbf{v}_{\text{steer}}$$
- $\alpha < 0$ (Negative Steering): Direct ANSI SQL multi-table join queries.
- $\alpha = 0$ (Baseline): Standard unsteered model response.
- $\alpha > 0$ (Positive Steering): Python
sqlite3+pandasdata pipeline.
π 3. 10-Query Benchmark & Gemini Judge Results
Evaluated across 10 queries spanning from 2-table joins to 6-table joins:
| Query ID | Complexity | Tables | SQL Execution | SQL Rows | Python Execution | Python Rows |
|---|---|---|---|---|---|---|
q01 |
Simple | 2 | β Success | 50 | β Success | 50 |
q02 |
Simple | 2 | β Success | 5 | β Success | 5 |
q03 |
Medium | 3 | β Success | 50 | β Success | 150 |
q04 |
Medium | 3 | β Success | 10 | β Success | 0 |
q05 |
Medium | 4 | β Success | 15 | β Success | 15 |
q06 |
Complex | 4 | β Success | 0 | β Success | 0 |
q07 |
Complex | 5 | β Success | 250 | β Success | 54 |
q08 |
Complex | 5 | β Success | 0 | β Success | 0 |
q09 |
Complex | 5 | β Success | 100 | β Error | 0 |
q10 |
Very Complex | 6 | β Success | 0 | β Error | 0 |
Key Findings:
- SQL Success Rate: 100% execution success across all 10 queries.
- Neutral JSON Schema Impact: Replaced SQL DDL (
CREATE TABLE) with JSON schema metadata ({"columns": [...], "foreign_keys": {...}}), eliminating linguistic bias and allowing seamless generation of both Python scripts and SQL queries.
π 4. How to Run & Reproduce
# 1. Clone repository from Hugging Face
git clone https://huggingface.co/datasets/mayank-dubey-ai/enterprise-100-db-steering
cd enterprise-100-db-steering
# 2. Run full 1-click reproduction suite (DB generation -> vector extraction -> benchmark execution)
bash reproduce.sh
# 3. Or run fast benchmark evaluation directly
python3 fast_benchmark_eval.py
# 4. Or test interactive query steering
python3 steer_db.py --query "Fetch customer orders with user email and product name." --mode all
Published artifacts
- Steering vectors: enterprise-100-qwen3-8b-steering-vectors
- Interactive experiment explorer: Enterprise-100 DB Steering Lab
- Base model: Qwen/Qwen3-8B
The vector repository separates reusable model artifacts from this dataset and
reproduction code. The free static Space exposes layer diagnostics, all saved
benchmark generations, execution outcomes, and the downloadable SQLite fixture.
Optional live H100 API
api/server.py exposes the real activation intervention as an authenticated,
generation-only FastAPI service. It never executes generated SQL or Python.
pip install -r api/requirements.txt
export STEERING_API_KEY="$(openssl rand -hex 32)"
export STEERING_CORS_ORIGINS="https://mayank-dubey-ai-enterprise-100-db-steering-lab.static.hf.space"
bash api/run.sh
Endpoints:
GET /healthPOST /v1/generateβ one layer/alpha configurationPOST /v1/compareβ negative, neutral, and positive steering
Example:
curl -H "Authorization: Bearer $STEERING_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query":"List orders with user email","strength":0.75,"layer":16}' \
http://127.0.0.1:8000/v1/compare
The current public quick-tunnel URL is temporary and has no uptime guarantee.
For durable deployment, use a named Cloudflare Tunnel or a managed inference
service and retain bearer authentication, concurrency limits, and request caps.