Paramir's picture
Clarify PromptGuard LR and verifier artifacts
78ffffe verified
|
Raw
History Blame Contribute Delete
5.5 kB
metadata
license: other
pipeline_tag: text-classification
tags:
  - promptguard
  - text-classification
  - privacy
  - dlp
  - korean
  - roberta
  - sklearn
  - logistic-regression
  - joblib
base_model:
  - klue/roberta-base

PromptGuard Context Classifier v287

This repository hosts the complete runtime artifact package for PromptGuard's context-risk classifier.

It contains both required runtime stages:

  • LR candidate generator: models/context_with_patch_v287_lr_c4_dev_classifier.joblib
  • RoBERTa verifier: models/context_verifier_klue_roberta_base_lrmined_v287_global002_compactv2_lpft_focal_1p2ep/model.safetensors

The Hugging Face base_model metadata points only to the fine-tuned verifier base, klue/roberta-base. The LR stage is a scikit-learn linear classifier over Qwen embedding vectors, so it has no Transformer base model of its own.

Runtime Architecture

PromptGuard uses a two-stage context classifier. This repository is a runtime artifact package, not a single Transformer checkpoint loaded from the repository root.

  1. Frozen Qwen embedding dependency + One-vs-Rest Logistic Regression candidate generator
  2. Fine-tuned KLUE RoBERTa label-aware verifier

The Logistic Regression stage is a high-recall linear candidate generator stored as a joblib artifact. It is not a fine-tuned Qwen model and does not have its own Hugging Face base model. It expects normalized embedding vectors produced by Qwen/Qwen3-Embedding-0.6B.

The RoBERTa verifier is the fine-tuned Transformer stage. Its base model is klue/roberta-base, and the fine-tuned verifier checkpoint is stored under models/context_verifier_klue_roberta_base_lrmined_v287_global002_compactv2_lpft_focal_1p2ep/.

Artifact Inventory

The runtime is complete only when all of these files are present:

Runtime part File
Source-of-truth manifest models/context_lr_roberta_active_best_f1_manifest.json
Target label list models/context_target_labels.json
Verifier label definitions models/context_label_definitions_verifier_compact_v2.json
LR candidate generator models/context_with_patch_v287_lr_c4_dev_classifier.joblib
RoBERTa verifier checkpoint models/context_verifier_klue_roberta_base_lrmined_v287_global002_compactv2_lpft_focal_1p2ep/model.safetensors
RoBERTa tokenizer/config models/context_verifier_klue_roberta_base_lrmined_v287_global002_compactv2_lpft_focal_1p2ep/*

If only the LR joblib file is downloaded, the PromptGuard context pipeline is incomplete. Download with --include "models/*" so both stages are available.

Files

Download the models/ directory into the PromptGuard project root. The application reads:

  • models/context_lr_roberta_active_best_f1_manifest.json
  • models/context_target_labels.json
  • models/context_label_definitions_verifier_compact_v2.json
  • models/context_with_patch_v287_lr_c4_dev_classifier.joblib
  • models/context_verifier_klue_roberta_base_lrmined_v287_global002_compactv2_lpft_focal_1p2ep/

models/SHA256SUMS contains checksums for the uploaded runtime files.

Target Labels

  • SECRET_CREDENTIAL_CONTEXT
  • PERSONAL_DATA_CONTEXT
  • FINANCIAL_IDENTIFIER_CONTEXT
  • CONFIDENTIAL_BUSINESS_CONTEXT
  • PROPRIETARY_TECHNICAL_CONTEXT
  • SECURITY_CONTROL_CONTEXT
  • INTERNAL_OPERATION_CONTEXT
  • BULK_SENSITIVE_RECORD_CONTEXT

Threshold Policy

The source-of-truth policy is stored in models/context_lr_roberta_active_best_f1_manifest.json.

  • LR candidate threshold: 0.02
  • Verifier threshold mode: label-wise
  • Verifier chunk policy: chunk_chars=900, chunk_overlap=120, max_chunks=8
  • Verifier pooling: max verifier score per label across chunks

Usage

From the PromptGuard repository root:

pip install "huggingface_hub[hf_xet]"
hf download OASecure/promptguard-context-classifier \
  --revision v287-20260623 \
  --include "models/*" \
  --local-dir .

Then enable the runtime:

PROMPTGUARD_CLASSIFIER_RUNTIME_ENABLED=true
PROMPTGUARD_CLASSIFIER_MANIFEST_PATH=/opt/promptguard/models/context_lr_roberta_active_best_f1_manifest.json
PROMPTGUARD_VERIFIER_RUNTIME_ENABLED=true
PROMPTGUARD_VERIFIER_MANIFEST_PATH=/opt/promptguard/models/context_lr_roberta_active_best_f1_manifest.json

Do not load this repository root directly with AutoModelForSequenceClassification.from_pretrained("OASecure/promptguard-context-classifier"). PromptGuard reads models/context_lr_roberta_active_best_f1_manifest.json, loads the LR joblib file for candidate generation, and loads the verifier directory named in that manifest for RoBERTa verification.

Data and Privacy

This repository contains runtime artifacts only. It does not include raw prompts, source documents, extracted text, filenames, training/evaluation detail rows, embedding vectors, logits, exact classifier scores, or full masked prompts.

License Notes

The PromptGuard application code is distributed separately on GitHub. These model artifacts are published for PromptGuard runtime use. Qwen/Qwen3-Embedding-0.6B is used as a frozen embedding dependency for the LR stage, not as the fine-tuned base model of this repository. klue/roberta-base is the verifier base model. Downstream users should review base-model and training-data obligations before redistribution or commercial use.

Limitations

This model is a context-risk classifier. It is not a complete DLP system by itself and does not replace PromptGuard's separate regex/span masking policy layer.