﻿# ogbg-code2: subtoken set F1 does not measure exact function-name reconstruction

Interpret ogbg-code2 with its actual set-based evaluator, separating subtoken overlap, decoding policy and project transfer from exact identifier generation.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-ogbg-code2-subtoken-set-f1-not-exact-name/
Language: en

## Establish what the benchmark predicts

The [ogbg-code2 specification](https://ogb.stanford.edu/docs/graphprop/) describes method-name subtoken prediction from abstract syntax trees. It uses a project split, so evaluation concerns transfer to separate codebases as well as graph representation. Preserve the named dataset version and its target-masking contract when preparing examples. A method-name task should not silently become ordinary source-file completion with an unmasked answer available among the input identifiers.

## Read the evaluator rather than guessing from its label

The [official evaluator source](https://raw.githubusercontent.com/snap-stanford/ogb/master/ogb/graphproppred/evaluate.py) converts each reference and prediction into sets before computing overlap-based precision, recall and F1, then averages example scores. Consequently, reordering the same subtokens does not change their set overlap, and repeated predicted subtokens do not create additional unique matches. This is a defined benchmark metric, not an implementation defect to repair while retaining the same result label.

## Use a counterexample to distinguish identifier quality

Imagine a reference name assembled from the subtokens “load” and “cache”. A prediction containing both words in reverse order has the same set membership but a different ordered identifier. The official overlap score therefore cannot establish exact reconstruction by itself. If an application needs names that preserve order, report a supplementary exact or sequence-sensitive measure and identify its normalization rules. Keep that result separate from the published benchmark score so both questions remain interpretable.

## Include decoding in the prediction contract

The [reference encoding and decoding utilities](https://raw.githubusercontent.com/snap-stanford/ogb/master/examples/graphproppred/code2/utils.py) expose vocabulary, unknown-token and end-of-sequence behavior. Truncating at a terminator or limiting the output length changes which subtokens reach evaluation. Inspect the decoded words rather than comparing internal token indices from independently built vocabularies. A decoder change can improve or degrade coverage even if graph embeddings and raw classifier outputs have not changed.

## Attribute improvements to the measured question

For a fair experiment, retain project membership, masking, vocabulary construction and decoding with the evaluator version. Investigate whether an improvement reflects recovering more relevant name concepts or actually reconstructing ordered identifiers. The existing [entity-group guide](/journal/data-guide-entity-group-split-design/) and [software reproducibility guide](/journal/software-stack-reproducibility/) provide related split and environment context. The useful claim names the measured target: benchmark subtoken overlap, exact naming quality or both, with separate evidence for each rather than a broad statement that the model understands and renames code correctly.
