--- license: mit pretty_name: Semantic Potential Routing Telemetry language: - en task_categories: - time-series-forecasting - tabular-regression - graph-ml tags: - networking - routing - graph-theory - operations-research - physics-based-simulation - telemetry - microbursts - data-center-networks - benchmark - synthetic size_categories: - 100M 0 at every non-sink node, Σ_j I_ij = b_i > 0: at least one current is positive and every positive-current link leads strictly downhill, so both potential rules are loop-free and reach the sink in at most N − 1 hops for *any* congestion pattern — congestion bends routes but can never trap a packet. Proportional splitting is the physically faithful rule (electrical current divides over parallel paths); it uses a low-discrepancy per-packet coordinate so that the split is exact and the simulation stays deterministic. **Baselines.** `shortest_path` is the classic link-state behaviour, blind to capacity and queues but reacting to failures. `ecmp` spreads packets over all equal-cost paths, the data-centre default. The adaptive baseline recomputes Dijkstra each step with link cost latency + queue/capacity, the queue-aware policy that famously oscillates; its `route_changes` make that visible. Together with `potential_static`, the suite separates the value of capacity awareness, congestion awareness and multipath. On the defaults, at moderate load with microbursts, mean loss over episodes is about 1 % for `potential`, under 0.5 % for `potential_split` and `adaptive_shortest_path`, 2–3 % for `potential_static` and around 10 % for `shortest_path` and `ecmp`. At heavy load every router loses packets: a few percent for the adaptive ones, about 20 % for the static potential field and a third or more for shortest path and ECMP. The multipath and static potential variants pay for their robustness with longer paths (path stretch about 1.4–1.5 against 1.2 for the others), and the adaptive routers change next hops several orders of magnitude more often than the static baselines. ## Generating the dataset Any Python ≥ 3.9 environment works; the commands below are written with forward slashes, which both PowerShell and POSIX shells accept. ```bat cd "" pip install -r requirements.txt ``` Check the whole pipeline end to end in about a minute — fifteen short episodes covering every topology family, traffic profile and router in a temporary folder that is deleted afterwards: ```bat python scripts/run_local_sweep.py --smoke ``` Generate the dataset (5,400 episodes on every logical core, shards of 40 episodes streamed to `data/`): ```bat python scripts/run_local_sweep.py ``` An episode costs roughly 3–7 s of CPU at size 32, 6–13 s at 64, 20–35 s at 128 and 60–100 s at 256 (six routers, 1 000 steps; heavier load and larger fabrics cost more), i.e. about 4–5 CPU-hours per replicate: expect the default run to take **one night on an 8-core laptop** and to write about 20 GB. Keep the machine plugged in with sleep disabled. The sweep prints progress with an ETA, and if it is interrupted, running the same command again resumes with the missing shards; when it finishes it writes `data/manifest.json` (provenance, coverage, table sizes) and prints the router benchmark. `data/config.json` binds the folder to its configuration, so a changed setting must go to another `--out` folder. Every design level and model knob is a flag (`python scripts/run_local_sweep.py --help`). A half-size run with exact 60/20/20 splits, a smaller design, or a potential-field-only run: ```bat python scripts/run_local_sweep.py --replicates 5 python scripts/run_local_sweep.py --sizes 32,64 --topologies barabasi_albert,fat_tree --out data_small python scripts/run_local_sweep.py --routers potential,shortest_path --out data_pair ``` Requirements: Python ≥ 3.9 with NumPy, SciPy, pandas, PyArrow, NetworkX, huggingface_hub and, for the figures, Matplotlib (`requirements.txt`). Workers use one BLAS thread each; all parallelism comes from the process pool. ## Validating a generated dataset `scripts/validate_dataset.py` is the test suite of a data folder. It re-derives every quantity it can from an independent path and compares, rather than merely re-reading what the generator wrote: ```bat python scripts/validate_dataset.py :: validates data/ python scripts/validate_dataset.py --out data_small --resimulate 5 ``` | Group | What is checked | |---|---| | Structure | every table has the same number of shards; `manifest.json` present | | Design coverage | all cells present, replicates balanced to ±1, episode ids unique, the three splits present | | Invariants | `offered = delivered + dropped + in_flight`; loss ratio in [0, 1]; `mean_delay ≥ min_latency` and `mean_hops ≥ min_hops`; delay quantiles ordered; `mean_delay = mean_queueing_delay + mean_path_latency`; `flow_summary` sums to `router_summary`; `network_telemetry` and `flow_telemetry` sum to their summaries per (episode, router[, flow]); `admitted ≤ offered` on every step; link utilisation and saturation in [0, 1] | | Physical bounds (sampled episodes) | buffer occupancy within `buffer_size`; per-node drops sum to the step total; link loads never exceed the capacity in force at that step (recomputed from `episodes` + `events`); potentials non-negative and exactly 0 at each flow's sink | | Reproducibility | sampled episodes re-simulated from `config.json` alone and compared **bit for bit**, every table and column (NaN equal to NaN) | | Field reconstruction | one stored `potential_field` snapshot recovered from the graph state and queue depths with the sparse SuperLU reference solver, independent of the pseudo-inverse path used by the generator | Sampled episodes are the smallest, the largest and one drawn at random (`--seed`); `--resimulate` sets how many are re-simulated. Every line is printed as `[ok ]` or `[FAIL]`, the script exits **1** with a summary of the failures if anything is wrong, and a failing cross-table sum names the first group that differs (abridged output of a full default run): ``` Structure [ok ] 135 shards present [ok ] every table has every shard [ok ] manifest.json present Design coverage [ok ] all 540 design cells present [ok ] balanced: 10-10 episodes per cell [ok ] episode ids unique [ok ] splits present: ['test', 'train', 'validation'] Invariants [ok ] flow conservation: offered = delivered + dropped + in-flight ... [ok ] tracked-flow telemetry sums to the flow summary [ok ] admitted <= offered Physical bounds (sampled episodes) [ok ] episode 0: queue depths within the buffer [ok ] episode 0: link loads never exceed the capacity in force [ok ] episode 0: potentials non-negative and zero at the sinks Reproducibility (re-simulating from config.json) [ok ] episode 0: every table reproduced bit for bit Potential-field reconstruction (sparse reference solver) [ok ] episode 0, step 100: stored field matches the sparse solve (max rel err 4.5e-08) Dataset v2.0: 5400 episodes, 20.14 GB All checks passed. ``` **Memory.** The cross-table checks never load a step-level table. The shards are scanned one record batch at a time (`--batch-rows`, default 262,144) and folded into a dense accumulator whose size is fixed by the design — episodes × routers × tracked flows, about 260 k slots — not by the 260 M rows being read. Peak resident memory is therefore flat in dataset size: **well under 1 GB** for the full 20 GB dataset, of which the PyArrow buffers are about 20 MB. The invariant pass costs roughly a minute per 10 GB on one core; the re-simulation of a few episodes dominates the total runtime. A quick end-to-end rehearsal of generation *and* validation, in about two minutes: ```bat python scripts/run_local_sweep.py --out data_tiny --sizes 32 --replicates 5 --steps 200 --shard_episodes 25 python scripts/validate_dataset.py --out data_tiny python examples/benchmark_routers.py --data data_tiny ``` ## Using the data ```python import numpy as np, pandas as pd rs = pd.read_parquet("data/router_summary") ep = pd.read_parquet("data/episodes").set_index("episode_id") df = rs.join(ep[["topology", "size", "traffic_profile", "load_level", "dynamics_level", "split"]], on="episode_id") print(df.pivot_table(index=["traffic_profile", "load_level"], columns="router", values="loss_ratio")) # One episode, step by step eid = 7 net = pd.read_parquet("data/network_telemetry", filters=[("episode_id", "=", eid), ("router", "=", "potential")]).sort_values("step") queue = np.stack(net.queue_depth).astype(np.int32) # (steps, n_nodes); int16 on disk link = pd.read_parquet("data/link_telemetry", filters=[("episode_id", "=", eid), ("router", "=", "potential")]).sort_values("step") load = np.stack(link.load_uv).astype(np.int32) + np.stack(link.load_vu) # (steps, n_edges), both directions field = pd.read_parquet("data/potential_field", filters=[("episode_id", "=", eid)]).sort_values("step") row = ep.loc[eid] phi = np.stack(field.potential).reshape(-1, row.tracked_flows, row.n_nodes) # (snapshots, tracked flows, nodes) ``` The graph state at any step — the N × N capacity matrix in force — follows from `episodes` and `events`: ```python def capacity_matrix(row, events, step): cap = row.capacity.astype(float).copy() factor, failed = np.ones(row.n_nodes), np.zeros(len(cap), bool) for e in events[(events.start <= step) & (step < events.end)].itertuples(): if e.kind == "node_degradation": factor[e.node] *= e.factor else: failed |= (row.edge_u == e.edge_u) & (row.edge_v == e.edge_v) cap = np.maximum(1, np.floor(cap * factor[row.edge_u] * factor[row.edge_v])) cap[failed] = 0 A = np.zeros((row.n_nodes, row.n_nodes)) A[row.edge_u, row.edge_v] = A[row.edge_v, row.edge_u] = cap return A events = pd.read_parquet("data/events", filters=[("episode_id", "=", eid)]) A = capacity_matrix(row, events, step=500) ``` The same reconstruction, the telemetry of any router and an exact recomputation of the field of any flow at any step are one call each in the read API: ```python from src.dataset import Dataset ds = Dataset("data") ep = ds.episode(7) A = ep.capacity_matrix(500) # the graph state at step 500 queue = ep.queue_depth("potential") # (steps, n_nodes) phi = ep.solve_field(500, flows=[0, 1, 2]) # exact field of any flows at any step path = ep.descent_path(500, phi[0], ep.source[0], ep.sink[0]) ``` `scripts/validate_dataset.py` checks such recomputations against the sparse SuperLU reference solver. From the Hub, each table is a configuration: ```python from datasets import load_dataset rs = load_dataset("/", "router_summary", split="train") ``` Suggested uses: benchmarking routing policies on identical scenarios; forecasting queue build-up, drops or link saturation from step-level telemetry (`network_telemetry`, `link_telemetry`); learning graph surrogates of the potential field or of the routers' next-hop decisions (`potential_field` plus the graph state); studying route flapping of adaptive policies (`route_changes`); and out-of-distribution evaluation across topology families, sizes or dynamics levels using the factor columns of `episodes`. ## Examples `examples/` holds four scripts written against the small read API in `src/dataset.py` — `Dataset(path)` opens a data folder, `ds.table(name, columns, filters)` and `ds.summary(name)` return tables (the latter joined with the design factors and split), and `ds.episode(id)` bundles one episode: its graph, event timeline and flows, the capacities in force at any step (`capacity_at`, `live_graph`, `capacity_matrix`), its telemetry under any router (`queue_depth`, `node_dropped`, `link_load`, `link_utilisation`), the stored field (`field`) and an exact recomputation of the field of *any* flow at *any* step (`solve_field`, `next_hops`, `descent_path`). Every script runs on `data/` by default (`--data` selects another folder), prints its results, asserts the properties it relies on and ends with "All checks passed", so the set also serves as a usage test of a generated dataset. ```bat python examples/benchmark_routers.py :: paired router comparison with bootstrap intervals, per factor python examples/inspect_episode.py --episode 7 --step 500 python examples/forecast_congestion.py :: ridge forecast of near-term loss on the splits python examples/visualize.py :: eight figures into figures/ ``` ### `benchmark_routers.py` — paired router comparison Compares every router with a reference (`--reference`, default `shortest_path`) on the identical episodes: mean loss and delay differences with 95 % bootstrap confidence intervals, win and tie rates, the loss ratio broken down by each design factor, and flow-level path stretch, latency stretch and queueing delay. `--csv figures/benchmark.csv` writes the per-episode joined summary. Abridged output: ``` Paired differences to 'shortest_path' (negative = better; bootstrap 95 % CI over episodes): episodes loss_diff loss_ci_low loss_ci_high wins_loss delay_diff wins_delay router adaptive_shortest_path 675 -0.0770 -0.0863 -0.0681 0.4593 -0.8561 0.5837 ecmp 675 -0.0082 -0.0107 -0.0059 0.3096 -0.1613 0.5244 potential 675 -0.0685 -0.0766 -0.0601 0.4607 0.3886 0.3615 potential_split 675 -0.0828 -0.0924 -0.0734 0.4637 2.6682 0.1630 potential_static 675 -0.0409 -0.0472 -0.0352 0.4074 1.0377 0.1733 Flow level (flows with at least one delivered packet): flows lossless_share path_stretch latency_stretch queueing_delay p99_delay potential 38879 0.9174 1.2646 1.2213 0.2678 11.0834 potential_split 38879 0.9505 1.4912 1.6238 0.1118 23.9248 potential_static 38879 0.8506 1.4371 1.2912 0.5299 11.4198 shortest_path 38879 0.7846 1.2540 1.0038 1.6477 11.1648 ecmp 38879 0.7945 1.2541 1.0038 1.5072 11.2295 adaptive_shortest_path 38879 0.9359 1.1999 1.0494 0.2220 9.3849 ``` Read it as: the potential routers and the adaptive baseline cut loss by 4–8 percentage points against shortest path; the multipath split trades 2.7 steps of extra delay and 49 % path stretch for the lowest loss of all; the win rates are below 0.5 only because at light load more than half the episode pairs are exact ties (`ties_loss`, printed in the full table). The numbers above come from the two-minute rehearsal run (675 size-32 episodes, 200 steps), so they are noisier and lossier than a full sweep — the *ordering* of the routers is what reproduces. ### `inspect_episode.py` — one episode, checked against the physics Prints the design cell, graph, flows, event timeline and router summary; then, at one step, the capacities in force, the busiest buffers and links; recomputes the tracked flows' potential field from the graph state and queue depths and asserts it against the stored snapshot *and* the sparse reference solver; and follows one flow's steepest-current descent to its sink. ``` Episode 7 [barabasi_albert/32/poisson/heavy/moderate] 32 nodes, 87 links, 64 flows, 200 steps, split=train degree min/mean/max 3/5.44/16, capacity 8-80 pkt/step, latency 1-10 steps, total directed capacity 7678 pkt/step flows: 64 between 32 endpoints, offered load rho = 0.100, tracked flows 8, field stride 1 Topology events (1): kind start end node factor node_degradation 72 128 6 0.4374 Step 100: 0 failed links, 9 links with reduced capacity, 87 live links busiest buffers under potential: node 0: 256, node 4: 189, node 6: 142 [ok] potential field of the 8 tracked flows recomputed from graph state + queues (max rel dev 4.9e-08) [ok] pseudo-inverse solution agrees with the sparse SuperLU solve for flow 0 [ok] steepest-current descent of flow 0 reaches its sink: 12 -> 1 -> 7 (2 hops, shortest possible 2); potentials 0.4934 > 0.4433 > 0.0000 ``` The last line is the loop-freedom guarantee made concrete: the potential decreases strictly along the path and the walk terminates at the sink. ### `forecast_congestion.py` — a learning task on the splits Predicts the network's loss ratio over the next `--horizon` steps from the last `--window` steps of `network_telemetry`, normalised by `total_capacity` so all sizes share one feature scale, with a closed-form ridge regression tuned on validation and reported on test against a persistence baseline: ``` data/: router potential, window 10, horizon 10, stride 5 samples: train 14,985 (405 episodes), validation 4,995 (135), test 4,995 (135); features 52 Ridge penalty chosen on validation: lambda = 0.0001 (validation RMSE 0.0270) MAE RMSE R2 ridge (validation) 0.0096 0.0270 0.8405 persistence (validation) 0.0091 0.0325 0.7689 ridge (test) 0.0099 0.0268 0.8285 persistence (test) 0.0096 0.0342 0.7215 ``` As a squared-loss model the ridge wins on RMSE and R² while persistence keeps a marginally lower MAE on the many loss-free windows — a useful reminder to state the metric before claiming a win. The script asserts that the splits are disjoint by episode and that no feature is undefined. ### `visualize.py` — the figure gallery Draws eight PNGs into `figures/` (`--out`) with one fixed palette in which every router keeps its hue. Select a subset with `--figures`, and steer the single-episode panels with `--episode` (default: a busy one), `--step`, `--flow`, `--routers` (default `potential,shortest_path`) and `--dpi`: ```bat python examples/visualize.py --data data_small --figures potential_field,timeline --episode 12 --step 400 ``` | File | Shows | |---|---| | `topologies.png` | one graph per family, link width scaled by capacity | | `benchmark.png` | loss and mean delay per router at each load level, 95 % bootstrap intervals | | `timeline.png` | one episode step by step under two routers, with bursts and topology events marked | | `queue_heatmap.png` | buffer occupancy of every node over time, same episode, two routers side by side | | `link_utilisation.png` | CCDF of per-link-step utilisation: how often links run near saturation, per router | | `potential_field.png` | the field of one flow on the graph, node size = buffer occupancy, with the steepest-current next hops and the descent path | | `delays.png` | flow-level p99 delay and path stretch per router | | `traffic_profiles.png` | offered packets of one flow under each of the three profiles | ![Router benchmark](figures/benchmark.png) ![Potential field](figures/potential_field.png) ![Buffer occupancy](figures/queue_heatmap.png) ![Episode timeline](figures/timeline.png) ## Reproducibility and provenance Episode `e` draws every random quantity from `numpy.random.default_rng([seed, e])` in a fixed order and the routers are deterministic, so `scripts/validate_dataset.py` can re-simulate any episode and compare it bit for bit. The generator also avoids the two places where platforms usually disagree: shortest-path next hops are derived from Dijkstra *distances* (exact, because latencies and the quantised adaptive costs are integer-valued) with a fixed tie rule rather than from the solver's predecessor tie-breaking, and the potential routers resolve mathematically tied currents — common on symmetric fabrics — within a relative tolerance far above rounding noise. All twenty sample episodes generated during development were bit-identical under NumPy 1.26 / SciPy 1.11 and NumPy 2.4 / SciPy 1.17. `data/config.json` records the configuration and `data/manifest.json` the dataset version, library versions, platform, design coverage and table statistics of the shards present. ## Limitations Traffic is open-loop (no TCP-like feedback), nodes have a single shared drop-tail buffer, all packets have the same size, time is discretised to 1 ms steps and capacities to whole packets per step, and the topologies are synthetic families rather than measured networks. Routing tables are recomputed instantaneously with global knowledge, which is an upper bound on what a distributed implementation can achieve. These choices keep the routers comparable and the episodes reproducible; they should be kept in mind when transferring conclusions to production networks. ## Publishing Uploading is the one manual step. Draw the figures this card embeds, log in once with a write token, then push the project folder — Parquet shards, `config.json`, `manifest.json`, this dataset card with its figures, and the generator and example source — as a dataset repository; the upload is resumable and its bookkeeping lives in `.cache/`: ```bat python examples/visualize.py hf auth login python scripts/push_to_huggingface.py --repo / ``` Add `--private` for a private repository. The `configs:` block at the top of this file makes every table browsable in the Dataset Viewer as soon as the upload finishes. ## Repository layout ``` ├── README.md dataset card and this guide ├── requirements.txt ├── .gitignore keeps generated data and caches out of git ├── src/ │ ├── design.py factors, levels, episode → cell / replicate / split │ ├── config.py every knob of the generator, one frozen dataclass │ ├── graph_generator.py five topology families, connectivity-preserving event timelines │ ├── physics_engine.py Laplacian potential field, routing gradient, multipath spraying, baselines │ ├── simulation_loop.py traffic, vectorised packet queueing, six routers, multiprocessing sweep │ ├── telemetry_logger.py Parquet schemas, sharded resumable writing, manifest │ └── dataset.py read API: tables, episodes, graph state and field at any step ├── scripts/ │ ├── run_local_sweep.py generate (automatic, resumable) │ ├── validate_dataset.py verify a generated dataset │ └── push_to_huggingface.py publish (manual) ├── examples/ │ ├── benchmark_routers.py paired router benchmark │ ├── inspect_episode.py one episode end to end, checked against the physics │ ├── forecast_congestion.py loss forecasting on the splits │ └── visualize.py figure gallery ├── figures/ drawn by examples/visualize.py └── data/ generated shards, one folder per table, plus config.json and manifest.json ``` ## Changelog **2.0** — full factorial design over five topology families, four sizes, three traffic profiles, three offered-load levels and three dynamics levels with balanced replicates and 60/20/20 splits; six routers (three potential-field variants, three classical baselines); two flows per endpoint with log-normal rates and offered load defined relative to network capacity; potential fields via the Laplacian pseudo-inverse (exact, O(N·F) per step); per-link loads, per-node drops, queueing/propagation delay decomposition, route changes, network-level per-step totals; manifest with provenance and coverage; validation script. **1.0** — 1,000 Barabási–Albert episodes with four flows, potential field vs. shortest path, six tables. Tooling fixes since the 2.0 data release (the Parquet schemas and the generated data are unchanged, so no regeneration is needed): the cross-table invariant checks in `scripts/validate_dataset.py` now stream the shards into a dense per-group accumulator instead of loading `flow_telemetry` into pandas, which exhausted memory on the full dataset, and they report the first group that differs when a sum disagrees; the potential-field figure widens the int16 `queue_depth` before scaling it into marker sizes, which previously overflowed and hid the busiest nodes. ## Design notes The original blueprint solved `L φ = b` on the full Laplacian, which is singular and only consistent when `b` sums to zero — a condition that congestion injections break. Grounding the sink removes the singularity, gives the sink its physical meaning as the well of the field and yields the loop-freedom guarantee above. Choosing the next hop by the largest current rather than the lowest neighbouring potential makes the decision conductance-aware, so a low-capacity or high-latency link is not chosen merely because its far end sits at a low potential. Telemetry is streamed straight to Parquet in atomic, resumable shards, which is what the Hub reads natively and makes a separate HDF5 staging layer unnecessary.