Coder Social home page Coder Social logo

auditing-text-generation's Introduction

Auditing Data Provenance in Text-Generation Models

This repository contains example of experiments for the paper Auditing Data Provenance in Text-Generation Models (https://arxiv.org/pdf/1811.00513.pdf/).

Train text-generation models

The first step is to train target and shadow text-generation models. To train language model, run the function train_reddit_lm in reddit_lm.py To train NMT model, run the function train_sated_nmt in sated_nmt.py To train dialog model, run the function train_cornell_movie in dialogue.py

To train multiple shadow models, set field exp_id=1,2,...n in above function, where n is the number of shadow models. Set cross_domain=True to use cross domain datasets for shadow models. An example script for training target model and 10 shadow models on reddit language model with 300 users' data:

train_reddit_lm(exp_id=None, cross_domain=False, num_users=300)  # target
for i in range(10):
  train_reddit_lm(exp_id=i, cross_domain=True, num_users=300)  # shadow i

Collect predictied ranks

The next step is to collect predicted ranks on the models we just trained. Use function get_target_ranks and get_shadow_ranks to collect the ranks in reddit_lm_ranks.py, sated_nmt_ranks.py and dialogue_ranks.py. An example script for collecting ranks on reddit language model:

get_target_ranks(num_users=300)  # target
for i in range(10):
  get_shadow_ranks(exp_id=i, cross_domain=True, num_users=300)  # shadow i

Auditing user membership

Finally, we can perform auditing on collected ranks. Use function user_mi_attack in auditing.py. For example, script for audting reddit language model:

user_mi_attack(data_name='reddit', num_exp=10, num_users=300, cross_domain=True)  # 10 shadow models, 300 users

data_name can be 'reddit', 'sated' and 'dialogs'.

auditing-text-generation's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.