Downloads · 30 days
53
11% of all-time downloads
vineeth453/qwen3-4b-guardrails-embedding-v1
qwen3-4b-guardrails-embedding-v1 is a sentence similarity model from vineeth453. Use it when you need a score for how close two texts are. It is set up for sentence-transformers. The card lists the license as apache-2.0.
Fine-tuned from Qwen/Qwen3-Embedding-4B for regulatory document retrieval as part of a Multi-Agent Debate (MAD) Guardrails system developed at SJSU.
Downloads · 30 days
53
11% of all-time downloads
All-time downloads
498
Public
Parameters
4B
8.1 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors8 GB · 100%
From the Hugging Face model README
Fine-tuned from Qwen/Qwen3-Embedding-4B for regulatory document retrieval as part of a Multi-Agent Debate (MAD) Guardrails system developed at SJSU.
This model serves as the retrieval backbone in a RAG pipeline that provides ground truth for agent debates on AI governance and regulatory compliance.
| Property | Value |
|---|---|
| Base model | Qwen/Qwen3-Embedding-4B |
| Architecture | Decoder-only (Qwen3), last-token pooling |
| Embedding dimension | 2560 |
| Max sequence length | 512 |
| Fine-tuning method | LoRA (r=16, alpha=32) merged into base |
| Pooling | Last token + L2 normalization |
| Parameter | Value |
|---|---|
| Training records | 13,572 synthetic query-chunk pairs |
| Data domain | AI regulatory documents |
| Documents covered | EU AI Act, NIST AI RMF GenAI Profile, NIS2, Cyber Resilience Act, DORA, NIST CSF 2.0, NIST SP 1270 |
| Query types | benign_sensitive, ambiguous, adversarial |
| Loss | MultipleNegativesRankingLoss |
| Hard negatives | 1 per example (mined from rank 6-50 via MiniLM) |
| Epochs | 3 |
| Batch size | 4 (effective 16 with grad accum=4) |
| Learning rate | 1e-4 with cosine decay |
| Warmup ratio | 0.1 |
| LoRA rank | 16 |
| LoRA alpha | 32 |
| LoRA dropout | 0.05 |
| LoRA targets | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| Hardware | NVIDIA A100 SXM4 40GB |
| Training time | ~2.5 hours |
Evaluated on a 4-candidate reranking task (1 positive + 3 hard negatives) with 864 val / 864 test samples.
| Split | recall@1 | recall@3 | MRR |
|---|---|---|---|
| Validation | 0.9479 | 1.0000 | 0.9732 |
| Test | 0.9745 | 1.0000 | 0.9869 |
| Query Type | recall@1 | recall@3 | MRR |
|---|---|---|---|
| benign_sensitive | 0.9479 | 1.0000 | 0.9734 |
| ambiguous | 0.9583 | 1.0000 | 0.9792 |
| adversarial | 0.9375 | 1.0000 | 0.9670 |
| Query Type | recall@1 | recall@3 | MRR |
|---|---|---|---|
| benign_sensitive | 0.9826 | 1.0000 | 0.9913 |
| ambiguous | 0.9826 | 1.0000 | 0.9902 |
| adversarial | 0.9583 | 1.0000 | 0.9792 |
from sentence_transformers import SentenceTransformer
model = SentenceTransformer(
"vineeth453/qwen3-4b-guardrails-embedding-v1",
trust_remote_code=True
)
model.max_seq_length = 512
# Queries require the instruction prefix
QUERY_INSTRUCTION = (
"Instruct: Retrieve relevant regulatory passage to answer the query\n"
"Query: "
)
# Passages are encoded without any prefix
query = QUERY_INSTRUCTION + "What are the documentation requirements for high-risk AI systems?"
chunks = [
"EU AI Act Article 11 requires providers of high-risk AI systems to draw up technical documentation...",
"NIST AI RMF suggests organizations establish governance structures for AI risk management..."
]
query_emb = model.encode([query], normalize_embeddings=True)
chunk_emb = model.encode(chunks, normalize_embeddings=True)
scores = query_emb @ chunk_emb.T
print(scores)
Important: Always apply the instruction prefix to queries. Chunks/passages are encoded without any prefix. Consistency between fine-tuning and inference is critical for performance.
This model is part of the SJSU Guardrails Project — a system for evaluating AI agent outputs against regulatory ground truth using Multi-Agent Debate (MAD) orchestration.
Pipeline: User query → RAG retrieval (this model) → Ground truth chunks → Agent debate → Guardrail verdict
Apache 2.0 — same as base model.