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

## Facts

- Provider: Open Graph Benchmark team (Hu et al., Stanford)
- License: MIT (https://ogb.stanford.edu/docs/graphprop/)
- Size: 5 files
- Format: JSON Lines (in sampled files)
- Stored at: Hugging Face, https://huggingface.co/datasets/OGB/ogbg-code2
- Access: public, readable without an account
- Category: Machine Learning & AI
- Source: https://arxiv.org/abs/2005.00687
- Page: https://scigantic.com/archive/7b317fa5-bb4a-56ae-a6c2-3602e809ac13
- Keywords: Machine Learning & AI, graph learning, benchmark, JSON Lines, Hugging Face

## About

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).

## Load the data

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

## Data structure

File types in sampled files: JSON Lines

Example file: `test.jsonl`

## Open it

- In a hosted notebook with the data mounted: https://scigantic.com/archive/7b317fa5-bb4a-56ae-a6c2-3602e809ac13
- Full record as JSON (schema card included): https://api.scigantic.com/api/archives/7b317fa5-bb4a-56ae-a6c2-3602e809ac13
- Over MCP: `get_schema_card` with id `7b317fa5-bb4a-56ae-a6c2-3602e809ac13` at https://api.scigantic.com/mcp

## Related topics

- [Benchmark datasets](https://scigantic.com/topics/benchmark)
- [Machine Learning & AI datasets](https://scigantic.com/topics/machine-learning-and-ai)
- [JSON Lines datasets](https://scigantic.com/topics/json-lines)
- [Graph learning datasets](https://scigantic.com/topics/graph-learning)
