FlowNeg: GFlowNet-Guided Diverse Hard Negative Sampling for Knowledge Graph Embedding
Organizations: Department of Computer Science, Iowa State University, USA · Department of Computer Science and Engineering, BRAC University, Bangladesh · Department of Computer and Information Sciences, University of Delaware, USA
Abstract
Negative sampling determines whether a knowledge graph embedding (KGE) model learns from informative counterexamples or wastes updates on implausible corruptions. Uniform negatives are diverse but easy, whereas hard-negative miners concentrate on few entities and collide more with held-out positives. We introduce FlowNeg, a context-conditioned hierarchical generative flow network that amortizes reward-proportional sampling without normalizing a composite reward over the entity set: given a positive triple and corruption side, it selects a type, then an entity. Its terminal reward combines bounded model-based hardness with a training-only structural score for held-out-positive collision, over a relation-specific type-compatible support. We derive the reward, specialize standard trajectory balance, and bound multiplicatively how residual imbalance perturbs terminal and mode probability. Across a descriptive five-seed grid of five architectures and five benchmarks, FlowNeg has higher mean MRR than EMU and than IF-NS in 24 of 25 cells ( and on average). A separate 15-seed FB15k-237/RotatE control fixing negative count, diagnostic budget, and compute gives FlowNeg MRR against for EMU, with near-uniform fixed-partition diversity, high gradient informativeness, and low collision. The evidence supports mode-covering negative generation without treating structural similarity as an open-world truth oracle.
Figures & tables
| Model | FB15k-237 | WN18RR | YAGO3-10 | CoDEx-L | Hetionet |
|---|---|---|---|---|---|
| TransE | .338/.321/.319 | .259/.245/.246 | .498/.470/.474 | .294/.273/.278 | .335/.311/.316 |
| RotatE | .357/.345/.343 | .494/.481/.480 | .548/.527/.529 | .324/.308/.310 | .361/.341/.343 |
| ComplEx | .348/.336/.334 | .487/.489/.474 | .533/.514/.512 | .314/.298/.295 | .348/.329/.326 |
| ConvE | .354/.340/.341 | .458/.444/.445 | .512/.491/.493 | .305/.286/.288 | .339/.319/.322 |
| SimKGC | .362/.348/.349 | .503/.491/.492 | .559/.534/.560 | .333/.315/.316 | .372/.350/.351 |
| vs. EMU | vs. IF-NS | |||
|---|---|---|---|---|
| Setting | MRR | W | MRR | W |
| RotatE/FB15k-237 | 15 | 15 | ||
| RotatE/WN18RR | 15 | 15 | ||
| RotatE/YAGO3-10 | 15 | 15 | ||
| RotatE/CoDEx-L | 15 | 15 | ||
| RotatE/Hetionet | 15 | 15 | ||
| Sampler | Final MRR | Final H@10 | NDS | HPC (%) | GI |
|---|---|---|---|---|---|
| Uniform | .329 .002 | .523 .003 | 48.1 .2 | .3 .0 | .13 .01 |
| Self-Adv | .339 .002 | .535 .003 | 13.4 .5 | 2.0 .1 | .59 .02 |
| KBGAN | .333 .003 | .529 .004 | 9.1 .6 | 3.2 .2 | .72 .03 |
| NSCaching | .334 .002 | .530 .003 | 15.8 .4 | 2.6 .1 | .65 .02 |
| SANS | .331 .002 | .527 .003 | 22.0 .4 | 1.4 .1 | .49 .02 |
| EMU | .346 .002 | .544 .003 | 19.4 .3 | 1.8 .1 | .83 .02 |
Appendix figures & tables22 assets
Supplementary material from the paper’s appendix.
Appendix
| Symbol | Meaning |
|---|---|
| entities, relations, and observed triples | |
| positive triple and corruption side | |
| KGE score with parameters | |
| context-conditioned negative proposal | |
| GFlowNet forward and backward policies | |
| context-conditioned partition function |
| Step | Operation |
|---|---|
| 1 | From , build and freeze , , and . |
| 2 | For epochs , update with uniform negatives using Equation ( 2 ). |
| 3 | For each later mini-batch and observed , draw side , form , and repeat Steps 4–5 for . |
| 4 | Sample and . |
| 5 | With probability , replace by a uniform type-valid draw. |
| 6 | Update on the mixed negatives using Equation ( 2 ). |
| Method | H | D | C | G |
|---|---|---|---|---|
| Uniform ( Bordes et al., 2013 ) | – | – | ||
| Self-Adv ( Sun et al., 2019 ) | – | – | – | |
| KBGAN ( Cai and Wang, 2018 ) | – | – | ||
| NSCaching ( Zhang et al., 2019 ) | – | – | ||
| SANS ( Ahrabian et al., 2020 ) | – | |||
| EMU ( Takamoto et al., 2025 ) | – | – |
| Audit | Result |
|---|---|
| Tail identity sensitivity ( varied) | 10000/10000 |
| Head identity sensitivity ( varied) | 10000/10000 |
| Corruption-side sensitivity ( flipped) | 10000/10000 |
| Type-policy gradient reachability (4 comp.) | 1000/1000 |
| Entity-policy gradient reachability (4 comp.) | 1000/1000 |
| Normalizer gradient reachability (4 comp.) | 1000/1000 |
| Dataset | Signed | Mean | Med. | p95 | p99 |
|---|---|---|---|---|---|
| FB15k-237 | 0.061 | 0.043 | 0.152 | 0.247 | |
| WN18RR | 0.054 | 0.038 | 0.136 | 0.221 | |
| YAGO3-10 | 0.067 | 0.047 | 0.166 | 0.271 | |
| CoDEx-L | 0.063 | 0.044 | 0.158 | 0.259 | |
| Hetionet | 0.059 | 0.041 | 0.149 | 0.241 |
| Variant | MRR | Mean | p95 | HPC | NDS ind |
|---|---|---|---|---|---|
| Full | .001 | 0.061 | 0.152 | 0.50 | 43.8 |
| Omit replaced entity | .002 | 0.194 | 0.438 | 0.84 | 39.6 |
| Pair-only | .002 | 0.176 | 0.401 | 0.73 | 41.0 |
| Dataset | Train | Validation | Test | Domain | ||
|---|---|---|---|---|---|---|
| FB15k-237 | 14,541 | 237 | 272,115 | 17,535 | 20,466 | general |
| WN18RR | 40,943 | 11 | 86,835 | 3,034 | 3,134 | lexical |
| YAGO3-10 | 123,182 | 37 | 1,079,040 | 5,000 | 5,000 | general |
| CoDEx-L | 77,951 | 69 | 551,982 | 30,622 | 30,622 | general |
| Hetionet | 47,031 | 24 | 1,690,693 | 56,356 | 56,356 | biomedical |
| Method | Selected configuration | Configurations evaluated |
|---|---|---|
| Uniform | relation-specific Bernoulli head/tail corruption | 1 |
| Self-Adv | 1,024-candidate uniform pool; temperature 1.0; 256 weighted draws without replacement | 6 |
| KBGAN | RotatE generator; 1,024-candidate pool; 256 categorical draws with replacement; deduplication and uniform backfill | 8 |
| NSCaching | cache size 1,024; refresh every 50 optimizer steps; 256 outputs | 9 |
| SANS | two-hop structural pool; 0.8 structural and 0.2 uniform backoff | 6 |
| EMU | four mutation steps; step size 0.05; 1,024 candidates; 256 outputs | 9 |
| Model | Sampler | FB15k-237 | WN18RR | YAGO3-10 | CoDEx-L | Hetionet |
|---|---|---|---|---|---|---|
| TransE | FlowNeg | .338 .002 | .259 .003 | .498 .002 | .294 .002 | .335 .002 |
| EMU | .321 .002 | .245 .003 | .470 .002 | .273 .002 | .311 .002 | |
| IF-NS | .319 .002 | .246 .002 | .474 .003 | .278 .002 | .316 .002 | |
| RotatE | FlowNeg | .357 .001 | .494 .002 | .548 .001 | .324 .002 | .361 .001 |
| EMU | .345 .002 | .481 .002 | .527 .002 | .308 .002 | .341 .002 | |
| IF-NS | .343 .002 | .480 .002 | .529 .002 | .310 .002 | .343 .002 |
| FB15k-237 | WN18RR | ||||||||
| Model | Sampler | MRR | H@1 | H@3 | H@10 | MRR | H@1 | H@3 | H@10 |
| TransE | Uniform | .294 .002 | .205 .001 | .327 .002 | .465 .003 | .226 .003 | .015 .001 | .400 .004 | .501 .004 |
| Self-Adv | .312 .002 | .220 .002 | .345 .003 | .487 .003 | .237 .002 | .028 .001 | .412 .003 | .518 .003 | |
| NSCaching | .318 .003 | .226 .002 | .352 .002 | .492 .004 | .241 .003 | .032 .002 | .418 .004 | .525 .004 | |
| FlowNeg | .338 .002 | .245 .001 | .374 .002 | .517 .003 | .259 .003 | .048 .001 | .438 .003 | .551 .003 | |
| RotatE | Uniform | .328 .001 | .237 .002 | .363 .002 | .522 .003 | .473 .002 | .427 .003 | .491 .002 | .564 .003 |
| YAGO3-10 | CoDEx-L | Hetionet | |||||
|---|---|---|---|---|---|---|---|
| Model | Sampler | MRR | H@10 | MRR | H@10 | MRR | H@10 |
| TransE | Uniform | .442 .002 | .610 .003 | .251 .003 | .402 .004 | .288 .003 | .452 .004 |
| EMU | .470 .002 | .638 .003 | .273 .002 | .429 .003 | .311 .002 | .479 .003 | |
| FlowNeg | .498 .002 | .669 .003 | .294 .002 | .457 .003 | .335 .002 | .510 .003 | |
| RotatE | Uniform | .493 .001 | .658 .002 | .283 .002 | .439 .003 | .312 .002 | .487 .003 |
| EMU | .527 .002 | .690 .003 | .308 .002 | .468 .003 | .341 .002 | .519 .003 | |
| Model | Dataset | FlowNeg | EMU | IF-NS |
|---|---|---|---|---|
| RotatE | FB15k-237 | .001 | .002 | .002 |
| RotatE | WN18RR | .002 | .002 | .002 |
| RotatE | YAGO3-10 | .001 | .002 | .002 |
| RotatE | CoDEx-L | .002 | .002 | .002 |
| RotatE | Hetionet | .001 | .002 | .002 |
| TransE | YAGO3-10 | .002 | .002 | .003 |
| Seed | Uniform | EMU | IF-NS | FlowNeg selected | Selected epoch | FlowNeg final |
|---|---|---|---|---|---|---|
| 0 | .326 | .343 | .338 | .357 | 271 | .360 |
| 1 | .327 | .345 | .339 | .358 | 278 | .359 |
| 2 | .330 | .347 | .342 | .359 | 274 | .359 |
| 3 | .331 | .348 | .343 | .360 | 282 | .357 |
| 4 | .329 | .346 | .341 | .359 | 269 | .358 |
| 5 | .330 | .347 | .342 | .360 | 276 | .360 |
| Quantity | Result |
|---|---|
| positive mean differences | 25/25 |
| Holm-adjusted | 23/25 |
| mean cell difference | +.0395 |
| median cell difference | +.0418 |
| minimum / maximum | +.0178 / +.0582 |
| null or negative means | 0 |
| Variant | MRR | H@10 | NDS | HPC (%) | GI |
|---|---|---|---|---|---|
| FlowNeg | .357 | .556 | 45.3 | .5 | .89 |
| w/o collision discount | .341 | .538 | 43.1 | 2.7 | .93 |
| w/o type compatibility | .348 | .545 | 38.6 | .6 | .87 |
| w/o hardness | .308 | .488 | 47.1 | .2 | .18 |
| flat entity selection | .350 | .548 | 31.2 | .5 | .85 |
| no warm-up ( ) | .346 | .541 | 39.7 | .7 | .81 |
| Sampler | NDS ind | UER | ESS | T10 | IPD |
|---|---|---|---|---|---|
| Uniform | 46.9 | 0.887 | 204.8 | 0.061 | 0.912 |
| Self-Adv | 15.1 | 0.327 | 58.7 | 0.286 | 0.483 |
| KBGAN | 10.7 | 0.246 | 41.2 | 0.371 | 0.421 |
| NSCaching | 17.4 | 0.351 | 65.3 | 0.259 | 0.512 |
| SANS | 24.8 | 0.446 | 89.6 | 0.203 | 0.604 |
| EMU | 20.6 | 0.384 | 73.8 | 0.237 | 0.557 |
| Model | Dataset | FlowNeg | EMU | IF-NS |
|---|---|---|---|---|
| RotatE | FB15k-237 | 43.8/.792 | 20.6/.384 | 24.2/.428 |
| RotatE | WN18RR | 44.6/.814 | 22.1/.412 | 25.0/.447 |
| RotatE | YAGO3-10 | 42.7/.765 | 18.9/.351 | 22.8/.402 |
| RotatE | CoDEx-L | 41.9/.748 | 19.7/.369 | 23.4/.416 |
| RotatE | Hetionet | 43.3/.781 | 20.2/.377 | 24.1/.433 |
| TransE | YAGO3-10 | 41.8/.756 | 18.4/.344 | 22.0/.395 |
| Dataset | |
|---|---|
| FB15k-237 | .024 |
| WN18RR | .018 |
| YAGO3-10 | .031 |
| CoDEx-L | .027 |
| Hetionet | .022 |
| Dataset | Prev. (%) | AUROC | AUPRC | prev | Raw ECE |
|---|---|---|---|---|---|
| FB15k-237 | 0.50 | 0.887 | 0.081 | 16.2 | 0.024 |
| WN18RR | 0.35 | 0.841 | 0.052 | 14.9 | 0.018 |
| YAGO3-10 | 0.70 | 0.902 | 0.118 | 16.9 | 0.031 |
| CoDEx-L | 0.85 | 0.873 | 0.126 | 14.8 | 0.027 |
| Hetionet | 0.60 | 0.861 | 0.092 | 15.3 | 0.022 |
| Dec. | FB15k | WN18 | YAGO | CoDEx | Hetio. |
|---|---|---|---|---|---|
| 1 | 0.30/0.00 | 0.20/0.00 | 0.40/0.00 | 0.40/0.05 | 0.30/0.00 |
| 2 | 0.50/0.05 | 0.40/0.00 | 0.70/0.10 | 0.60/0.10 | 0.50/0.05 |
| 3 | 0.80/0.10 | 0.60/0.05 | 1.00/0.15 | 0.90/0.20 | 0.80/0.10 |
| 4 | 1.10/0.15 | 0.80/0.10 | 1.40/0.20 | 1.30/0.30 | 1.10/0.20 |
| 5 | 1.50/0.25 | 1.10/0.15 | 1.90/0.30 | 1.80/0.40 | 1.50/0.30 |
| 6 | 2.00/0.35 | 1.50/0.20 | 2.60/0.40 | 2.40/0.60 | 2.00/0.40 |
| Method | Time (h) | Peak VRAM (GB) | MRR |
|---|---|---|---|
| Uniform | 2.1 | 4.2 | .328 |
| Self-Adv | 2.3 | 4.4 | .338 |
| NSCaching | 3.1 | 5.1 | .332 |
| KBGAN | 5.8 | 7.8 | .331 |
| EMU | 3.4 | 4.9 | .345 |
| IF-NS | 8.7 | 12.4 | .340 |
| Final checkpoint | Validation-selected | |||||
|---|---|---|---|---|---|---|
| Method | 2.1 h | 3.4 h | 4.2 h | 2.1 h | 3.4 h | 4.2 h |
| Uniform | .328 | .329 | .329 | .329 | .330 | .330 |
| Self-Adv | .333 | .338 | .339 | .335 | .340 | .340 |
| KBGAN | .319 | .330 | .333 | .321 | .332 | .334 |
| NSCaching | .326 | .334 | .334 | .328 | .336 | .336 |
| SANS | .325 | .330 | .331 | .327 | .332 | .333 |
KG Embedding
Knowledge graph embedding (KGE) represents entities and relations as vectors or structured geometric objects for prediction and reasoning.
See all 56 papers