File size: 2,073 Bytes
f7508fd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0130c25
f7508fd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
language: en
tags:
- graph-neural-networks
- combinatorial-optimization
- tsp
- floydnet
- diffusion-models
- pytorch
license: mit
datasets:
- ocxlabs/FloydNet_TSP_demo
---

# FloydNet (Metric TSP / Euclidean TSP)

## Model Summary

**FloydNet** is a graph reasoning architecture designed to mimic the execution of algorithms via a learned, global Dynamic Programming operator. This checkpoint (`_euc`) is trained to solve the **Metric (Euclidean) Traveling Salesman Problem**, where edge weights are defined by Euclidean distances between 2D coordinates.

FloydNet operates directly on the pairwise relationship tensor (distance matrix), learning to refine global dependencies without explicit geometric engineering.

## Model Details

* **Model ID:** `ocxlabs/FloydNet_TSP_euc`
* **Architecture:** FloydNet (Deep relational layers with Pivotal Attention)
* **Task:** Metric Traveling Salesman Problem (Euclidean)
* **Paper:** [FloydNet: A Learning Paradigm for Global Relational Reasoning](https://arxiv.org/abs/2601.19094)
* **Demo Dataset:** [ocxlabs/FloydNet_TSP_demo](https://huggingface.co/datasets/ocxlabs/FloydNet_TSP_demo)

## Performance

On Metric TSP instances (N=100-200), FloydNet matches the performance of specialized geometric heuristics:
* **Robustness:** Maintains robust performance (>96% optimality) within the training distribution ($N \le 100$).
* **Generalization:** effectively generalizes to larger unseen graph sizes.

## Usage: Inference & Evaluation

### 1. Preparation
Download the demo dataset from [Hugging Face](https://huggingface.co/datasets/ocxlabs/FloydNet_TSP_demo). Unzip it and place the extracted folder under `example/data/`.

### 2. Inference
Run inference in `--test_mode` using `torchrun`. Ensure `--subset` is set to `euc` and the checkpoint path matches.

```bash
source .venv/bin/activate
cd example

torchrun \
  --nproc_per_node=8 \
  -m TSP.run \
  --subset euc \
  --output_dir ./outputs/TSP_euc \
  --load_checkpoint path/to/TSP_euc/epoch_01000.pt \
  --test_mode \
  --split_factor 1 \
  --sample_count_per_case 10