SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2403.00813 · 2024

UrbanGPT: Spatio-Temporal Large Language Models

arXiv · PDF · Open in the Atlas

Code that ran

9 of 12 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 8 failures of our instrument; 3 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2403.00813.json · badge: /api/ran/2403.00813.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
hkuds/urbangpt canonical (classifier label)
classifier basis: census
9 ran · 3 no recorded run
FunctionStatusWhere it lives
MAE_torch Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
hkuds/urbangpt/urbangpt/model/ST_Llama.py
code served (permissive licence) · get_code("2100188132670662")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Create small tensors for pred and true
# Shape: (2, 4) - batch size 2, feature dimension 4
pred = torch.randn(2, 4)
true = torch.randn(2, 4)

# mask_value: can be None or a numeric value
# Using None means no masking will occur
mask_value = None

ARGS = {
    "pred": pred,
    "true": true,
    "mask_value": mask_value,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
apply_rotary_pos_emb Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
hkuds/urbangpt/urbangpt/model/monkey_patch_non_inplace.py
code served (permissive licence) · get_code("bdd3c4ef3723890a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 5, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Analyze the function:
# - q, k: query and key tensors, used in element-wise operations with cos/sin
# - cos, sin: gathered from based on position_ids, shape must support gather at dim 2
# - position_ids: indices tensor, shape (batch, seq_len)
# 
# The function:
# 1. Expands position_ids to shape (batch, 1, seq_len, 1)
# 2. Repeats to (batch, num_heads, seq_len, 1)
# 3. Gathers cos/sin at dimension 2 using these indices
# 4. cos and sin are repeated to match batch size
# 5. q and k are multiplied element-wise with cos/sin results
#
# For gathering to work:
# - cos/sin must have at least 3 dimensions with dim 2 being the position dimension
# - cos/sin shape before repeat: (1, num_heads, max_positions, head_dim)
# - After repeat for batch: (batch, num_heads, max_positions, head_dim)
#
# q and k shapes must match cos/sin shapes after gathering

batch_size = 2
num_heads = 3
seq_len = 4
head_dim = 2
max_positions = 5

position_ids = torch.arange(seq_len).unsqueeze(0).repeat(batch_size, 1)
# position_ids shape: (batch_size, seq_len) = (2, 4)

q = torch.randn(batch_size, num_heads, seq_len, head_dim)
# q shape: (2, 3, 4, 2)

k = torch.randn(batch_size, num_heads, seq_len, head_dim)
# k shape: (2, 3, 4, 2)

cos = torch.randn(1, num_heads, max_positions, head_dim)
# cos shape: (1, 3, 5, 2)

sin = torch.randn(1, num_heads, max_positions, head_dim)
# sin shape: (1, 3, 5, 2)

ARGS = {
    'q': q,
    'k': k,
    'cos': cos,
    'sin': sin,
    'position_ids': position_ids,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 5, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
compress Ran
ran; our contract draft was wrong, not the code
hkuds/urbangpt/urbangpt/model/compression.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from Git-King-Zhan/LoReC, is pointer only (licence: NONE) · get_code("80dde39da1ba3708")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from Git-King-Zhan/LoReC, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_compressed_list Ran
ran; our contract draft was wrong, not the code
hkuds/urbangpt/urbangpt/model/compression.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from Git-King-Zhan/LoReC, is pointer only (licence: NONE) · get_code("c5824da57107fe8c")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from Git-King-Zhan/LoReC, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

load_compress_model Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
hkuds/urbangpt/urbangpt/model/compression.py
code served (permissive licence) · get_code("a730a935c1f257ae")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from unittest.mock import Mock, MagicMock
import os
import tempfile

torch.manual_seed(0)

# Create minimal tokenizer mock
class MockTokenizer:
    def __init__(self):
        self.vocab_size = 1000
        self.model_max_length = 512

# Create minimal model
class MockModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.embedding = nn.Embedding(1000, 4)
        self.linear1 = nn.Linear(4, 8)
        self.linear2 = nn.Linear(8, 4)
    
    def forward(self, input_ids):
        x = self.embedding(input_ids)
        x = self.linear1(x)
        x = self.linear2(x)
        return x

# Create a temporary directory with dummy checkpoint file
tmpdir = tempfile.mkdtemp()
model_path = tmpdir

# Create a small state dict and save it
model = MockModel()
checkpoint_path = os.path.join(model_path, 'pytorch_model-00001-of-00001.bin')
torch.save(model.state_dict(), checkpoint_path)

# Create config mock
class MockConfig:
    def __init__(self):
        self.hidden_size = 4
        self.num_hidden_layers = 2
        self.vocab_size = 1000
        self.torch_dtype = torch.float32

# Mock AutoTokenizer.from_pretrained
original_auto_tokenizer = None
try:
    from transformers import AutoTokenizer
    original_auto_tokenizer = AutoTokenizer.from_pretrained
    AutoTokenizer.from_pretrained = lambda x, **kwargs: MockTokenizer()
except:
    pass

# Mock AutoConfig.from_pretrained
original_auto_config = None
try:
    from transformers import AutoConfig
    original_auto_config = AutoConfig.from_pretrained
    AutoConfig.from_pretrained = lambda x, **kwargs: MockConfig()
except:
    pass

# Mock AutoModelForCausalLM.from_pretrained
original_auto_model = None
try:
    from transformers import AutoModelForCausalLM
    original_auto_model = AutoModelForCausalLM.from_pretrained
    AutoModelForCausalLM.from_pretrained = lambda x, **kwargs: MockModel()
except:
    pass

ARGS = {
    'model_path': model_path,
    'device': 'cpu',
    'torch_dtype': torch.float32
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
accelerate, torch, tqdm, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
load_model_pretrained Ran
ran; our contract draft was wrong, not the code
hkuds/urbangpt/urbangpt/model/ST_Llama.py
code served (permissive licence) · get_code("1c58db3bf7592ab2")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import json
import os
import tempfile
import shutil

torch.manual_seed(0)

# Create a temporary directory structure for the pretrained model
temp_dir = tempfile.mkdtemp()
pretrain_model_path = temp_dir

# Create config.json
config_dict = {
    "hidden_size": 64,
    "num_layers": 2,
    "dropout": 0.1,
    "learning_rate": 0.001
}

config_path = os.path.join(pretrain_model_path, 'config.json')
with open(config_path, 'w') as f:
    json.dump(config_dict, f)

# Create a simple model class that accepts args
class SimpleSTModel(nn.Module):
    def __init__(self, args):
        super().__init__()
        self.hidden_size = args.hidden_size
        self.num_layers = args.num_layers
        self.dropout = args.dropout
        self.linear1 = nn.Linear(10, self.hidden_size)
        self.linear2 = nn.Linear(self.hidden_size, 5)
        
    def forward(self, x):
        x = self.linear1(x)
        x = self.linear2(x)
        return x

# Create a state dict and save it as .pkl
model = SimpleSTModel(type('Args', (), config_dict)())
state_dict = model.state_dict()

pkl_path = os.path.join(pretrain_model_path, 'model.pkl')
torch.save(state_dict, pkl_path)

# Define arguments for the function
ARGS = {
    "model_name": SimpleSTModel,
    "pretrain_model_path": pretrain_model_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
raise_warning_for_incompatible_cpu_offloading_configuration Ran
ran, violated the contract we drafted
hkuds/urbangpt/urbangpt/model/model_adapter.py
code served (permissive licence) · get_code("0bf414a2b44babe6")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import sys
import warnings

# Set up arguments for the function
ARGS = {
    "device": "cuda",
    "load_8bit": True,
    "cpu_offloading": True,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
rotate_half Ran
ran; our contract draft was wrong, not the code
hkuds/urbangpt/urbangpt/model/monkey_patch_non_inplace.py
code served (permissive licence) · get_code("62a553b3b2dcaca7")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# The function rotate_half takes a single parameter 'x' which should be a tensor
# It accesses x[..., :x.shape[-1] // 2] and x[..., x.shape[-1] // 2:]
# So x needs to be a tensor with a last dimension that is even-sized

# Create a small tensor with batch size 2 and feature dimension 4
x = torch.randn(2, 4)

ARGS = {
    'x': x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
scaler_mae_loss Ran
ran; our contract draft was wrong, not the code
hkuds/urbangpt/urbangpt/model/ST_Llama.py
code served (permissive licence) · get_code("6aced6f709ffe24b")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned function. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# Create a simple scaler class that has inverse_transform method
class SimpleScaler:
    def inverse_transform(self, x):
        # Simple inverse transform: multiply by 2
        if isinstance(x, torch.Tensor):
            return x * 2.0
        return x * 2.0

# Create scaler instance
scaler = SimpleScaler()

# Define ARGS dict with all parameters for scaler_mae_loss
ARGS = {
    'scaler': scaler,
    'mask_value': 0.5
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
forward Not yet run
unverified (harvested, no recorded run)
hkuds/urbangpt/urbangpt/model/monkey_patch_non_inplace.py
code served (permissive licence) · get_code("2cbe6ed055d5fd44")
How it ran

no invocation recorded.

get_model_info Not yet run
unverified (harvested, no recorded run)
hkuds/urbangpt/urbangpt/model/model_registry.py
code served (permissive licence) · get_code("52162c648b35e17b")
How it ran

no invocation recorded.

load_pretrained_model Not yet run
unverified (harvested, no recorded run)
hkuds/urbangpt/urbangpt/model/builder.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from Git-King-Zhan/LoReC, is pointer only (licence: NONE) · get_code("bad3bd3ae89b22d3")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from Git-King-Zhan/LoReC, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 8 are also present in other papers whose code we hold (8 with at least one paper dated earlier, 3 the same month, 5 later) and 4 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
apply_rotary_pos_emb 47 other papers
29 dated earlier, 15 later, 3 same year, order not determinable
2305.14167 (2023-05)
DetGPT: Detect What You Need via Reasoning
2305.16103 (2023-05)
ChatBridge: Bridging Modalities with Large Language Model as a Language Catalyst
2305.16355 (2023-05)
PandaGPT: One Model To Instruction-Follow Them All
and 44 more not named here
compress 17 other papers
9 dated earlier, 2 the same month, 5 later, 1 same year, order not determinable
2112.05682 (2021-12)
Self-attention Does Not Need $O(n^2)$ Memory
2303.06865 (2023-03)
FlexGen: High-Throughput Generative Inference of Large Language Models with a Single GPU
2304.10453 (2023-04)
Phoenix: Democratizing ChatGPT across Languages
and 14 more not named here
raise_warning_for_incompatible_cpu_offloading_configuration 15 other papers
7 dated earlier, 3 the same month, 5 later
2112.05682 (2021-12)
Self-attention Does Not Need $O(n^2)$ Memory
2310.13023 (2023-10)
GraphGPT: Graph Instruction Tuning for Large Language Models
2312.00401 (2023-12)
VIoTGPT: Learning to Schedule Vision Tools in LLMs towards Intelligent Video Internet of Things
and 12 more not named here
get_compressed_list 13 other papers
5 dated earlier, 2 the same month, 5 later, 1 same year, order not determinable
2112.05682 (2021-12)
Self-attention Does Not Need $O(n^2)$ Memory
2310.13023 (2023-10)
GraphGPT: Graph Instruction Tuning for Large Language Models
2310.17631 (2023-10)
JudgeLM: Fine-tuned Large Language Models are Scalable Judges
and 10 more not named here
load_pretrained_model 2 other papers
1 dated earlier, 1 later
2310.13023 (2023-10)
GraphGPT: Graph Instruction Tuning for Large Language Models
2604.17897 (2026-04)
LoReC: Rethinking Large Language Models for Graph Data Analysis
forward 1 other paper
1 dated earlier
2310.19740 (2023-10)
Exploring the Reliability of Large Language Models as Customized Evaluators for Diverse NLP Tasks
load_compress_model 1 other paper
1 dated earlier
2310.13023 (2023-10)
GraphGPT: Graph Instruction Tuning for Large Language Models
rotate_half 1 other paper
1 dated earlier
2310.19740 (2023-10)
Exploring the Reliability of Large Language Models as Customized Evaluators for Diverse NLP Tasks

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Spatio-temporal prediction aims to forecast and gain insights into the ever-changing dynamics of urban environments across both time and space. Its purpose is to anticipate future patterns, trends, and events in diverse facets of urban life, including transportation, population movement, and crime rates. Although numerous efforts have been dedicated to developing neural network techniques for accurate predictions on spatio-temporal data, it is important to note that many of these methods heavily depend on having sufficient labeled data to generate precise spatio-temporal representations. Unfortunately, the issue of data scarcity is pervasive in practical urban sensing scenarios. Consequently, it becomes necessary to build a spatio-temporal model with strong generalization capabilities across diverse spatio-temporal learning scenarios. Taking inspiration from the remarkable achievements of large language models (LLMs), our objective is to create a spatio-temporal LLM that can exhibit exceptional generalization capabilities across a wide range of downstream urban tasks. To achieve this objective, we present the UrbanGPT, which seamlessly integrates a spatio-temporal dependency encoder with the instruction-tuning paradigm. This integration enables LLMs to comprehend the complex inter-dependencies across time and space, facilitating more comprehensive and accurate predictions under data scarcity. To validate the effectiveness of our approach, we conduct extensive experiments on various public datasets, covering different spatio-temporal prediction tasks. The results consistently demonstrate that our UrbanGPT, with its carefully designed architecture, consistently outperforms state-of-the-art baselines. These findings highlight the potential of building large language models for spatio-temporal learning, particularly in zero-shot scenarios where labeled data is scarce.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2403.00813")
get_code_for_paper("2403.00813")
have("2403.00813")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2403.00813.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2403.00813.svg)](https://syntology.ai/paper/2403.00813)

Connect an agent — have() is free.