Improve model card for TDDBench MLP Target Model

#1
by nielsr HF Staff - opened
Files changed (1) hide show
  1. README.md +121 -132
README.md CHANGED
@@ -1,199 +1,188 @@
1
  ---
2
  library_name: transformers
3
- tags: []
 
 
 
 
 
 
4
  ---
5
 
6
- # Model Card for Model ID
7
 
8
- <!-- Provide a quick summary of what the model is/does. -->
9
 
 
10
 
 
11
 
12
  ## Model Details
13
 
14
  ### Model Description
15
 
16
- <!-- Provide a longer summary of what this model is. -->
17
 
18
- This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
 
 
 
19
 
20
- - **Developed by:** [More Information Needed]
21
- - **Funded by [optional]:** [More Information Needed]
22
- - **Shared by [optional]:** [More Information Needed]
23
- - **Model type:** [More Information Needed]
24
- - **Language(s) (NLP):** [More Information Needed]
25
- - **License:** [More Information Needed]
26
- - **Finetuned from model [optional]:** [More Information Needed]
27
 
28
- ### Model Sources [optional]
29
-
30
- <!-- Provide the basic links for the model. -->
31
-
32
- - **Repository:** [More Information Needed]
33
- - **Paper [optional]:** [More Information Needed]
34
- - **Demo [optional]:** [More Information Needed]
35
 
36
  ## Uses
37
 
38
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
-
40
  ### Direct Use
41
 
42
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
-
44
- [More Information Needed]
 
45
 
46
- ### Downstream Use [optional]
47
-
48
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
49
 
50
- [More Information Needed]
 
 
 
51
 
52
- ### Out-of-Scope Use
53
 
54
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
 
 
 
 
55
 
56
- [More Information Needed]
57
 
58
- ## Bias, Risks, and Limitations
59
 
60
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
 
62
- [More Information Needed]
63
 
64
- ### Recommendations
65
 
66
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
 
 
 
 
67
 
68
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
 
70
- ## How to Get Started with the Model
 
 
 
71
 
72
- Use the code below to get started with the model.
 
 
 
 
 
 
 
 
 
73
 
74
- [More Information Needed]
75
 
76
- ## Training Details
 
 
 
 
 
77
 
78
- ### Training Data
79
 
80
- <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
 
 
 
 
81
 
82
- [More Information Needed]
 
 
 
83
 
84
- ### Training Procedure
 
 
85
 
86
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
 
87
 
88
- #### Preprocessing [optional]
 
 
 
89
 
90
- [More Information Needed]
 
 
91
 
 
92
 
93
- #### Training Hyperparameters
94
 
95
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
 
97
- #### Speeds, Sizes, Times [optional]
98
 
99
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
 
101
- [More Information Needed]
102
 
103
  ## Evaluation
104
 
105
- <!-- This section describes the evaluation protocols and provides the results. -->
106
-
107
  ### Testing Data, Factors & Metrics
108
 
109
- #### Testing Data
110
 
111
- <!-- This should link to a Dataset Card if possible. -->
112
 
113
- [More Information Needed]
114
 
115
  #### Factors
116
 
117
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
-
119
- [More Information Needed]
 
120
 
121
  #### Metrics
122
 
123
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
-
125
- [More Information Needed]
 
 
 
126
 
127
  ### Results
128
 
129
- [More Information Needed]
130
-
131
- #### Summary
132
-
133
-
134
-
135
- ## Model Examination [optional]
136
-
137
- <!-- Relevant interpretability work for the model goes here -->
138
-
139
- [More Information Needed]
140
-
141
- ## Environmental Impact
142
-
143
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
-
145
- Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
-
147
- - **Hardware Type:** [More Information Needed]
148
- - **Hours used:** [More Information Needed]
149
- - **Cloud Provider:** [More Information Needed]
150
- - **Compute Region:** [More Information Needed]
151
- - **Carbon Emitted:** [More Information Needed]
152
-
153
- ## Technical Specifications [optional]
154
-
155
- ### Model Architecture and Objective
156
-
157
- [More Information Needed]
158
-
159
- ### Compute Infrastructure
160
-
161
- [More Information Needed]
162
-
163
- #### Hardware
164
-
165
- [More Information Needed]
166
-
167
- #### Software
168
-
169
- [More Information Needed]
170
-
171
- ## Citation [optional]
172
-
173
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
-
175
- **BibTeX:**
176
-
177
- [More Information Needed]
178
-
179
- **APA:**
180
-
181
- [More Information Needed]
182
-
183
- ## Glossary [optional]
184
-
185
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
-
187
- [More Information Needed]
188
-
189
- ## More Information [optional]
190
-
191
- [More Information Needed]
192
-
193
- ## Model Card Authors [optional]
194
 
195
- [More Information Needed]
196
 
197
- ## Model Card Contact
198
 
199
- [More Information Needed]
 
 
 
 
 
 
 
 
1
  ---
2
  library_name: transformers
3
+ license: apache-2.0
4
+ pipeline_tag: other
5
+ tags:
6
+ - benchmark
7
+ - training-data-detection
8
+ - membership-inference
9
+ - computer-security
10
  ---
11
 
12
+ # TDDBench: MLP Target Model (Student Dataset)
13
 
14
+ This repository hosts `mlp-student-0`, a specific target model checkpoint released as part of **TDDBench: A Benchmark for Training data detection**. TDDBench is a comprehensive benchmark designed to thoroughly evaluate the effectiveness of Training Data Detection (TDD) methods, which are also known as Membership Inference Attacks (MIA).
15
 
16
+ The paper introducing TDDBench highlights TDD's importance in assessing training data breach risks, ensuring copyright authentication, and verifying model unlearning. It consists of 13 datasets spanning three data modalities (image, tabular, and text) and benchmarks 21 different TDD methods across four detection paradigms. This specific `mlp-student-0` model is a Multi-Layer Perceptron (MLP) architecture trained on the "student" dataset, serving as one of the many target models for TDD evaluation within the benchmark.
17
 
18
+ Through TDDBench, researchers can identify bottlenecks and areas for improvement in TDD algorithms, while practitioners can make informed trade-offs between effectiveness and efficiency. Extensive experiments also reveal the generally unsatisfactory performance of TDD algorithms across different datasets, indicating a need for continued research.
19
 
20
  ## Model Details
21
 
22
  ### Model Description
23
 
24
+ This model (`mlp-student-0`) is an MLP (Multi-Layer Perceptron) architecture trained specifically on the `student` dataset. It is one of the target models released within the TDDBench framework. To reduce statistical error during evaluations, five different target models are trained for each model architecture and training dataset combination. This particular model is one such instance, identified by `model_idx=0`.
25
 
26
+ - **Developed by:** Zhihao Zhu, Yi Yang, Defu Lian
27
+ - **Model type:** Target Model for Training Data Detection Benchmark (MLP)
28
+ - **Language(s):** English (for relevant text datasets)
29
+ - **License:** Apache 2.0
30
 
31
+ ### Model Sources
 
 
 
 
 
 
32
 
33
+ - **Paper:** [TDDBench: A Benchmark for Training data detection](https://huggingface.co/papers/2411.03363)
34
+ - **GitHub Repository (Official Implementation):** [https://github.com/TDDBench/TDDBench](https://github.com/TDDBench/TDDBench)
35
+ - **Related Hugging Face Collection:** You can find more models and datasets related to TDDBench on the [TDDBench Hugging Face organization page](https://huggingface.co/TDDBench).
 
 
 
 
36
 
37
  ## Uses
38
 
 
 
39
  ### Direct Use
40
 
41
+ This specific target model, `mlp-student-0`, is intended for researchers and practitioners to:
42
+ - Serve as a pre-trained target model for evaluating Training Data Detection (TDD) methods within the TDDBench framework.
43
+ - Facilitate the reproduction of experiments described in the TDDBench paper.
44
+ - Be used as a component in developing and testing new TDD algorithms.
45
 
46
+ ### Out-of-Scope Use
 
 
47
 
48
+ This model is not intended for:
49
+ - Direct deployment as a privacy auditing tool without further research, validation, and consideration of its limitations.
50
+ - General machine learning tasks outside the context of Training Data Detection benchmarking.
51
+ - Making definitive claims about data privacy risks without a thorough understanding of TDD algorithm limitations.
52
 
53
+ ## Bias, Risks, and Limitations
54
 
55
+ Extensive experiments with TDDBench reveal that the performance of TDD algorithms is generally unsatisfactory across different datasets. This highlights that current TDD methods may not be universally robust or effective. Key limitations noted in the paper include:
56
+ - **Performance Gaps:** Significant performance differences exist between different types of TDD algorithms.
57
+ - **Computational Costs:** Model-based TDD methods often outperform others but incur high computational costs due to the need for multiple reference models.
58
+ - **Architecture Dependency:** The performance of TDD highly depends on knowing the underlying target model architecture, suffering degradation in the case of an unknown target model.
59
+ - **No Universal Winner:** There is no single TDD algorithm that consistently outperforms others across all scenarios.
60
 
61
+ ### Recommendations
62
 
63
+ Users of this model and the TDDBench benchmark should carefully consider these limitations. When selecting or developing TDD algorithms, it is crucial to balance detection performance with computational efficiency based on specific real-world conditions. Further research is needed to develop more robust and generalizable TDD methods.
64
 
65
+ ## How to Get Started with the Model
66
 
67
+ This model is designed to be loaded and used in conjunction with the TDDBench codebase to perform Training Data Detection evaluations.
68
 
69
+ First, ensure you have the `transformers` and `datasets` libraries installed, and that the `hfmodel.py` file from the TDDBench GitHub repository (which defines `MLPConfig` and `MLPHFModel`) is accessible in your Python environment. You might need to install additional dependencies as specified in the [TDDBench `requirements.txt`](https://raw.githubusercontent.com/TDDBench/TDDBench/main/requirements.txt).
70
 
71
+ ```bash
72
+ pip install transformers datasets
73
+ # For custom model architectures from TDDBench:
74
+ # pip install -r https://raw.githubusercontent.com/TDDBench/TDDBench/main/requirements.txt
75
+ ```
76
 
77
+ To load this target model and its corresponding training data detection labels, you can use the `transformers` library:
78
 
79
+ ```python
80
+ import numpy as np
81
+ from datasets import load_dataset
82
+ from transformers import AutoConfig, AutoModel
83
 
84
+ # IMPORTANT: You need to ensure MLPConfig and MLPHFModel are imported or defined.
85
+ # These custom classes are part of the TDDBench repository (e.g., in hfmodel.py).
86
+ # If you cloned the TDDBench repository, ensure the 'benchmark/basic' directory
87
+ # is in your Python path, or copy `hfmodel.py` to your working directory.
88
+ try:
89
+ from hfmodel import MLPConfig, MLPHFModel, WRNConfig, WRNHFModel
90
+ except ImportError:
91
+ print("Warning: hfmodel classes not found. Ensure TDDBench 'hfmodel.py' is accessible or use trust_remote_code=True.")
92
+ # Fallback for demonstration if hfmodel is not locally available
93
+ # For actual usage, it's recommended to make hfmodel.py available.
94
 
 
95
 
96
+ # Register custom model architectures so AutoModel can load them
97
+ # This is crucial for models with custom architectures like MLPHFModel.
98
+ AutoConfig.register("mlp", MLPConfig)
99
+ AutoModel.register(MLPConfig, MLPHFModel)
100
+ AutoConfig.register("wrn", WRNConfig) # Assuming WRN is also a model type
101
+ AutoModel.register(WRNConfig, WRNHFModel)
102
 
 
103
 
104
+ # Load the target model
105
+ dataset_name = "student" # The training dataset name for this model
106
+ model_name = "mlp" # The target model architecture (e.g., "mlp", "wrn")
107
+ model_idx = 0 # Index of this specific model (0-4 available for each architecture/dataset combo)
108
+ model_path = f"TDDBench/{model_name}-{dataset_name}-{model_idx}"
109
 
110
+ # Use trust_remote_code=True if the custom model definition (e.g., MLPHFModel)
111
+ # is not locally available in your environment, allowing Hugging Face to load it from the Hub.
112
+ model = AutoModel.from_pretrained(model_path, trust_remote_code=True)
113
+ model.eval() # Set model to evaluation mode
114
 
115
+ # Load training data detection label (1 means model's training data, 0 means non-training data)
116
+ config = AutoConfig.from_pretrained(model_path)
117
+ tdd_label = np.array(config.tdd_label)
118
 
119
+ print(f"Model loaded: {model_path}")
120
+ print(f"Shape of TDD label: {tdd_label.shape}")
121
 
122
+ # You can also load the corresponding dataset from the Hub
123
+ dataset_path = f"TDDBench/{dataset_name}"
124
+ dataset = load_dataset(dataset_path)["train"]
125
+ print(f"Sample dataset loaded: {len(dataset)} examples")
126
 
127
+ # Refer to the demo.ipynb file in the official TDDBench GitHub repository for a complete example
128
+ # on how to use these components to record model output loss for training and non-training data.
129
+ ```
130
 
131
+ ## Training Details
132
 
133
+ ### Training Data
134
 
135
+ The TDDBench benchmark utilizes 13 datasets spanning three data modalities: image, tabular, and text. These datasets are sourced from torchvision, Hugging Face, UCI Machine Learning Repository, and academic papers. Some datasets, particularly from torchvision and UCI, can be downloaded automatically, while others may require manual download.
136
 
137
+ ### Training Procedure
138
 
139
+ The TDDBench framework provides scripts (e.g., `train_base_model.sh`) to train target, shadow, and reference models that are used in the TDD evaluation. The checkpoints of these models, along with the indexes of their training data, are stored in the `benchmark/meta_log` folder of the main repository.
140
 
141
+ The specific training parameters for both the target models (like this MLP model) and the TDD algorithms are detailed in the accompanying paper and can be easily adjusted in the `benchmark/configs` directory of the GitHub repository.
142
 
143
  ## Evaluation
144
 
 
 
145
  ### Testing Data, Factors & Metrics
146
 
147
+ TDDBench evaluates 21 different TDD algorithms across a variety of settings.
148
 
149
+ #### Testing Data
150
 
151
+ The benchmark includes 13 distinct datasets.
152
 
153
  #### Factors
154
 
155
+ Evaluations are disaggregated by several factors:
156
+ - **Algorithm Type:** TDD algorithms are categorized into four types: metric-based, learning-based, model-based, and query-based.
157
+ - **Model Architecture:** Results are presented for 11 different model architectures.
158
+ - **Data Modality:** Evaluations span image, tabular, and text data.
159
 
160
  #### Metrics
161
 
162
+ Performance is evaluated from five key perspectives:
163
+ - Average detection performance (e.g., AUC, accuracy)
164
+ - Best detection performance
165
+ - Memory consumption
166
+ - Computational efficiency (in terms of time)
167
+ - Computational efficiency (in terms of memory)
168
 
169
  ### Results
170
 
171
+ The paper "TDDBench: A Benchmark for Training data detection" provides extensive experimental results. Key findings include:
172
+ - Significant performance gaps between different TDD algorithm types, with model-based methods generally outperforming others despite higher computational costs.
173
+ - The memorization of training data is crucial for TDD algorithm performance, with larger target models typically exhibiting higher success rates.
174
+ - Performance degradation occurs when the underlying target model architecture is unknown.
175
+ - No single TDD method emerges as a clear "winner" across all scenarios, emphasizing the need for testers to balance performance and efficiency based on real-world conditions.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
 
177
+ ## Citation
178
 
179
+ If you find TDDBench or this model checkpoint useful for your research, please consider citing the original paper:
180
 
181
+ ```bibtex
182
+ @article{zhu2024tddbench,
183
+ title={TDDBench: A Benchmark for Training data detection},
184
+ author={Zhu, Zhihao and Yang, Yi and Lian, Defu},
185
+ journal={arXiv preprint arXiv:2411.03363},
186
+ year={2024}
187
+ }
188
+ ```