{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/mia-tuner-adapting-large-language-models-as","title":"MIA-Tuner: Adapting Large Language Models as Pre-training Text Detector","arxiv_id":"2408.08661","date":"2024-08-16","proceeding":null,"authors":["Wenjie Fu","Huandong Wang","Chen Gao","Guanghua Liu","Yong Li","Tao Jiang"],"abstract":"The increasing parameters and expansive dataset of large language models (LLMs) highlight the urgent demand for a technical solution to audit the underlying privacy risks and copyright issues associated with LLMs. Existing studies have partially addressed this need through an exploration of the pre-training data detection problem, which is an instance of a membership inference attack (MIA). This problem involves determining whether a given piece of text has been used during the pre-training phase of the target LLM. Although existing methods have designed various sophisticated MIA score functions to achieve considerable detection performance in pre-trained LLMs, how to achieve high-confidence detection and how to perform MIA on aligned LLMs remain challenging. In this paper, we propose MIA-Tuner, a novel instruction-based MIA method, which instructs LLMs themselves to serve as a more precise pre-training data detector internally, rather than design an external MIA score function. Furthermore, we design two instruction-based safeguards to respectively mitigate the privacy risks brought by the existing methods and MIA-Tuner. To comprehensively evaluate the most recent state-of-the-art LLMs, we collect a more up-to-date MIA benchmark dataset, named WIKIMIA-24, to replace the widely adopted benchmark WIKIMIA. We conduct extensive experiments across various aligned and unaligned LLMs over the two benchmark datasets. The results demonstrate that MIA-Tuner increases the AUC of MIAs from 0.7 to a significantly high level of 0.9.","url_abs":"https://arxiv.org/abs/2408.08661v1","url_pdf":"https://arxiv.org/pdf/2408.08661v1.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"mia-tuner-adapting-large-language-models-as","repo_url":"https://github.com/wjfu99/mia-tuner","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"inference-attack","task_name":"Inference Attack"},{"task_slug":"membership-inference-attack","task_name":"Membership Inference Attack"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2408.08661","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2408.08661"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/wjfu99/mia-tuner","reach":{"status":"ok"}}],"summary":{"ran":10,"unverified":6},"by_repo_kind":{"official":{"samples":16,"ran":10,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":16,"samples":[{"code_sha256_prefix":"04659e6b8bcf079c","entry":"compute_reconstruct_rate","repo":"wjfu99/mia-tuner","repo_kind":"official","path":"my_utils.py","file_url":"https://github.com/wjfu99/mia-tuner/blob/HEAD/my_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"04659e6b8bcf079c"}},{"code_sha256_prefix":"16ebfa6747fcf489","entry":"extract_event_content","repo":"wjfu99/mia-tuner","repo_kind":"official","path":"update_wikimia.py","file_url":"https://github.com/wjfu99/mia-tuner/blob/HEAD/update_wikimia.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"16ebfa6747fcf489"}},{"code_sha256_prefix":"92e0d0a6e852a71d","entry":"generate_suffixes","repo":"wjfu99/mia-tuner","repo_kind":"official","path":"my_utils.py","file_url":"https://github.com/wjfu99/mia-tuner/blob/HEAD/my_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"92e0d0a6e852a71d"}},{"code_sha256_prefix":"ea698fe030e4aa1b","entry":"get_generic_logger","repo":"wjfu99/mia-tuner","repo_kind":"official","path":"utils.py","file_url":"https://github.com/wjfu99/mia-tuner/blob/HEAD/utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"ea698fe030e4aa1b"}},{"code_sha256_prefix":"71b1f53a37c318af","entry":"instruct_format","repo":"wjfu99/mia-tuner","repo_kind":"official","path":"inference_on_zhipuai/inference_zhipuai.py","file_url":"https://github.com/wjfu99/mia-tuner/blob/HEAD/inference_on_zhipuai/inference_zhipuai.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"71b1f53a37c318af"}},{"code_sha256_prefix":"d195295e9c1a6d51","entry":"instruct_format","repo":"wjfu99/mia-tuner","repo_kind":"official","path":"inference_on_zhipuai/jsonl_dataset.py","file_url":"https://github.com/wjfu99/mia-tuner/blob/HEAD/inference_on_zhipuai/jsonl_dataset.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"d195295e9c1a6d51"}},{"code_sha256_prefix":"e14dafbc85136a7d","entry":"load_dict_from_npz","repo":"wjfu99/mia-tuner","repo_kind":"official","path":"utils.py","file_url":"https://github.com/wjfu99/mia-tuner/blob/HEAD/utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"e14dafbc85136a7d"}},{"code_sha256_prefix":"cdd7cb5df882df7d","entry":"load_jsonl","repo":"wjfu99/mia-tuner","repo_kind":"official","path":"inference_on_zhipuai/inference_zhipuai.py","file_url":"https://github.com/wjfu99/mia-tuner/blob/HEAD/inference_on_zhipuai/inference_zhipuai.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"cdd7cb5df882df7d"}},{"code_sha256_prefix":"91d1d9b0c9c266d7","entry":"load_prompts","repo":"wjfu99/mia-tuner","repo_kind":"official","path":"my_utils.py","file_url":"https://github.com/wjfu99/mia-tuner/blob/HEAD/my_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"91d1d9b0c9c266d7"}},{"code_sha256_prefix":"71ad10f49732634d","entry":"remove_after_assistant","repo":"wjfu99/mia-tuner","repo_kind":"official","path":"data_utils.py","file_url":"https://github.com/wjfu99/mia-tuner/blob/HEAD/data_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"71ad10f49732634d"}},{"code_sha256_prefix":"23c3416429f69fee","entry":"count_masks","repo":"wjfu99/mia-tuner","repo_kind":"official","path":"dataset_perturb.py","file_url":"https://github.com/wjfu99/mia-tuner/blob/HEAD/dataset_perturb.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":"OPAQUE_PARAMS","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"23c3416429f69fee"}},{"code_sha256_prefix":"b7b5bf30620a61d6","entry":"index_output","repo":"wjfu99/mia-tuner","repo_kind":"official","path":"data_utils.py","file_url":"https://github.com/wjfu99/mia-tuner/blob/HEAD/data_utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"b7b5bf30620a61d6"}},{"code_sha256_prefix":"7bf9fb555a194f43","entry":"inference","repo":"wjfu99/mia-tuner","repo_kind":"official","path":"run_baselines.py","file_url":"https://github.com/wjfu99/mia-tuner/blob/HEAD/run_baselines.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"7bf9fb555a194f43"}},{"code_sha256_prefix":"c4f49de1c200db3c","entry":"load_model","repo":"wjfu99/mia-tuner","repo_kind":"official","path":"run_baselines.py","file_url":"https://github.com/wjfu99/mia-tuner/blob/HEAD/run_baselines.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"c4f49de1c200db3c"}},{"code_sha256_prefix":"11e5b3fc9bdba4a4","entry":"replace_masks","repo":"wjfu99/mia-tuner","repo_kind":"official","path":"dataset_perturb.py","file_url":"https://github.com/wjfu99/mia-tuner/blob/HEAD/dataset_perturb.py","link_basis":"plan_row","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"11e5b3fc9bdba4a4"}},{"code_sha256_prefix":"7ef526c6711c4bf8","entry":"tokenize_and_mask","repo":"wjfu99/mia-tuner","repo_kind":"official","path":"dataset_perturb.py","file_url":"https://github.com/wjfu99/mia-tuner/blob/HEAD/dataset_perturb.py","link_basis":"plan_row","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"7ef526c6711c4bf8"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}