OGB ogbg-code2: Code Summarization as Graph Prediction (Open Graph Benchmark)

Provider
Open Graph Benchmark team (Hu et al., Stanford)
License
MIT (source)
Size
5 files
Format
JSON Lines (in sampled files)
Stored at
Hugging Face (https://huggingface.co/datasets/OGB/ogbg-code2)
Access
Free and public. No account with the data provider is needed.
Category
Machine Learning & AI
Source
https://arxiv.org/abs/2005.00687

About OGB ogbg-code2: Code Summarization as Graph Prediction (Open Graph Benchmark)

ogbg-code2 from the Open Graph Benchmark (OGB). It is a collection of abstract syntax trees (ASTs) of about 450,000 Python method definitions from 13,587 popular GitHub repositories in the CodeSearchNet corpus, with AST nodes, AST edges and the tokenised method name extracted for each. The task is to predict the sub-tokens of the method name from the body, a code summarisation problem framed as graph-to-sequence prediction. This Hugging Face copy stores the graphs as JSON Lines (train.jsonl about 3.3 GB, valid.jsonl about 0.19 GB, test.jsonl about 0.17 GB, measured 2026-11-14), and the card shows conversion to PyTorch Geometric. Uses include benchmarking graph neural networks on large sparse trees, program representation learning and comparing graph and sequence models of source code. Load with Hugging Face datasets or pandas and build graphs with PyTorch Geometric or DGL; the official ogb package also downloads it. OGB lists the ogbg-code2 licence as MIT; cite Hu et al., Open Graph Benchmark (NeurIPS 2020).

How to load this dataset in Python

from datasets import load_dataset
ds = load_dataset("OGB/ogbg-code2")
print(ds)

Data structure

File types in sampled files: JSON Lines

Files

Example file: test.jsonl

Analyze this dataset without downloading it

On Scigantic, OGB ogbg-code2: Code Summarization as Graph Prediction (Open Graph Benchmark) opens in a hosted JupyterLab notebook with the data already mounted, so you can read files where they are stored instead of copying them first. Each notebook includes an AI assistant that can see the mounted files and write and run analysis code. Open the dataset page to launch a notebook, or browse the full catalog.

This page is also available as Markdown and as JSON.

Related Machine Learning & AI datasets