#!/usr/bin/env bash # Synthetic natural-language two-hop task (Section 5.2 / Figure 4, Appendix A.3 / # Figure 6): K=2, 5000 epochs, direct or reverse question format. # discoloop DiscoLoop with a learned gate # vanilla looped transformer without the discrete channel (zero gates) # noloop non-looped baseline: 2 untied copies of the blocks (stacking) # # Usage: scripts/nl_2hop.sh {direct|reverse} {discoloop|vanilla|noloop} [train_twin_hyper_real.sh options] # e.g. scripts/nl_2hop.sh reverse discoloop --gpus 2,3 --seed 8 set -euo pipefail cd "$(dirname "${BASH_SOURCE[0]}")/.." usage() { echo "Usage: $0 {direct|reverse} {discoloop|vanilla|noloop} [train_twin_hyper_real.sh options]" >&2 exit 1 } case "${1:-}" in direct) MAX_LENGTH=8 ;; reverse) MAX_LENGTH=16 ;; # reverse two-hop sequences are 14-15 tokens long *) usage ;; esac FORMAT="$1" case "${2:-}" in discoloop) MODEL_ARGS=(--design looping --num-stages 2 --gate-mode learned) ;; vanilla) MODEL_ARGS=(--design looping --num-stages 2 --gate-mode fixed --fixed-alpha 0 --fixed-beta 0) ;; noloop) MODEL_ARGS=(--design stacking --num-stages 2 --gate-mode fixed --fixed-alpha 0 --fixed-beta 0) ;; *) usage ;; esac shift 2 exec ./train_twin_hyper_real.sh \ --data "multi-hop/data/custom/two_graph_${FORMAT}" \ --max-length "$MAX_LENGTH" \ --epochs 5000 \ --loss-compute-method answer \ "${MODEL_ARGS[@]}" \ "$@"