How to train your model dynamically using adversarial data

📰 Hugging Face Blog

Train models dynamically using adversarial data for improved robustness

intermediate Published 16 Jul 2022
Action Steps
  1. Collect adversarial data by having humans create examples to fool state-of-the-art models
  2. Use the collected data to further train the model
  3. Repeat the process over multiple rounds to achieve a more robust model
  4. Configure and interact with the model to optimize performance
Who Needs to Know This

Machine learning engineers and data scientists can benefit from this approach to improve model performance and robustness

Key Insight

💡 Dynamic adversarial data collection can help mitigate issues with static benchmarks and improve model trustworthiness

Share This
🚀 Improve model robustness with dynamic adversarial data collection!

Key Takeaways

Train models dynamically using adversarial data for improved robustness

Full Article

Published Time: 2022-07-16T00:00:00.104Z

# How to train your model dynamically using adversarial data

[![Image 1: Hugging Face's logo](https://huggingface.co/front/assets/huggingface_logo-noborder.svg)Hugging Face](https://huggingface.co/)

* [Models](https://huggingface.co/models)
* [Datasets](https://huggingface.co/datasets)
* [Spaces](https://huggingface.co/spaces)
* [Buckets new](https://huggingface.co/storage)
* [Docs](https://huggingface.co/docs)
* [Enterprise](https://huggingface.co/enterprise)
* [Pricing](https://huggingface.co/pricing)
*
*
* * *

* [Log In](https://huggingface.co/login)
* [Sign Up](https://huggingface.co/join)

[Back to Articles](https://huggingface.co/blog)

# [](https://huggingface.co/blog/mnist-adversarial#how-to-train-your-model-dynamically-using-adversarial-data) How to train your model dynamically using adversarial data

Published July 16, 2022

[Update on GitHub](https://github.com/huggingface/blog/blob/main/mnist-adversarial.md)

[- [x] Upvote -](https://huggingface.co/login?next=%2Fblog%2Fmnist-adversarial)

[![Image 2: Chris Emezue's avatar](https://cdn-avatars.huggingface.co/v1/production/uploads/1634562259269-5fbfa21ec153e968e63deb56.jpeg)](https://huggingface.co/chrisjay)

[Chris Emezue chrisjay Follow](https://huggingface.co/chrisjay)

##### [](https://huggingface.co/blog/mnist-adversarial#what-you-will-learn-here) What you will learn here

* 💡the basic idea of dynamic adversarial data collection and why it is important.
* ⚒ how to collect adversarial data dynamically and train your model on them - using an MNIST handwritten digit recognition task as an example.

## * [Dynamic adversarial data collection (DADC)](https://huggingface.co/blog/mnist-adversarial#dynamic-adversarial-data-collection-dadc "Dynamic adversarial data collection (DADC)")

* [Training your model dynamically using adversarial data](https://huggingface.co/blog/mnist-adversarial#training-your-model-dynamically-using-adversarial-data "Training your model dynamically using adversarial data")
* [Configuring your model](https://huggingface.co/blog/mnist-adversarial#configuring-your-model "Configuring your model")

* [Interacting with your model](https://huggingface.co/blog/mnist-adversarial#interacting-with-your-model "Interacting with your model")

* [Flagging your model](https://huggingface.co/blog/mnist-adversarial#flagging-your-model "Flagging your model")

* [Putting it all together](https://huggingface.co/blog/mnist-adversarial#putting-it-all-together "Putting it all together")

* [Conclusion](https://huggingface.co/blog/mnist-adversarial#conclusion "Conclusion")

[](https://huggingface.co/blog/mnist-adversarial#dynamic-adversarial-data-collection-dadc) Dynamic adversarial data collection (DADC)

Static benchmarks, while being a widely-used way to evaluate your model's performance, are fraught with many issues: they saturate, have biases or loopholes, and often lead researchers to chase increment in metrics instead of building trustworthy models that can be used by humans [1](https://dynabench.org/about).

Dynamic adversarial data collection (DADC) holds great promise as an approach to mitigate some of the issues of static benchmarks. In DADC, humans create examples to _fool_ state-of-the-art (SOTA) models. This process offers two benefits:

1. it allows users to gauge how robust their models really are;
2. it yields data that may be used to further train even stronger models.

This process of fooling and training the model on the adversarially collected data is repeated over multiple rounds leading to a more robust model that is aligned with humans[1](https://aclanthology.org/2022.findings-acl.18.pdf).

## [](https://huggingface.co/blog/mnist-adversarial#training-your-model-dynamically-using-adversarial-data) Training your model dynamically using adversarial data

Here I will walk you through dynamically collecting adversarial data from users and train
Read full article → ← Back to Reads