paname 0.0.1.dev0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of paname might be problematic. Click here for more details.

Files changed (111) hide show
  1. paname-0.0.1.dev0/.gitignore +182 -0
  2. paname-0.0.1.dev0/CHANGELOG.md +23 -0
  3. paname-0.0.1.dev0/LICENSE +1 -0
  4. paname-0.0.1.dev0/LICENSES/CC0-1.0.txt +121 -0
  5. paname-0.0.1.dev0/LICENSES/MIT.txt +21 -0
  6. paname-0.0.1.dev0/PKG-INFO +226 -0
  7. paname-0.0.1.dev0/README.md +177 -0
  8. paname-0.0.1.dev0/README_FR.md +176 -0
  9. paname-0.0.1.dev0/paname_use_cases/apertus70b_canaries.py +48 -0
  10. paname-0.0.1.dev0/paname_use_cases/bert_wnut.py +163 -0
  11. paname-0.0.1.dev0/paname_use_cases/cifar10_mobilenet.py +148 -0
  12. paname-0.0.1.dev0/paname_use_cases/discoverable_extraction_wikipedia.py +943 -0
  13. paname-0.0.1.dev0/paname_use_cases/gpt2_imdb.py +58 -0
  14. paname-0.0.1.dev0/paname_use_cases/gpt2_imdb_overfit.py +79 -0
  15. paname-0.0.1.dev0/paname_use_cases/gpt2_wikitext.py +77 -0
  16. paname-0.0.1.dev0/paname_use_cases/ministrallm_fineweb_gguf.py +102 -0
  17. paname-0.0.1.dev0/paname_use_cases/ministrallm_fineweb_hf_lm.py +167 -0
  18. paname-0.0.1.dev0/paname_use_cases/ministrallm_fineweb_vllm_offline.py +108 -0
  19. paname-0.0.1.dev0/paname_use_cases/pleias1b_wtotext.py +91 -0
  20. paname-0.0.1.dev0/paname_use_cases/pythia_mimir.py +110 -0
  21. paname-0.0.1.dev0/paname_use_cases/random_forest_1m.py +34 -0
  22. paname-0.0.1.dev0/paname_use_cases/resnet18_cifar10_shadow.py +202 -0
  23. paname-0.0.1.dev0/paname_use_cases/sklearn_classifier_synthetic.py +43 -0
  24. paname-0.0.1.dev0/paname_use_cases/sklearn_regressor_synthetic.py +36 -0
  25. paname-0.0.1.dev0/paname_use_cases/utils/cifar10_helpers.py +157 -0
  26. paname-0.0.1.dev0/paname_use_cases/utils/huggingface_text_helpers.py +97 -0
  27. paname-0.0.1.dev0/paname_use_cases/utils/sklearn_helpers.py +199 -0
  28. paname-0.0.1.dev0/pyproject.toml +309 -0
  29. paname-0.0.1.dev0/src/paname/__init__.py +10 -0
  30. paname-0.0.1.dev0/src/paname/config.py +111 -0
  31. paname-0.0.1.dev0/src/paname/extraction_techniques/__init__.py +5 -0
  32. paname-0.0.1.dev0/src/paname/extraction_techniques/configurable.py +155 -0
  33. paname-0.0.1.dev0/src/paname/extraction_techniques/discoverable_extraction/__init__.py +20 -0
  34. paname-0.0.1.dev0/src/paname/extraction_techniques/discoverable_extraction/evaluation.py +437 -0
  35. paname-0.0.1.dev0/src/paname/extraction_techniques/discoverable_extraction/metrics.py +99 -0
  36. paname-0.0.1.dev0/src/paname/extraction_techniques/mia/__init__.py +35 -0
  37. paname-0.0.1.dev0/src/paname/extraction_techniques/mia/attack_model.py +588 -0
  38. paname-0.0.1.dev0/src/paname/extraction_techniques/mia/base.py +195 -0
  39. paname-0.0.1.dev0/src/paname/extraction_techniques/mia/gradient.py +129 -0
  40. paname-0.0.1.dev0/src/paname/extraction_techniques/mia/hop_skip_jump.py +460 -0
  41. paname-0.0.1.dev0/src/paname/extraction_techniques/mia/likelihood_ratio.py +204 -0
  42. paname-0.0.1.dev0/src/paname/extraction_techniques/mia/lira.py +422 -0
  43. paname-0.0.1.dev0/src/paname/extraction_techniques/mia/loss.py +122 -0
  44. paname-0.0.1.dev0/src/paname/extraction_techniques/mia/min_k_prob.py +172 -0
  45. paname-0.0.1.dev0/src/paname/extraction_techniques/mia/neighborhood.py +248 -0
  46. paname-0.0.1.dev0/src/paname/extraction_techniques/mia/noise_label_only.py +202 -0
  47. paname-0.0.1.dev0/src/paname/extraction_techniques/mia/perplexity.py +142 -0
  48. paname-0.0.1.dev0/src/paname/extraction_techniques/mia/reference_based.py +193 -0
  49. paname-0.0.1.dev0/src/paname/extraction_techniques/mia/rmia.py +592 -0
  50. paname-0.0.1.dev0/src/paname/extraction_techniques/mia/shadow_model_pool/__init__.py +5 -0
  51. paname-0.0.1.dev0/src/paname/extraction_techniques/mia/shadow_model_pool/base.py +305 -0
  52. paname-0.0.1.dev0/src/paname/extraction_techniques/mia/shadow_model_pool/local_model.py +122 -0
  53. paname-0.0.1.dev0/src/paname/extraction_techniques/mia/zlib.py +185 -0
  54. paname-0.0.1.dev0/src/paname/extraction_techniques/reconstruction/__init__.py +18 -0
  55. paname-0.0.1.dev0/src/paname/extraction_techniques/reconstruction/base.py +113 -0
  56. paname-0.0.1.dev0/src/paname/extraction_techniques/reconstruction/diffusion_clique.py +697 -0
  57. paname-0.0.1.dev0/src/paname/extraction_techniques/reconstruction/informed_adversary.py +569 -0
  58. paname-0.0.1.dev0/src/paname/extraction_techniques/reconstruction/llm_from_sampling.py +311 -0
  59. paname-0.0.1.dev0/src/paname/extraction_techniques/reconstruction/utils.py +332 -0
  60. paname-0.0.1.dev0/src/paname/io/__init__.py +10 -0
  61. paname-0.0.1.dev0/src/paname/io/dataset.py +414 -0
  62. paname-0.0.1.dev0/src/paname/io/huggingface.py +132 -0
  63. paname-0.0.1.dev0/src/paname/io/sklearn.py +190 -0
  64. paname-0.0.1.dev0/src/paname/io/torch.py +313 -0
  65. paname-0.0.1.dev0/src/paname/metrics/__init__.py +5 -0
  66. paname-0.0.1.dev0/src/paname/metrics/base.py +127 -0
  67. paname-0.0.1.dev0/src/paname/metrics/metrics.py +502 -0
  68. paname-0.0.1.dev0/src/paname/metrics/mia.py +159 -0
  69. paname-0.0.1.dev0/src/paname/metrics/reconstruction.py +923 -0
  70. paname-0.0.1.dev0/src/paname/mia_runner.py +91 -0
  71. paname-0.0.1.dev0/src/paname/perturbators/__init__.py +5 -0
  72. paname-0.0.1.dev0/src/paname/perturbators/base.py +140 -0
  73. paname-0.0.1.dev0/src/paname/perturbators/gaussian.py +114 -0
  74. paname-0.0.1.dev0/src/paname/perturbators/hsja.py +440 -0
  75. paname-0.0.1.dev0/src/paname/perturbators/text_neighbors.py +321 -0
  76. paname-0.0.1.dev0/src/paname/py.typed +0 -0
  77. paname-0.0.1.dev0/src/paname/reporting/__init__.py +8 -0
  78. paname-0.0.1.dev0/src/paname/reporting/lang.py +519 -0
  79. paname-0.0.1.dev0/src/paname/reporting/report.py +1618 -0
  80. paname-0.0.1.dev0/src/paname/scripts/__init__.py +54 -0
  81. paname-0.0.1.dev0/src/paname/scripts/discoverable_extraction.py +124 -0
  82. paname-0.0.1.dev0/src/paname/scripts/mia.py +274 -0
  83. paname-0.0.1.dev0/src/paname/scripts/reconstruction.py +214 -0
  84. paname-0.0.1.dev0/src/paname/signal_extraction/__init__.py +5 -0
  85. paname-0.0.1.dev0/src/paname/signal_extraction/extractors.py +225 -0
  86. paname-0.0.1.dev0/src/paname/signal_extraction/model_wrappers/__init__.py +90 -0
  87. paname-0.0.1.dev0/src/paname/signal_extraction/model_wrappers/base.py +565 -0
  88. paname-0.0.1.dev0/src/paname/signal_extraction/model_wrappers/gguf_lm.py +488 -0
  89. paname-0.0.1.dev0/src/paname/signal_extraction/model_wrappers/huggingface_base.py +249 -0
  90. paname-0.0.1.dev0/src/paname/signal_extraction/model_wrappers/huggingface_diffusers.py +156 -0
  91. paname-0.0.1.dev0/src/paname/signal_extraction/model_wrappers/huggingface_lm.py +757 -0
  92. paname-0.0.1.dev0/src/paname/signal_extraction/model_wrappers/huggingface_text_utils.py +67 -0
  93. paname-0.0.1.dev0/src/paname/signal_extraction/model_wrappers/huggingface_token_classification.py +108 -0
  94. paname-0.0.1.dev0/src/paname/signal_extraction/model_wrappers/online_api_lm.py +594 -0
  95. paname-0.0.1.dev0/src/paname/signal_extraction/model_wrappers/onnx.py +204 -0
  96. paname-0.0.1.dev0/src/paname/signal_extraction/model_wrappers/sklearn.py +103 -0
  97. paname-0.0.1.dev0/src/paname/signal_extraction/model_wrappers/text_generation_utils.py +72 -0
  98. paname-0.0.1.dev0/src/paname/signal_extraction/model_wrappers/text_sampling.py +146 -0
  99. paname-0.0.1.dev0/src/paname/signal_extraction/model_wrappers/torch_classifier.py +396 -0
  100. paname-0.0.1.dev0/src/paname/signal_extraction/model_wrappers/vllm_offline_lm.py +498 -0
  101. paname-0.0.1.dev0/src/paname/signal_extraction/utils/__init__.py +5 -0
  102. paname-0.0.1.dev0/src/paname/signal_extraction/utils/process_logprobs.py +329 -0
  103. paname-0.0.1.dev0/src/paname/signal_extraction/utils/signal_transformations.py +43 -0
  104. paname-0.0.1.dev0/src/paname/typing.py +78 -0
  105. paname-0.0.1.dev0/src/paname/use_case.py +53 -0
  106. paname-0.0.1.dev0/src/paname/utils/__init__.py +5 -0
  107. paname-0.0.1.dev0/src/paname/utils/device.py +110 -0
  108. paname-0.0.1.dev0/src/paname/utils/gradient_estimation.py +142 -0
  109. paname-0.0.1.dev0/src/paname/utils/lp.py +90 -0
  110. paname-0.0.1.dev0/src/paname/utils/resampling.py +74 -0
  111. paname-0.0.1.dev0/src/paname/utils/seeding.py +30 -0
@@ -0,0 +1,182 @@
1
+ # SPDX-FileCopyrightText: 2026 PANAME Consortium (ANSSI, CNIL, Inria and PEReN)
2
+ #
3
+ # SPDX-License-Identifier: MIT
4
+
5
+
6
+
7
+
8
+
9
+ # Logs
10
+ logs/
11
+ *.log
12
+ *.stderr
13
+ *.stdout
14
+
15
+ # Build / Cache
16
+ dist/
17
+ build/
18
+ .tmp/
19
+ .temp/
20
+ .cache/
21
+
22
+ ## Boilerplate gitignore for Python projects
23
+ ## Adapted from https://github.com/github/gitignore/blob/main/Python.gitignore
24
+
25
+ # Byte-compiled / optimized / DLL files
26
+ __pycache__/
27
+ *.py[cod]
28
+ *$py.class
29
+
30
+ # C extensions
31
+ *.so
32
+
33
+ # Distribution / packaging
34
+ .Python
35
+ develop-eggs/
36
+ downloads/
37
+ eggs/
38
+ .eggs/
39
+ lib/
40
+ lib64/
41
+ parts/
42
+ sdist/
43
+ var/
44
+ wheels/
45
+ share/python-wheels/
46
+ *.egg-info/
47
+ .installed.cfg
48
+ *.egg
49
+ MANIFEST
50
+
51
+
52
+ #Sphinx
53
+ docs/source/generated/
54
+
55
+ # PyInstaller
56
+ # Usually these files are written by a python script from a template
57
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
58
+ *.manifest
59
+ *.spec
60
+
61
+ # Installer logs
62
+ pip-log.txt
63
+ pip-delete-this-directory.txt
64
+
65
+ # Unit test / coverage reports
66
+ htmlcov/
67
+ .tox/
68
+ .nox/
69
+ .coverage
70
+ .coverage.*
71
+ .cache
72
+ nosetests.xml
73
+ coverage.xml
74
+ report.xml
75
+ mypy.xml
76
+ *.cover
77
+ *.py,cover
78
+ .hypothesis/
79
+ .pytest_cache/
80
+ .ruff_cache/
81
+ cover/
82
+
83
+ ## Flask stuff:
84
+ #instance/
85
+ #.webassets-cache
86
+
87
+ ## Scrapy stuff:
88
+ #.scrapy
89
+
90
+ # Sphinx documentation
91
+ docs/_build/
92
+
93
+ # mkdocs documentation
94
+ /site
95
+
96
+ # PyBuilder
97
+ .pybuilder/
98
+ target/
99
+
100
+ # Jupyter Notebook
101
+ .ipynb_checkpoints/
102
+
103
+ # IPython
104
+ profile_default/
105
+ ipython_config.py
106
+
107
+ # pyenv
108
+ # For a library or package, you might want to ignore these files since the code is
109
+ # intended to run in multiple environments; otherwise, check them in:
110
+ .python-version
111
+
112
+ ## pdm
113
+ ## pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include #it
114
+ ## in version control.
115
+ ## https://pdm.fming.dev/latest/usage/project/#working-with-version-control
116
+ #.pdm.toml
117
+ #.pdm-python
118
+ #.pdm-build/
119
+
120
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
121
+ __pypackages__/
122
+
123
+ # Celery stuff
124
+ celerybeat-schedule
125
+ celerybeat.pid
126
+
127
+ # SageMath parsed files
128
+ *.sage.py
129
+
130
+ # Environments
131
+ .env
132
+ .venv/
133
+ env/
134
+ venv/
135
+ ENV/
136
+ env.bak/
137
+ venv.bak/
138
+
139
+ # mypy
140
+ .mypy_cache/
141
+ .dmypy.json
142
+ dmypy.json
143
+
144
+ # Pyre type checker
145
+ .pyre/
146
+
147
+ # pytype static type analyzer
148
+ .pytype/
149
+
150
+ # Cython debug symbols
151
+ cython_debug/
152
+
153
+ ## NodeJS boilerplate
154
+ # If needed: cf. https://github.com/github/gitignore/blob/main/Node.gitignore
155
+
156
+ node_modules/
157
+ .npm/
158
+
159
+ ## IDEs
160
+ ## (in theory, each user should add the proper exclusion in his global .gitignore but safer)
161
+
162
+ *~
163
+
164
+ # Visual Studio Code
165
+ .vscode/
166
+ .vscode-test
167
+
168
+ # Spyder project settings
169
+ .spyderproject
170
+ .spyproject
171
+
172
+ # Rope project settings
173
+ .ropeproject
174
+
175
+ # PyCharm
176
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
177
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
178
+ .idea/
179
+ data/
180
+ output/
181
+ .hf_cache/
182
+ .onnx_cache/
@@ -0,0 +1,23 @@
1
+ <!--
2
+ # SPDX-FileCopyrightText: 2026 PANAME Consortium (ANSSI, CNIL, Inria and PEReN)
3
+ #
4
+ # SPDX-License-Identifier: MIT
5
+ -->
6
+
7
+ <!--
8
+ Project changelog.
9
+ This file is required if you want to auto-publish packages with CI and git tags.
10
+
11
+ To publish a new version, create a new section with the following format:
12
+
13
+ ## v<version_number> (<tag_commit_date>)
14
+
15
+ Remarks:
16
+ - `version_number` should be a valid python package version
17
+ - `tag_commit_date` should be in ISO (YYYY-MM-DD) format.
18
+ Concrete example:
19
+
20
+ ## v0.1.2 (2020-08-31)
21
+ -->
22
+
23
+ # Changelog
@@ -0,0 +1 @@
1
+ LICENSES/MIT.txt
@@ -0,0 +1,121 @@
1
+ Creative Commons Legal Code
2
+
3
+ CC0 1.0 Universal
4
+
5
+ CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
6
+ LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
7
+ ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
8
+ INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
9
+ REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
10
+ PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
11
+ THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
12
+ HEREUNDER.
13
+
14
+ Statement of Purpose
15
+
16
+ The laws of most jurisdictions throughout the world automatically confer
17
+ exclusive Copyright and Related Rights (defined below) upon the creator
18
+ and subsequent owner(s) (each and all, an "owner") of an original work of
19
+ authorship and/or a database (each, a "Work").
20
+
21
+ Certain owners wish to permanently relinquish those rights to a Work for
22
+ the purpose of contributing to a commons of creative, cultural and
23
+ scientific works ("Commons") that the public can reliably and without fear
24
+ of later claims of infringement build upon, modify, incorporate in other
25
+ works, reuse and redistribute as freely as possible in any form whatsoever
26
+ and for any purposes, including without limitation commercial purposes.
27
+ These owners may contribute to the Commons to promote the ideal of a free
28
+ culture and the further production of creative, cultural and scientific
29
+ works, or to gain reputation or greater distribution for their Work in
30
+ part through the use and efforts of others.
31
+
32
+ For these and/or other purposes and motivations, and without any
33
+ expectation of additional consideration or compensation, the person
34
+ associating CC0 with a Work (the "Affirmer"), to the extent that he or she
35
+ is an owner of Copyright and Related Rights in the Work, voluntarily
36
+ elects to apply CC0 to the Work and publicly distribute the Work under its
37
+ terms, with knowledge of his or her Copyright and Related Rights in the
38
+ Work and the meaning and intended legal effect of CC0 on those rights.
39
+
40
+ 1. Copyright and Related Rights. A Work made available under CC0 may be
41
+ protected by copyright and related or neighboring rights ("Copyright and
42
+ Related Rights"). Copyright and Related Rights include, but are not
43
+ limited to, the following:
44
+
45
+ i. the right to reproduce, adapt, distribute, perform, display,
46
+ communicate, and translate a Work;
47
+ ii. moral rights retained by the original author(s) and/or performer(s);
48
+ iii. publicity and privacy rights pertaining to a person's image or
49
+ likeness depicted in a Work;
50
+ iv. rights protecting against unfair competition in regards to a Work,
51
+ subject to the limitations in paragraph 4(a), below;
52
+ v. rights protecting the extraction, dissemination, use and reuse of data
53
+ in a Work;
54
+ vi. database rights (such as those arising under Directive 96/9/EC of the
55
+ European Parliament and of the Council of 11 March 1996 on the legal
56
+ protection of databases, and under any national implementation
57
+ thereof, including any amended or successor version of such
58
+ directive); and
59
+ vii. other similar, equivalent or corresponding rights throughout the
60
+ world based on applicable law or treaty, and any national
61
+ implementations thereof.
62
+
63
+ 2. Waiver. To the greatest extent permitted by, but not in contravention
64
+ of, applicable law, Affirmer hereby overtly, fully, permanently,
65
+ irrevocably and unconditionally waives, abandons, and surrenders all of
66
+ Affirmer's Copyright and Related Rights and associated claims and causes
67
+ of action, whether now known or unknown (including existing as well as
68
+ future claims and causes of action), in the Work (i) in all territories
69
+ worldwide, (ii) for the maximum duration provided by applicable law or
70
+ treaty (including future time extensions), (iii) in any current or future
71
+ medium and for any number of copies, and (iv) for any purpose whatsoever,
72
+ including without limitation commercial, advertising or promotional
73
+ purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
74
+ member of the public at large and to the detriment of Affirmer's heirs and
75
+ successors, fully intending that such Waiver shall not be subject to
76
+ revocation, rescission, cancellation, termination, or any other legal or
77
+ equitable action to disrupt the quiet enjoyment of the Work by the public
78
+ as contemplated by Affirmer's express Statement of Purpose.
79
+
80
+ 3. Public License Fallback. Should any part of the Waiver for any reason
81
+ be judged legally invalid or ineffective under applicable law, then the
82
+ Waiver shall be preserved to the maximum extent permitted taking into
83
+ account Affirmer's express Statement of Purpose. In addition, to the
84
+ extent the Waiver is so judged Affirmer hereby grants to each affected
85
+ person a royalty-free, non transferable, non sublicensable, non exclusive,
86
+ irrevocable and unconditional license to exercise Affirmer's Copyright and
87
+ Related Rights in the Work (i) in all territories worldwide, (ii) for the
88
+ maximum duration provided by applicable law or treaty (including future
89
+ time extensions), (iii) in any current or future medium and for any number
90
+ of copies, and (iv) for any purpose whatsoever, including without
91
+ limitation commercial, advertising or promotional purposes (the
92
+ "License"). The License shall be deemed effective as of the date CC0 was
93
+ applied by Affirmer to the Work. Should any part of the License for any
94
+ reason be judged legally invalid or ineffective under applicable law, such
95
+ partial invalidity or ineffectiveness shall not invalidate the remainder
96
+ of the License, and in such case Affirmer hereby affirms that he or she
97
+ will not (i) exercise any of his or her remaining Copyright and Related
98
+ Rights in the Work or (ii) assert any associated claims and causes of
99
+ action with respect to the Work, in either case contrary to Affirmer's
100
+ express Statement of Purpose.
101
+
102
+ 4. Limitations and Disclaimers.
103
+
104
+ a. No trademark or patent rights held by Affirmer are waived, abandoned,
105
+ surrendered, licensed or otherwise affected by this document.
106
+ b. Affirmer offers the Work as-is and makes no representations or
107
+ warranties of any kind concerning the Work, express, implied,
108
+ statutory or otherwise, including without limitation warranties of
109
+ title, merchantability, fitness for a particular purpose, non
110
+ infringement, or the absence of latent or other defects, accuracy, or
111
+ the present or absence of errors, whether or not discoverable, all to
112
+ the greatest extent permissible under applicable law.
113
+ c. Affirmer disclaims responsibility for clearing rights of other persons
114
+ that may apply to the Work or any use thereof, including without
115
+ limitation any person's Copyright and Related Rights in the Work.
116
+ Further, Affirmer disclaims responsibility for obtaining any necessary
117
+ consents, permissions or other rights required for any use of the
118
+ Work.
119
+ d. Affirmer understands and acknowledges that Creative Commons is not a
120
+ party to this document and has no duty or obligation with respect to
121
+ this CC0 or use of the Work.
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2026 PANAME Consortium (ANSSI, CNIL, Inria and PEReN).
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,226 @@
1
+ Metadata-Version: 2.5
2
+ Name: paname
3
+ Version: 0.0.1-dev
4
+ Summary: Assess self-conformity of ML models by running extraction techniques.
5
+ Author: ANSSI, CNIL, Inria
6
+ Author-email: "Pôle d'Expertise de la Régulation Numérique (PEReN)" <contact@peren.gouv.fr>
7
+ License-Expression: MIT
8
+ License-File: LICENSES/CC0-1.0.txt
9
+ License-File: LICENSES/MIT.txt
10
+ Requires-Python: >=3.11
11
+ Requires-Dist: accelerate>=1.12.0
12
+ Requires-Dist: certifi>=2026.10.19
13
+ Requires-Dist: datasets>=4.4.1
14
+ Requires-Dist: matplotlib>=3.10.7
15
+ Requires-Dist: networkx>=3.0
16
+ Requires-Dist: numpy>=2.0.2
17
+ Requires-Dist: openai>=2.29.0
18
+ Requires-Dist: pandas>=2.3.3
19
+ Requires-Dist: platformdirs>=4.9.6
20
+ Requires-Dist: protobuf>=6.33.5
21
+ Requires-Dist: pydantic-settings>=2.12.0
22
+ Requires-Dist: pydantic>=2.12.5
23
+ Requires-Dist: rapidfuzz>=3.0.0
24
+ Requires-Dist: requests>=2.33.1
25
+ Requires-Dist: scikit-learn>=1.7.2
26
+ Requires-Dist: seaborn>=0.13.2
27
+ Requires-Dist: sentencepiece>=0.2.1
28
+ Requires-Dist: torch>=2.10.0
29
+ Requires-Dist: torchvision>=0.25
30
+ Requires-Dist: transformers>=4.45.0
31
+ Requires-Dist: tyro>=1.0.11
32
+ Provides-Extra: diffusion
33
+ Requires-Dist: diffusers>=0.40.0; extra == 'diffusion'
34
+ Provides-Extra: gguf-llm
35
+ Requires-Dist: llama-cpp-python<0.3.26,>=0.3.18; extra == 'gguf-llm'
36
+ Provides-Extra: onnx-cpu
37
+ Requires-Dist: onnx2pytorch>=0.5.3; extra == 'onnx-cpu'
38
+ Requires-Dist: onnx>=1.15.0; extra == 'onnx-cpu'
39
+ Requires-Dist: onnxruntime>=1.15.0; extra == 'onnx-cpu'
40
+ Requires-Dist: onnxscript>=0.7.0; extra == 'onnx-cpu'
41
+ Provides-Extra: onnx-gpu
42
+ Requires-Dist: onnx2pytorch>=0.5.3; extra == 'onnx-gpu'
43
+ Requires-Dist: onnx>=1.15.0; extra == 'onnx-gpu'
44
+ Requires-Dist: onnxruntime-gpu>=1.15.0; (sys_platform != 'darwin') and extra == 'onnx-gpu'
45
+ Requires-Dist: onnxscript>=0.7.0; extra == 'onnx-gpu'
46
+ Provides-Extra: vllm-llm
47
+ Requires-Dist: vllm>=0.18.0; (sys_platform != 'darwin') and extra == 'vllm-llm'
48
+ Description-Content-Type: text/markdown
49
+
50
+ <!--
51
+ # SPDX-FileCopyrightText: 2026 PANAME Consortium (ANSSI, CNIL, Inria and PEReN)
52
+ #
53
+ # SPDX-License-Identifier: MIT
54
+ -->
55
+
56
+ <p align="center">
57
+ <picture>
58
+ <source media="(prefers-color-scheme: dark)" srcset="assets/logo/Paname_baseline_rvb_dark.svg">
59
+ <img src="assets/logo/Paname_baseline_rvb.svg" alt="PANAME Logo" width="600">
60
+ </picture>
61
+ </p>
62
+
63
+ <h1 align="center">PANAME : Privacy Auditing of AI Models</h1>
64
+
65
+
66
+ <p align="right"><strong><a href="README_FR.md">Lire en français</a></strong></p>
67
+
68
+ <h2>Table of contents</h2>
69
+
70
+ [[_TOC_]]
71
+
72
+ # Overview
73
+
74
+ PANAME aims to facilitate the assessment of AI models' compliance with the GDPR by aggregating and standardizing the implementation of extraction techniques used to evaluate the memorization of personal data.
75
+
76
+ To this end, the library is designed to:
77
+
78
+ - define and implement abstractions that factor out the implementation of the various extraction techniques;
79
+ - make it easier and cheaper to run extraction techniques on production AI models;
80
+ - enable the contribution and standardization of new extraction techniques from the academic community.
81
+
82
+ In practice, extraction techniques fall into 3 categories:
83
+
84
+ - **Membership Inference Attacks (MIA)**: guess whether a sample was present in the training data (binary classification).
85
+ - **Attribute Inference Attacks (AIA)**: infer information about a potentially sensitive data column (*not yet implemented*).
86
+ - **Reconstruction Attacks (RA)**: reconstruct training samples.
87
+
88
+ These extraction techniques require varying degrees of prior knowledge (*priors*) and of access to the training data and the AI model, which is referred to as the **Threat Model**.
89
+ The performance of extraction techniques can vary depending on the Threat Model, which can help guide mitigation mechanisms in AI systems.
90
+
91
+ An introductory note on the theory of extraction testing is available in the [documentation](docs/source/theory.rst).
92
+
93
+ ## Context
94
+
95
+ **According to [EDPB Opinion 28/2024 of 17/12/2024](https://www.edpb.europa.eu/our-work-tools/our-documents/opinion-board-art-64/opinion-282024-certain-data-protection-aspects_en) and [the CNIL's practical guidance sheets](https://www.cnil.fr/fr/ia-analyser-le-statut-dun-modele-dia-au-regard-du-rgpd):**
96
+
97
+ * AI models trained on personal data cannot, in all cases, be considered anonymous.
98
+ * In most cases, an assessment must be carried out if the controller wishes to conclude that its model is anonymous.
99
+ * In practice, this assessment must take into account the means reasonably likely to be used to re-identify personal data, which may include extraction techniques such as:
100
+ * Membership Inference Attacks;
101
+ * Attribute Inference Attacks;
102
+ * Reconstruction Attacks.
103
+ * The level of testing to consider may depend on the context in which the AI model is developed and deployed.
104
+
105
+ # Installation
106
+
107
+ Clone the repository and access the project:
108
+
109
+ ```bash
110
+ git clone https://code.peren.gouv.fr/peren/2025-paname/paname.git
111
+ cd paname
112
+ ```
113
+
114
+ To install the project's dependencies with the `uv` package and project manager (v0.13.4):
115
+
116
+ ```bash
117
+ uv sync
118
+ ```
119
+
120
+ To install the dependencies needed for contributing (linting, documentation generation, etc.), add: `--dev --group docs`
121
+
122
+ ## Special case for ONNX models
123
+
124
+ To run the use cases relying on ONNX, install the appropriate extra:
125
+ - `uv sync --extra onnx-cpu` (for CPU inference)
126
+ - `uv sync --extra onnx-gpu` (for GPU inference with CUDA, ⚠️ **unavailable** on macOS)
127
+
128
+ ## Special case for diffusion attacks
129
+
130
+ To work with the diffusion use cases, you need to sync and run the tests with the `--extra diffusion` option:
131
+
132
+ ```bash
133
+ uv sync --extra diffusion
134
+ ```
135
+
136
+ ## Special case for LLM inference engines
137
+
138
+ There are 4 implementations for LLM inference in PANAME:
139
+
140
+ - `transformers` (built on `torch`), installed by default;
141
+ - "OpenAI-compatible" APIs, also installed by default;
142
+ - GGUF models via llama.cpp: must be installed manually with `--extra gguf-llm` (to install a GPU-enabled build of llama.cpp, use the build flag `CMAKE_ARGS="-DGGML_CUDA=ON"`);
143
+ - models instantiated via vLLM in "offline inference" mode (not as an API, ⚠️ **unavailable** on macOS and on CPU): this also requires installing with `--extra vllm-llm`.
144
+
145
+ ## Development environment with a container
146
+
147
+ A Dockerfile is provided to reproduce the development environment (Python 3.11, uv 0.13.4) :
148
+
149
+ ```bash
150
+ docker build -t paname . # or podman
151
+ docker container run -it --rm paname:latest
152
+ ```
153
+
154
+ # Tests
155
+
156
+ The test suite is documented in [`CONTRIBUTING.md`](CONTRIBUTING.md). For a quick
157
+ verification of an end-user install:
158
+
159
+ ```bash
160
+ uv run poe test-fast # tests that do not call Hugging Face; suitable for CPU configurations
161
+ uv run poe test-all # all tests, which is only possible with CUDA because of the dependencies
162
+ ```
163
+
164
+ # Usage examples
165
+
166
+ ## Notebooks
167
+
168
+ Notebooks to get started with the library are available in the `examples/cookbook/` folder.
169
+
170
+ These notebooks aim to give developers a first idea of what can be done with **PANAME**. They are progressive tutorials for mastering the library and its abstractions.
171
+
172
+ The following notebooks explain how to build use cases, adapters (wrappers) and run extractions with PANAME:
173
+ - [`1.mia_getting_started.ipynb`](examples/cookbook/1.mia_getting_started.ipynb): getting started with MIAs — loading data, training models and running a basic membership inference audit.
174
+ - [`2.mia_CLM_w_precomputed_workflow.ipynb`](examples/cookbook/2.mia_CLM_w_precomputed_workflow.ipynb): runs MIAs on an overfitted GPT-2 model using a precomputed reference signal.
175
+ - [`2bis.mia_w_various_CLM_wrappers.ipynb`](examples/cookbook/2bis.mia_w_various_CLM_wrappers.ipynb): applies the same MIA to an LLM served through different back-ends — a Hugging Face model, an OpenAI-compatible API via vLLM, a GGUF model via llama.cpp and vLLM offline — showing that only the wrapper changes while the rest of the pipeline stays identical.
176
+ - [`3.mia_torchclassifier_w_shadow_models.ipynb`](examples/cookbook/3.mia_torchclassifier_w_shadow_models.ipynb): runs a shadow-model attack on a torch-based image classifier.
177
+ - [`4.mia_w_custom_wrapper.ipynb`](examples/cookbook/4.mia_w_custom_wrapper.ipynb): shows how to build a custom wrapper to connect a model's signals to compatible attacks.
178
+ - [`5.mia_evaluation_dataset_best_practices.ipynb`](examples/cookbook/5.mia_evaluation_dataset_best_practices.ipynb): best practices for building an MIA evaluation dataset (evaluation regimes, biases, …).
179
+ - [`6.mia_w_label_only_hopskip.ipynb`](examples/cookbook/6.mia_w_label_only_hopskip.ipynb): label-only membership inference with the HopSkipJump attack.
180
+ - [`7.reconstruction_diffusion_carlini2023.ipynb`](examples/cookbook/7.reconstruction_diffusion_carlini2023.ipynb): extracts training images from a text-to-image diffusion model (Carlini et al., 2023) by generating many candidates per prompt and keeping those that form clusters of near-duplicates; the reconstructions are evaluated against the memorized images (requires `--extra diffusion`).
181
+ - [`8.discoverable_extraction.ipynb`](examples/cookbook/8.discoverable_extraction.ipynb): generates `(n, p)`-discoverable extraction curves for a local Hugging Face model.
182
+
183
+ A few extra, unlisted scripts and notebooks live in [`examples/others/`](examples/others/). They are not part of the numbered tutorial series.
184
+
185
+ ## Registered use cases
186
+
187
+ The [`paname_use_cases`](paname_use_cases/) folder offers examples of what needs to be implemented to run membership inference attacks on a given target model + dataset pair, in the `PanameUseCase` format defined in the script `src/paname/use_case.py`.
188
+
189
+ > [!warning]
190
+ > ⚠️ The models and datasets referenced by the `paname_use_cases` use cases are not redistributed with PANAME; they are downloaded from their original sources at run time. They remain subject to their own licensing terms, held by their respective rights holders, which take precedence over the repository's MIT license. Check their original license before use.
191
+
192
+ To run the `Loss` MIA on the pre-registered `SKLEARN_CLASSIFIER_SYNTHETIC` use case, run:
193
+
194
+ ```bash
195
+ uv run paname mia run --use-case-name SKLEARN_CLASSIFIER_SYNTHETIC --mias Loss
196
+ ```
197
+
198
+ You can override the constructor parameters of the extracted techniques through a
199
+ `--configs.<group>.*` clause (see `uv run paname <technique> run --help`):
200
+
201
+ ```bash
202
+ uv run paname mia run --use-case-name GPT2_WIKITEXT --mias Min-k-prob Perplexity \
203
+ --configs.min-k-prob.k 5
204
+ ```
205
+
206
+ > [!note]
207
+ > A MIA may require more than the audit dataset and the target model. For example a calibration dataset, or additional proxy models. MIA-PanameUseCase compatibility is currently left to the user.
208
+
209
+ > [!note]
210
+ > The CLI is organized by extraction technique — `mia`, `discoverable-extraction` and
211
+ > `reconstruction` — each exposing `list`, `run` and `use-cases` subcommands.
212
+ > Use `uv run paname --help` to explore them (the historical `run-mia` / `list-mias` /
213
+ > `list-use-cases` commands remain available).
214
+
215
+ # Consortium
216
+
217
+ PANAME is a joint project of ANSSI, CNIL, INRIA and PEReN.
218
+
219
+ # Acknowledgment
220
+
221
+ This work was (partially) funded by the National Research Agency under the France 2030 program, with the reference ANR-25-APEV-0001.
222
+
223
+ # License
224
+
225
+ This project is licensed under MIT. A full copy of the license
226
+ text can be found in the file [MIT.txt](LICENSES/MIT.txt).