GRAFT contains code and shell drivers for gradient-free editing experiments on graph neural networks.
run_*.shscripts live underablations/,editing_pipelines/, andseed-gnn/and are the usual entrypoints for batch jobs.- Path defaults: Repo-root
paths.pyandpaths.shsetPATH_TO_GRAFT(default: the repository containing those files, typically/home/model_editing/GRAFT) andPATH_TO_DATA(default/home/model_editing/data). Shell driverssource paths.sh; override locations with env vars (DATASET_DIR,PRETRAIN_DIR, etc. still work as documented in each script). - Dataset preparation: Import raw graphs dataset-by-dataset from the canonical repos, preprocess to match this codebase’s CSV layout under
DATASET_DIR(seepaths.sh), and respect each publisher’s license.- GADBench — anomaly / fraud benchmarks used here include YelpChi (mapped as yelp) and T‑Finance (mapped as tfinance); use its datasets tree and preprocessing notebook as in that README.
- GraphLand — regression targets such as artnet-views and twitch-views (
run_node_regression.sh): follow data plusdataset.py/PyGDatasetin that repo. - Pokec — take the release from GUIDE (KDD 2022; Group Equality Informed Individual Fairness in GNNs): files live under dataset (pokec is distributed zipped there—unzip before use), then convert to this repo’s CSV layout under
DATASET_DIR. - Bail — take the fairness benchmark graphs from NIFTY (Towards a Unified Framework for Fair and Stable Graph Representation Learning, arXiv:2102.13186): data live under dataset (that repo README notes large edge bundles may be zipped), then preprocess to match
DATASET_DIRlocally.
- More detail on layout and configs: editing_pipelines/README.md, seed-gnn/README.md.
The working environment is captured as conda env gnn_edit:
- Full conda solve (recommended) — reproduces Python, CUDA-related conda packages, and pip extras:
conda env create -f environment.yml
conda activate gnn_edit- Pip-only pin list —
requirements.txtlists PyPI packages as pinned in that env. Some lines (PyTorch+cu118,pyg-lib/torch-scatter, etc.) normally need the official PyTorch / PyG wheel indexes; ifpip install -r requirements.txtfails on those, install them the way PyTorch and PyG document for your CUDA version, or stick toenvironment.yml.
environment.yml was produced with conda env export -n gnn_edit --no-builds and without the prefix: field so paths stay machine-agnostic.
Hub
run_edit.sh— Wrapsrun_edit.py: method, dataset, model, seed, target counts, max steps, strategies, and data/pretrain/output paths. Reads optional hyperparameters from the environment (LAMBDA_REG,TOP_FRACTION,NUM_LAYERS,GAMMA_RETAIN,FT_EPOCHS,FT_LR,PR_ALPHA,RANK_MIX_TAU). SetsPYTHONPATHviapaths.sh.
Parameter sweeps (loop and call run_edit.sh)
run_editing_suite.sh— Large least-squares grid: λ, top fraction, depth, manyLS_STRATEGYmodes. Usesrun_edit.shwith--debug.run_seed_gnn.sh— Seed-GNN baseline over datasets, models, seeds, top fractions, depth (NUM_LAYERS/LAYERS_OVERRIDE).run_egnn.sh— EGNN baseline; same idea, optionallayers_<n>/top_<frac>paths when layers are overridden.run_finetune.sh— Finetune baseline over models, seeds, top fraction,FT_EPOCHS/FT_LR, and depth.
run_feature_ablation_all_checkpoints.sh— Findsmetrics_*.jsonunderOUTPUT_ROOTfor pokec / bail / yelp, GCN_MLP / GIN_MLP / Polynormer, and methods leastsquares / finetune / egnn / seed_gnn. Delegates tolaunch_feature_ablation_from_metrics.py→feature_ablation_forward.py. SupportsFEATURE_ABLATION_FILTER_*,DRY_RUN=1, andFEATURE_ABLATION_SKIP_EXISTING.
run.sh— Main vanilla pretraining loop: configure thedatasets,models,seeds, andnum_layersarrays plus optional feature-ablation block at the top of the script, then it callsscripts/pretrain/seed_gnn/<dataset>.shper combination (two path arguments: output root and dataset dir appear as~/data/seed_gnn_data/~/data/seed_gnn_data/datasetin the defaults—adjust to match yourpaths.shlayout). Accepts--architectures,--gat_optimized,--neighbor_batch_size, and--neighbor_num_neighborsforwarded to each pretrain invocation.run_node_regression.sh— Pretrain on node-regression sets (e.g. twitch-views, artnet-views); sweeps gcn/sage/gin/gat, seeds, depth viascripts/pretrain/seed_gnn/.run_feature_drop_pretrain_suite.sh— Pretrain with one sensitive column dropped per dataset (default pokec/bail/yelp/tfinance), aligned with editing suite attribute names; outputs underedit_ckpts_feature_ablated/.../no_<feature>/. Arguments after--forward tomain.py.run_feature_drop_pretrain_regression.sh— Same pattern for regression graphs and their sensitive columns.
