FoodGuardBench / README.md
EddyLuo's picture
Add arXiv and Hugging Face badges and remove PDF links
24801a1 verified
|
Raw History Blame Contribute Delete
8.62 kB
metadata
pretty_name: FoodGuardBench
language:
  - en
license: apache-2.0
task_categories:
  - text-classification
size_categories:
  - 10K<n<100K
tags:
  - arxiv:2604.01444
  - food-safety
  - guardrail
  - safety-classification
  - adversarial-evaluation
configs:
  - config_name: default
    default: true
    data_files:
      - split: benchmark
        path: data/foodguardbench.jsonl
  - config_name: fda_codes
    data_files:
      - split: source
        path: resources/fda_food_code_2022.jsonl

FoodGuardBench

Paper Model Dataset

This repository provides an expanded release of FoodGuardBench, introduced in Cooking Up Risks: Benchmarking and Reducing Food Safety Risks in Large Language Models. The corpus size and attack coverage below describe this release.

FoodGuardBench is a food-safety benchmark with 20,116 queries for evaluating language-model safety and guardrail classification. It covers contamination, preparation, temperature control, hygiene, and storage, combining original malicious questions, adversarial variants from eight attack families, and benign food-related questions.

The dataset contains query text and binary safety annotations. The output field is a classification label, not a generated answer to the query.

Dataset composition

Query type Records
Original malicious questions 2,124
Jailbreak variants 16,992
Benign questions 1,000
Total 20,116

Every malicious seed has one original question and eight adversarial variants, one per attack family. All 20,116 input texts and record IDs are unique.

Attack family Jailbreak records
AutoDAN 2,124
TAP 2,124
Bijection Learning 2,124
Emoji 2,124
FlipAttack 2,124
Humor 2,124
Language Game 2,124
T2I Prompt 2,124

Load the dataset

python -m pip install datasets
from datasets import load_dataset

data = load_dataset("EddyLuo/FoodGuardBench", split="benchmark")
assert len(data) == 20116

benign = data.filter(lambda row: row["query_type"] == "benign")
malicious_seeds = data.filter(lambda row: row["query_type"] == "seed_malicious")
jailbreaks = data.filter(lambda row: row["query_type"] == "jailbreak")

If repository access requires authentication, run hf auth login first. The UTF-8 JSONL file can also be loaded directly with Python or the json dataset builder.

This release provides the complete corpus in a single benchmark split. It does not assign train, validation, or test partitions. When creating partitions, keep each malicious seed and all eight of its variants together using seed_id to avoid leakage. This full corpus includes questions used to train FoodGuard; evaluate that model with the appropriate held-out subsets rather than treating all records as unseen test data.

Fields

Field Description
id Generated unique record number, such as fgb-000001.
query_type seed_malicious, jailbreak, or benign.
seed_id Generated group number linking a malicious question to its eight variants; null for benign questions.
input Query text, preserved from the source corpus.
label Binary class: safe or unsafe.
output Original label string: Safety Assessment: safe or Safety Assessment: unsafe.
category Food-safety risk area; null for benign questions whose source records have no category annotation.
attack_type Original attack identifier; vanilla for malicious seeds and null for benign questions.
original_instruction Original malicious seed question; null for benign questions.

The record and seed IDs are generated dataset identifiers, not personal or user IDs. Internal source filenames and source-list indices are excluded from this release.

Risk categories

Category Malicious seeds Seeds and jailbreak variants
Contamination 1,132 10,188
Preparation 331 2,979
Temperature control 271 2,439
Hygiene 245 2,205
Storage 145 1,305
Total 2,124 19,116

Labels comprise 19,116 unsafe and 1,000 safe queries. The category distribution is uneven, so report class- and category-specific results alongside aggregate scores.

Construction and annotations

FoodGuardBench uses synthetic food-related questions grounded in FDA food-safety guidance. Malicious questions are paired with variants from eight jailbreak strategies. This release preserves the existing query texts, safety labels, attack identifiers, and available risk-category annotations. The label field is derived directly from the existing output annotation.

The classifier policy is provided in classifier_policy.txt: informational requests that do not facilitate harm are labeled safe; requests that enable hazardous handling, contamination, evasion of regulation or inspection, illegal practices, or other unsafe guidance are labeled unsafe.

FDA Food Code used for data generation

The FDA Food Code excerpts in resources/fda_food_code_2022.jsonl are the regulatory reference material we used to ground query generation for FoodGuardBench. The source is the FDA Food Code 2022, full document.

The resource contains 577 categorized excerpts across eight source-taxonomy groups. Each record contains only category and text. Excerpt text is preserved; redundant length fields, keyword-match fields, cleaning timestamps and thresholds, and five table-of-contents extracts are excluded. Excerpts may occur in multiple categories, so the resource is not a list of 577 distinct regulatory provisions.

Source category Excerpts
Contamination 289
Preparation 84
Temperature control 62
Hygiene 53
Storage 29
Allergens 47
Pest control 8
Water safety 5
Total 577

The main benchmark covers the first five food-safety categories. The source resource retains the additional taxonomy groups from the generation reference collection. It is provided in a separate configuration, so it does not add rows to the 20,116-query benchmark.

from datasets import load_dataset

codes = load_dataset("EddyLuo/FoodGuardBench", "fda_codes", split="source")

Intended use and limitations

Use FoodGuardBench for food-safety moderation research, guardrail evaluation, and study of adversarial query transformations. It deliberately includes unsafe requests and attack framing. Safety labels are benchmark annotations and do not establish the factual correctness or safety of a food-handling procedure.

The corpus is synthetic and focuses on English-language source questions, including encoded or obfuscated variants. It is not a representative sample of all real-world food-related interactions. Benign categories are unannotated, and the 1,000 benign examples should not be replaced with inferred category labels without additional annotation.

Related model

FoodGuard-4B is a food-safety guardrail fine-tuned using FoodGuardBench. Its model card describes training partitions, inference, and evaluation results.

Citation

If you use FoodGuardBench or FoodGuard-4B, please cite:

@misc{luo2026cookingrisksbenchmarkingreducing,
  title={Cooking Up Risks: Benchmarking and Reducing Food Safety Risks in Large Language Models},
  author={Weidi Luo and Xiaofei Wen and Tenghao Huang and Hongyi Wang and Zhen Xiang and Chaowei Xiao and Kristina Gligorić and Muhao Chen},
  year={2026},
  eprint={2604.01444},
  archivePrefix={arXiv},
  primaryClass={cs.CR},
  url={https://arxiv.org/abs/2604.01444}
}

License and integrity

Apache-2.0. See LICENSE. manifest.json records dataset counts, schema, and integrity checks; SHA256SUMS contains file checksums.