61  The theory behind each step

The book’s thesis, made explicit: one Jammi recipe is one equation in the monograph and one line in the GNN/conformal canon. The verticals carried short bridge notes; this chapter writes the full bridge — four signature chapters that each take one operation and show it is the same object at three altitudes, then run it live; the Neptune-contrast framing; and the verified citation map that pins every recipe to its sources.

Every signature below runs its call live and checks what it measured against the golden its tier’s chapter froze — at small scale in seconds on a CPU, at full scale over the data the findings are about.

import tempfile

import jammi
import numpy as np
from jammi_cookbook import datasets, keystone, scale
from jammi_cookbook.claims import claim

SCALE = scale.current()
db = jammi.connect(f"file://{tempfile.mkdtemp()}")
arxiv = datasets.arxiv(db, SCALE)
golden = keystone.subject_golden(db, arxiv)
embeddings = keystone.embed(db, arxiv, SCALE)
2026-10-03T07:42:01.640949Z  WARN jammi_kernels::admission: fused-kernel domain check failed; falling back to the eager composition op="attention_block_fused" predicate="head_dim_is_attention_block_fixed_head_dim"

61.1 Signature 1 — Propagation = low-pass graph filter = SGC/APPNP = vector-agg

The headline equivalence. One equation, three names, one call.

  • Monograph (Stanković et al. Part II (Stanković et al. 2019b)). A graph signal is filtered in the graph-spectral domain; smoothing toward neighbours is a low-pass filter — it attenuates the high-frequency (idiosyncratic per-node) component and keeps the low-frequency (shared-cluster) component.
  • GNN canon. That filter is a decoupled propagation layer. The weighting argument is the choice of filter:
    • weighting="uniform" = the random-walk operator \(\tilde{D}^{-1}\tilde{A}\) — SGC-flavoured (Wu et al. 2019);
    • weighting="degree_normalized" + alpha = symmetric-normalized propagation with a teleport restart, \((1-\alpha)\hat{A}\,H + \alpha\,X^{(0)}\) — this is APPNP (Gasteiger, Bojchevski, and Günnemann 2019);
    • output="jumping_knowledge" = stacking (concatenating) the filtered signal at every hop.
  • Jammi call. propagate_embeddings — and it is byte-identically deterministic by construction: a fixed (group, neighbour) f64 fold order, no seeding, identical across threads. The reproducible point on the construct→learn spectrum.

We demonstrate the equivalence, not assert it: the APPNP filter (degree_normalized + alpha) over the citation graph, measured downstream — same-subject retrieval precision.

propagated = keystone.propagate(db, arxiv, embeddings)
compared = db.eval_compare(
    embedding_tables=[embeddings, propagated], source=arxiv.papers, golden_source=golden, k=10
)
raw, prop = (e["embedding_eval"]["aggregate"]["precision_at_k"] for e in compared["per_table"])
print(f"precision@10 raw → APPNP-propagated: {raw:.3f} → {prop:.3f}   (Δ {prop - raw:+.3f})")
claim("propagation over the citations lifts same-subject precision@10", prop > raw)
precision@10 raw → APPNP-propagated: 0.403 → 0.427   (Δ +0.023)
✓ propagation over the citations lifts same-subject precision@10

61.2 Signature 2 — An edge is a self-search; a context set is a search/walk

Retrieval is the substrate of both graphs and prediction.

  • Monograph (Part I (Stanković et al. 2019a)). A kNN graph is built by, for every node, retrieving its nearest nodes — graph construction is retrieval.
  • GNN canon / Neural Process. A prediction’s context set is the same retrieval: the rows a Neural Process conditions on are a search/walk over the graph (Garnelo et al. 2018). The propagated embedding is that graph-conditioned context in vector form.
  • Jammi calls. build_neighbor_graph (the self-kNN edge) and assemble_context (the retrieval-conditioned context set) are the same retrieval primitive at two altitudes.

The derived neighbor graph is exactly this self-search: each edge records the retrieval that produced it — its similarity and its rank among the source row’s neighbours — and a paper’s edges are its top search hits.

graph = db.build_neighbor_graph(arxiv.papers, embedding_table=embeddings, k=10, exact=True)
edges = db.sql(f'SELECT src, dst, rank, similarity FROM "jammi.{graph}" ORDER BY src, rank')
first = edges.slice(0, 3).to_pylist()
print(f"self-kNN edges: {edges.num_rows}")
for edge in first:
    print(f"  {edge['src']} → {edge['dst']}  rank {edge['rank']}  similarity {edge['similarity']:.3f}")
self-kNN edges: 4000
  1522301498 → 2952132945  rank 1  similarity 0.999
  1522301498 → 2623491082  rank 2  similarity 0.998
  1522301498 → 2950726992  rank 3  similarity 0.998
claim("every derived edge records the retrieval that produced it",
      {"src", "dst", "rank", "similarity"} <= set(edges.column_names))
claim("and a paper's edges are its hits in rank order",
      [e["rank"] for e in first] == sorted(e["rank"] for e in first))
✓ every derived edge records the retrieval that produced it
✓ and a paper's edges are its hits in rank order

61.3 Signature 3 — Graph-supervised metric learning = contrastive fine-tune over walks

  • Monograph (Part III (Stanković et al. 2020)). Learning node representations from graph topology — the machine-learning-on-graphs part.
  • GNN canon. node2vec / DeepWalk’s skip-gram over biased random walks (Grover and Leskovec 2016), and the inductive aggregate-over-neighbours of GraphSAGE (Hamilton, Ying, and Leskovec 2017). The walk sampler turns the graph into positive pairs; the contrastive loss is the objective. Citation-graph contrastive supervision is SPECTER (Cohan et al. 2020); nearest-neighbor-of-own-representations contrastive learning is NNCLR (Dwibedi et al. 2021), which works via homophily, not circularity; SciNCL (Ostendorff et al. 2022) augments citation embeddings with exactly this kind of k-NN self-similarity graph.
  • Jammi call. fine_tune_graph — the edge_provenance knob names which graph supervises the metric: "declared" (who-cited-whom, external to the embedding metric) versus "similarity" (the k-NN-of-own-embeddings graph, drawn by the metric). The two are not equally informative, but neither is the similarity graph a no-op — see the measurement below.

The declared-graph fine-tune, measured against the base encoder (tier 03 runs the similarity and random controls beside it; at full scale the ordering is random < base < similarity < declared):

tuned = keystone.fine_tune_on_graph(
    db, arxiv, SCALE, edge_source=arxiv.cites, provenance="declared",
    epochs=keystone.FINE_TUNE_EPOCHS[SCALE],
)
ft_compared = db.eval_compare(
    embedding_tables=[embeddings, tuned], source=arxiv.papers, golden_source=golden, k=10
)
ft = ft_compared["per_table"][1]["embedding_eval"]["aggregate"]["precision_at_k"]
print(f"precision@10 base → declared-edge fine-tune: {raw:.3f} → {ft:.3f}")
if SCALE is scale.Scale.FULL:
    claim("the declared-edge fine-tune lifts same-subject precision@10", ft > raw)
precision@10 base → declared-edge fine-tune: 0.403 → 0.405

61.4 Signature 4 — A prediction is a context-conditioned posterior (the moat)

The tier with no monograph and no Neptune analogue — the non-redundant core.

This is the crux the tier-04 chapter works in full. The signature here is the moat’s worked example: the predictor fits a real posterior, and under the time-split the regression interval under-covers — the test era’s residuals run past anything the calibration era holds, so weighted conformal cannot repair it — while the classification set holds its coverage, the shift being orthogonal to its score.

predictor = keystone.train_year_predictor(db, arxiv, SCALE, propagated)
year = {
    r["paper_id"]: r["year"]
    for r in db.sql(f"SELECT paper_id, year FROM {arxiv.papers}.public.{arxiv.papers}").to_pylist()
}
cal_ids, test_ids = arxiv.split["valid"], arxiv.split["test"]
cal_mean, _ = keystone.predict_years(db, arxiv, predictor, cal_ids)
test_mean, _ = keystone.predict_years(db, arxiv, predictor, test_ids)
intervals = db.conformalize_interval(
    cal_mean.tolist(), [float(year[k]) for k in cal_ids], test_mean.tolist(), alpha=0.10
)
reg_cov = float(np.mean([lo <= year[k] <= hi for k, (lo, hi) in zip(test_ids, intervals)]))
print(f"posterior mean (cal era):      {np.mean(cal_mean):.2f}   (a real fit, no collapse)")
print(f"regression interval coverage:  {reg_cov:.3f}   (nominal 0.90)")
claim("the posterior is a real fit: its mean lies among the dataset's years",
      min(year.values()) <= np.mean(cal_mean) <= max(year.values()))
posterior mean (cal era):      2017.46   (a real fit, no collapse)
regression interval coverage:  0.938   (nominal 0.90)
✓ the posterior is a real fit: its mean lies among the dataset's years
if SCALE is scale.Scale.FULL:
    claim("the time split breaks the interval's coverage, at the scale it is about",
          reg_cov < 0.80, f"coverage {reg_cov:.3f}")

61.5 The Neptune-contrast framing

The book’s organizing conceit. Amazon Neptune is Database / Analytics / ML; this cookbook is Construct / Analyze / Learn / Predict & Quantify — the same “unified yet separate” spine, re-expressed as runnable Jammi computation, plus a fourth tier Neptune structurally lacks: calibrated, provenance-stamped, context-conditioned prediction.

Stated plainly:

  • Tiers 01–03 are roughly Neptune-parity (commodity). Neptune loads a graph and runs CALL neptune.algo.* (pageRank / degree / wcc) over it; Jammi constructs the similarity graph from text and registers the declared graph beside it, then propagates and learns over it. Same operations, expressed as substrate computation. Neptune uses Air Routes for its queries/algorithms — so does this cookbook’s on-ramp.
  • Tier 04 + bring-your-own-graph is the non-redundant core. A graph-conditioned prediction with an honest, audited coverage guarantee has no Neptune analogue. Neptune switches datasets when it reaches ML — and so do we, to ogbn-arxiv, for a credible learn/predict tier; the Air Routes on-ramp stops at tier 02 (its label is near-deterministic from lat/lon, too thin for a learn tier).

(Neptune is a public product named here only as a contrast; it is a competitor’s product, not a Jammi consumer — the engine names no consumer.)

61.6 The verified citation map

Every citation below was independently verified (author / year / venue) against the primary source — not trusted from a secondary summary. Each is backed by a references.bib entry, and a test (tests/test_citation_map.py) asserts that every row’s Jammi call is a verb that actually exists in the grounded API reference and that no @cite dangles. The table renders from the same citation_map data the test checks, so the rendered map and the asserted map cannot diverge.

Recipe Monograph (Stanković et al.) GNN / conformal canon Jammi call
01 construct — kNN similarity graph Part I — graph construction, the Laplacian, spectral clustering (graph construction is the monograph’s own; the GNN canon assumes a given graph) build_neighbor_graph
02 analyze — propagation (low-pass graph filter) Part II — low-pass graph filtering / the graph Fourier transform SGC (Wu et al. 2019); APPNP (Gasteiger/Klicpera et al. 2019) propagate_embeddings
03 learn — graph-supervised metric learning (declared edges vs. self-similarity vs. a random null) Part III — graph embeddings, machine learning on graphs node2vec (Grover & Leskovec 2016); GraphSAGE (Hamilton et al. 2017); SPECTER (Cohan et al. 2020, declared-citation supervision); NNCLR (Dwibedi et al. 2021, nearest-neighbor-of-own-representations via homophily); SciNCL (Ostendorff et al. 2022, citation-embedding kNN) fine_tune_graph
02/03 retrieval — an edge is a self-search; a context set is a search/walk Part I — kNN-graph construction as retrieval the retrieval-conditioned context of a Neural Process (Garnelo et al. 2018) assemble_context
04 predict — context-conditioned posterior (no monograph analogue — the tier the GSP series does not reach) CNP (Garnelo et al. 2018); ANP (Kim et al. 2019); TabPFN (Hollmann et al. 2022) train_context_predictor
04 predict — graph-conditioned prediction (BYOG) (no monograph analogue) ANP attention over the context set (Kim et al. 2019) predict_with_context_predictor
04 quantify — marginal conformal + the graph break (no monograph analogue) Vovk et al. 2005; Angelopoulos & Bates 2021; Barber et al. 2023; CF-GNN (Huang et al. 2023); NAPS (Clarkson 2023) conformalize
04 quantify — regression interval + the inline repair (no monograph analogue) Tibshirani et al. 2019 (weighted conformal under covariate shift); Barber et al. 2023 (beyond exchangeability) conformalize_interval
citation map: 8 rows, every reference resolved, every Jammi call exists on the pinned engine ✓
db.close()

61.6.1 Verification notes — three citations that are easy to get wrong

Three citations in this map are commonly given loosely; the references.bib entries carry the verified facts:

  • APPNP authorship. It is often attributed to “Klicpera 2019”. The author Johannes Klicpera later changed his name to Johannes Gasteiger; the canonical attribution is Gasteiger, Bojchevski & Günnemann, ICLR 2019 (“Predict then Propagate”, arXiv 2018). The bib cites Gasteiger with the name-change noted.
  • Barber et al. 2023 is a journal paper, not a preprint. “Conformal prediction beyond exchangeability” appeared in The Annals of Statistics 51(2):816–845 (2023) — Barber, Candès, Ramdas & Tibshirani. Pinned to the journal.
  • Angelopoulos & Bates 2021 and TabPFN 2022 are arXiv-year citations with later formal venues. Angelopoulos & Bates (arXiv 2021) was published in Foundations and Trends in ML 16(4), 2023; TabPFN (Hollmann et al., arXiv 2022) was published at ICLR 2023. Both are cited by their arXiv year with the formal venue recorded in the bib note.

The remaining canon held exactly as cited: SGC (Wu et al., ICML 2019), node2vec (Grover & Leskovec, KDD 2016), GraphSAGE (Hamilton et al., NeurIPS 2017), CNP (Garnelo et al., ICML 2018), ANP (Kim et al., ICLR 2019), Vovk et al. (Springer 2005), Tibshirani et al. (NeurIPS 2019), CF-GNN (Huang et al., NeurIPS 2023), NAPS (Clarkson, ICML 2023), and the three Stanković et al. monograph parts (arXiv 1907.03467 / 1909.10325 / 2001.00426, 2019–2020).

Angelopoulos, Anastasios N., and Stephen Bates. 2021. “A Gentle Introduction to Conformal Prediction and Distribution-Free Uncertainty Quantification.” arXiv Preprint arXiv:2107.07511.
Barber, Rina Foygel, Emmanuel J. Candès, Aaditya Ramdas, and Ryan J. Tibshirani. 2023. “Conformal Prediction Beyond Exchangeability.” The Annals of Statistics 51 (2): 816–45.
Clarkson, Jase. 2023. “Distribution Free Prediction Sets for Node Classification.” In Proceedings of the 40th International Conference on Machine Learning (ICML).
Cohan, Arman, Sergey Feldman, Iz Beltagy, Doug Downey, and Daniel S. Weld. 2020. “SPECTER: Document-Level Representation Learning Using Citation-Informed Transformers.” In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics (ACL), 2270–82.
Dwibedi, Debidatta, Yusuf Aytar, Jonathan Tompson, Pierre Sermanet, and Andrew Zisserman. 2021. “With a Little Help from My Friends: Nearest-Neighbor Contrastive Learning of Visual Representations.” In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), 9588–97.
Garnelo, Marta, Dan Rosenbaum, Christopher Maddison, Tiago Ramalho, David Saxton, Murray Shanahan, Yee Whye Teh, Danilo Rezende, and S. M. Ali Eslami. 2018. “Conditional Neural Processes.” In Proceedings of the 35th International Conference on Machine Learning (ICML), 1704–13.
Gasteiger, Johannes, Aleksandar Bojchevski, and Stephan Günnemann. 2019. “Predict Then Propagate: Graph Neural Networks Meet Personalized PageRank.” In International Conference on Learning Representations (ICLR).
Grover, Aditya, and Jure Leskovec. 2016. “Node2vec: Scalable Feature Learning for Networks.” In Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (KDD), 855–64.
Hamilton, William L., Rex Ying, and Jure Leskovec. 2017. “Inductive Representation Learning on Large Graphs.” In Advances in Neural Information Processing Systems 30 (NeurIPS), 1024–34.
Hollmann, Noah, Samuel Müller, Katharina Eggensperger, and Frank Hutter. 2022. “TabPFN: A Transformer That Solves Small Tabular Classification Problems in a Second.” arXiv Preprint arXiv:2207.01848.
Huang, Kexin, Ying Jin, Emmanuel Candès, and Jure Leskovec. 2023. “Uncertainty Quantification over Graph with Conformalized Graph Neural Networks.” In Advances in Neural Information Processing Systems 36 (NeurIPS).
Kim, Hyunjik, Andriy Mnih, Jonathan Schwarz, Marta Garnelo, Ali Eslami, Dan Rosenbaum, Oriol Vinyals, and Yee Whye Teh. 2019. “Attentive Neural Processes.” In International Conference on Learning Representations (ICLR).
Ostendorff, Malte, Nils Rethmeier, Isabelle Augenstein, Bela Gipp, and Georg Rehm. 2022. “Neighborhood Contrastive Learning for Scientific Document Representations with Citation Embeddings.” In Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing (EMNLP), 11670–88.
Stanković, Ljubiša, Danilo Mandic, Miloš Daković, Miloš Brajović, Bruno Scalzo, and Anthony G. Constantinides. 2019a. “Graph Signal Processing – Part I: Graphs, Graph Spectra, and Spectral Clustering.” arXiv Preprint arXiv:1907.03467.
———. 2019b. “Graph Signal Processing – Part II: Processing and Analyzing Signals on Graphs.” arXiv Preprint arXiv:1909.10325.
Stanković, Ljubiša, Danilo Mandic, Miloš Daković, Miloš Brajović, Bruno Scalzo, Shengxi Li, and Anthony G. Constantinides. 2020. “Graph Signal Processing – Part III: Machine Learning on Graphs, from Graph Topology to Applications.” arXiv Preprint arXiv:2001.00426.
Tibshirani, Ryan J., Rina Foygel Barber, Emmanuel J. Candès, and Aaditya Ramdas. 2019. “Conformal Prediction Under Covariate Shift.” In Advances in Neural Information Processing Systems 32 (NeurIPS), 2526–36.
Vovk, Vladimir, Alexander Gammerman, and Glenn Shafer. 2005. Algorithmic Learning in a Random World. Springer.
Wu, Felix, Amauri Souza, Tianyi Zhang, Christopher Fifty, Tao Yu, and Kilian Q. Weinberger. 2019. “Simplifying Graph Convolutional Networks.” In Proceedings of the 36th International Conference on Machine Learning (ICML), 6861–71.