Search papers, labs, and topics across Lattice.
This paper introduces PyKEEN-NSX, a modular extension of the PyKEEN framework designed to enhance negative sampling strategies for Knowledge Graph Embedding (KGE) tasks. By decoupling the generation of candidate negative pools from the selection strategy, the framework allows for the integration of static, schema-aware, and dynamic negative sampling methods, addressing the limitations of existing KGE libraries. The authors demonstrate the utility of this approach through an analysis of negative availability across multiple datasets, revealing that constrained negative pools often fail to meet requirements, leading to reliance on random sampling.
Negative sampling strategies in KGE can be significantly improved by a modular framework that adapts to contextual and structural nuances, rather than relying on basic random methods.
Embedding methods have become popular due to their scalability on link prediction and/or triple classification tasks on Knowledge Graphs (KGs). Embedding models are trained relying on both positive and negative samples of triples. However, since KGs generally contain only positive assertions, negative samples are artificially generated through negative sampling strategies, ranging from simple random corruption to more sophisticated approaches that exploit structural, semantic, or embedding information. The design and implementation of advanced negative samplers remains challenging, as most popular Knowledge Graph Embedding (KGE) libraries provide support only for basic strategies and lack a unified framework for developing more advanced and customized solutions. To address this gap, we introduce PyKEEN-NSX, an extension of PyKEEN, the popular KGE framework, that provides a modular engineered abstraction for negative sampling. The proposed architecture separates the generation of candidate negative pools, conditioned on an explicit context, from the selection strategy, enabling the development and integration of static, schema-aware and dynamic approaches within a consistent framework. Based on this abstraction, we implement six negative samplers, while remaining fully compatible with existing PyKEEN workflows and pipelines. As a proof of concept, we study negative availability across four datasets, showing that constrained pools frequently fall below the requested number of negatives, so that the encoded criterion is to a large extent replaced by the random fallback that supplements them.