{"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/diffusion-based-negative-sampling-on-graphs","title":"Diffusion-based Negative Sampling on Graphs for Link Prediction","arxiv_id":"2403.17259","date":"2024-03-25","proceeding":null,"authors":["Trung-Kien Nguyen","Yuan Fang"],"abstract":"Link prediction is a fundamental task for graph analysis with important applications on the Web, such as social network analysis and recommendation systems, etc. Modern graph link prediction methods often employ a contrastive approach to learn robust node representations, where negative sampling is pivotal. Typical negative sampling methods aim to retrieve hard examples based on either predefined heuristics or automatic adversarial approaches, which might be inflexible or difficult to control. Furthermore, in the context of link prediction, most previous methods sample negative nodes from existing substructures of the graph, missing out on potentially more optimal samples in the latent space. To address these issues, we investigate a novel strategy of multi-level negative sampling that enables negative node generation with flexible and controllable ``hardness'' levels from the latent space. Our method, called Conditional Diffusion-based Multi-level Negative Sampling (DMNS), leverages the Markov chain property of diffusion models to generate negative nodes in multiple levels of variable hardness and reconcile them for effective graph link prediction. We further demonstrate that DMNS follows the sub-linear positivity principle for robust negative sampling. Extensive experiments on several benchmark datasets demonstrate the effectiveness of DMNS.","url_abs":"https://arxiv.org/abs/2403.17259v1","url_pdf":"https://arxiv.org/pdf/2403.17259v1.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":"diffusion-based-negative-sampling-on-graphs","repo_url":"https://github.com/ntkien1904/dmns","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"link-prediction","task_name":"Link Prediction"},{"task_slug":"prediction","task_name":"Prediction"},{"task_slug":"recommendation-systems","task_name":"Recommendation Systems"}],"methods":[{"method_slug":"diffusion","method_name":"Diffusion"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2403.17259","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2403.17259"}},"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/ntkien1904/dmns","reach":{"status":"ok"}}],"summary":{"ran_honours":2,"ran_fixture":1,"ran":5,"unverified":4},"by_repo_kind":{"official":{"samples":12,"ran":8,"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":12,"samples":[{"code_sha256_prefix":"3a6233722b4f0cd6","entry":"cosine_beta_schedule","repo":"ntkien1904/dmns","repo_kind":"official","path":"model/model.py","file_url":"https://github.com/ntkien1904/dmns/blob/HEAD/model/model.py","link_basis":"plan_row","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"3a6233722b4f0cd6"}},{"code_sha256_prefix":"df116dde4bb6ab3e","entry":"extract","repo":"ntkien1904/dmns","repo_kind":"official","path":"model/model.py","file_url":"https://github.com/ntkien1904/dmns/blob/HEAD/model/model.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"df116dde4bb6ab3e"}},{"code_sha256_prefix":"37a36e71b86103ce","entry":"linear_beta_schedule","repo":"ntkien1904/dmns","repo_kind":"official","path":"model/model.py","file_url":"https://github.com/ntkien1904/dmns/blob/HEAD/model/model.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"37a36e71b86103ce"}},{"code_sha256_prefix":"9d27e6104040d510","entry":"negative_sampling","repo":"ntkien1904/dmns","repo_kind":"official","path":"utils.py","file_url":"https://github.com/ntkien1904/dmns/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":"9d27e6104040d510"}},{"code_sha256_prefix":"28558e82fd389184","entry":"normalize_adj","repo":"ntkien1904/dmns","repo_kind":"official","path":"utils.py","file_url":"https://github.com/ntkien1904/dmns/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":"28558e82fd389184"}},{"code_sha256_prefix":"02e80a6690fd5a05","entry":"prepare_saved_path","repo":"ntkien1904/dmns","repo_kind":"official","path":"utils.py","file_url":"https://github.com/ntkien1904/dmns/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":"02e80a6690fd5a05"}},{"code_sha256_prefix":"93516a1ce7a5079f","entry":"preprocess_features","repo":"ntkien1904/dmns","repo_kind":"official","path":"data_process.py","file_url":"https://github.com/ntkien1904/dmns/blob/HEAD/data_process.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":"93516a1ce7a5079f"}},{"code_sha256_prefix":"496165266c2eceff","entry":"quadratic_beta_schedule","repo":"ntkien1904/dmns","repo_kind":"official","path":"model/model_cond.py","file_url":"https://github.com/ntkien1904/dmns/blob/HEAD/model/model_cond.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":"496165266c2eceff"}},{"code_sha256_prefix":"9fa2bfe219927696","entry":"evaluate","repo":"ntkien1904/dmns","repo_kind":"official","path":"main_cond.py","file_url":"https://github.com/ntkien1904/dmns/blob/HEAD/main_cond.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":"9fa2bfe219927696"}},{"code_sha256_prefix":"8809d11195f7db74","entry":"get_dataset","repo":"ntkien1904/dmns","repo_kind":"official","path":"data_process.py","file_url":"https://github.com/ntkien1904/dmns/blob/HEAD/data_process.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":"8809d11195f7db74"}},{"code_sha256_prefix":"54e83a1eefd1da9f","entry":"mean_trials","repo":"ntkien1904/dmns","repo_kind":"official","path":"main_cond.py","file_url":"https://github.com/ntkien1904/dmns/blob/HEAD/main_cond.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":"54e83a1eefd1da9f"}},{"code_sha256_prefix":"3e6411872baeb77b","entry":"run","repo":"ntkien1904/dmns","repo_kind":"official","path":"main_cond.py","file_url":"https://github.com/ntkien1904/dmns/blob/HEAD/main_cond.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":"3e6411872baeb77b"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}