The graph input is an NPZ file containing x with shape [N,F] and a binary,
symmetric adj with shape [N,N] and a zero diagonal. Features must use the
same preprocessing and dimensionality as the trained model. An optional boolean
mask of length N identifies valid nodes in a padded graph.
Export a preprocessed test example:
python -m gsmark sample --config configs/computers.yaml \
--split test --seed 0 --output results/example.npzThe CLI uses dense adjacency for individual input graphs; choose a graph size that fits memory. Dataset processing retains the complete source graph as CSR and creates dense batches only after subgraph sampling.
Training creates an owner key under the run directory. To generate a key before training and select it explicitly:
python -m gsmark keygen --key-output results/owner-key.npy
python -m gsmark train --config configs/computers.yaml \
--key results/owner-key.npy --seed 0 --device cuda:0Generate 64 public watermark bits independently:
python -m gsmark keygen --watermark-output results/watermark.npyKey and watermark files are separate NPY vectors. Keys use file mode 0600;
new key, watermark and graph outputs refuse to overwrite existing files.
Preserve the owner key used to train the embedding checkpoint.
python -m gsmark embed \
--checkpoint results/computers/seed-0/checkpoint.pt \
--graph results/example.npz --watermark results/watermark.npy \
--key results/computers/seed-0/owner-key.npy \
--output results/watermarked.npz --device cuda:0This updates the node signal and preserves adjacency. Embedding uses the latent posterior mean for deterministic inference.
python -m gsmark export \
--checkpoint results/computers/seed-0/checkpoint.pt \
--output results/extractor.ptThe exported file contains the extractor, public watermark projection and architecture settings. The embedding network, key projection, task model and private key are excluded.
python -m gsmark verify --checkpoint results/extractor.pt \
--graph results/watermarked.npz --watermark results/watermark.npy \
--device cuda:0This returns a raw cosine score using the candidate graph and watermark. Calibrate the same detector and watermark on held-out unwatermarked signals:
python -m gsmark calibrate --config configs/computers.yaml \
--checkpoint results/extractor.pt --watermark results/watermark.npy \
--output results/calibration.npy --trials 256 --device cuda:0The command uses the reserved calibration partition and saves null scores plus a JSON manifest identifying the detector, watermark, data and sampling seed. Then obtain a p-value and decision:
python -m gsmark verify --checkpoint results/extractor.pt \
--graph results/watermarked.npz --watermark results/watermark.npy \
--null-scores results/calibration.npy --alpha 0.01 --device cuda:0The evaluation command saves evaluation/null-scores.npy calibrated to its
own evaluation/watermark.npy. Use those files together; a newly generated
watermark needs its own calibration. The verifier checks a calibration manifest
when one is present; a standalone NPY null-score array is also accepted.
The protocol
defines the null construction and significance rule. Device options also
accept cpu.