File size: 8,620 Bytes
83ff8cf
 
 
 
 
 
 
 
 
 
659b559
83ff8cf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24801a1
 
 
659b559
 
 
83ff8cf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
659b559
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83ff8cf
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
---

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](https://img.shields.io/badge/arXiv-Paper-B31B1B?logo=arxiv&logoColor=white)](https://arxiv.org/abs/2604.01444)
[![Model](https://img.shields.io/badge/Hugging%20Face-Model-FFD21E?logo=huggingface&logoColor=FFD21E)](https://huggingface.co/EddyLuo/FoodGuard-4B)
[![Dataset](https://img.shields.io/badge/Hugging%20Face-Dataset-FFD21E?logo=huggingface&logoColor=FFD21E)](https://huggingface.co/datasets/EddyLuo/FoodGuardBench)

This repository provides an expanded release of FoodGuardBench, introduced in *[Cooking Up Risks: Benchmarking and Reducing Food Safety Risks in Large Language Models](https://arxiv.org/abs/2604.01444)*. 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

```sh

python -m pip install datasets

```

```python

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`](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](https://www.fda.gov/food/fda-food-code/food-code-2022), [full document](https://www.fda.gov/files/food/published/FDA-FoodCode2022-FullDocument-01182023_0.pdf).

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.

```python

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](https://huggingface.co/EddyLuo/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:

```bibtex

@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.