Run this model with HF Jobs
Run MaojieXu/WebPromptFilter-UltraBERT-150M-NF4 on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/MaojieXu/WebPromptFilter-UltraBERT-150M-NF4. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/MaojieXu/WebPromptFilter-UltraBERT-150M-NF4 on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use MaojieXu/WebPromptFilter-UltraBERT-150M-NF4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MaojieXu/WebPromptFilter-UltraBERT-150M-NF4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="MaojieXu/WebPromptFilter-UltraBERT-150M-NF4", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("MaojieXu/WebPromptFilter-UltraBERT-150M-NF4", trust_remote_code=True) model = AutoModelForTokenClassification.from_pretrained("MaojieXu/WebPromptFilter-UltraBERT-150M-NF4", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
WebPromptFilter UltraBERT-150M NF4
This is an experimental task-conditioned HTML prompt-injection filter. It is a token-classification model fine-tuned from UltraBERT-150M, then quantized with bitsandbytes NF4. Use the WebPromptFilter project for input preparation, fragment-to-line aggregation and extractive filtering; raw token predictions alone do not implement the filter.
Training data and attribution
The model was trained for 3,000 optimizer steps using the HTML representation of the training partition of BrowseSafe++, by Yuetian Chen and colleagues. The source training partition is licensed under CC BY 4.0; our preparation generates line labels and chunks from the dataset. The prepared train and internal test splits are published separately. See the dataset documentation and citation for attribution and full terms. The internal test split is derived from the public training partition, and is not the separately licensed official test split.
The upstream UltraBERT model is published under Apache-2.0. These attribution statements do not replace the applicable terms for the model, training data, or dependencies.
Quantization and requirements
The 24 Transformer layers' attention and feed-forward projections (168 linear layers) use 4-bit NF4 weights with BF16 compute and no double quantization. Embeddings, normalization layers, and classifier remain FP32. The tested environment used PyTorch 2.15.0+cu132, Transformers 5.24.1 and bitsandbytes 0.50.2 on an NVIDIA RTX 4090 D. The project's NF4 loader requires a compatible CUDA GPU; see the project documentation for environment setup.
Download the repository to outputs/training-full-3000-nf4 using hf download; the project's loader currently reads local files only. Do not interpret the output as a generative model response.
Internal evaluation and limitations
On an internal held-out split of 5,900 pages (2,950 pairs), with threshold 0.5 and batch size 32, the recorded NF4 evaluation reported line F1 0.9981 (5 false-negative and 202 false-positive lines), page F1 0.9926, and 44 changed clean pages out of 2,950. Injection annotation character coverage was 0.99995. These are results for this specific internal split, not the official BrowseSafe++ leaderboard, and do not establish protection against unseen or adaptive attacks. Filtering can remove benign content or miss malicious instructions; independent evaluation is necessary for each deployment.
References
- Downloads last month
- 34
Model tree for MaojieXu/WebPromptFilter-UltraBERT-150M-NF4
Base model
dmis-lab/UltraBERT-150M