124 world cities arranged by word2vec similarity ·
Ivan Pozdniakov
Short answer: partly, yes — and "partly" has a precise
shape.word2vec — a model
that turns each word into a vector of numbers from the company it keeps —
never saw coordinates. It learned each of these 124 city names only from how
each name is used in Google News. Comparing those usages recovers the
world's broad regional structure remarkably well; the geography
within regions stays blurry, north–south weaker than
east–west, while news events, ambiguous names and
shared institutions bend the map in revealing ways. The similarities are
explored in three linked views below; select any city to light up its
neighbours in both maps and rank them in the side panel.
An embedding represents a word as numbers, chosen so that similar
usage gives similar numbers. word2vec learns them by reading
~100 billion words of Google News (2013) and training a small neural
network to predict the words that appear around each word
(the skip-gram objective)
(Mikolov, Sutskever, et al., 2013).
Names that occur in interchangeable contexts end up with nearly the same
numbers:
…storms lashed Sydney late on Friday…
…storms lashed Melbourne late on Friday…
…the mayor of New York unveiled the budget…
Shared contexts → similar vectors; different contexts → different
vectors. All three cities are English-speaking — what separates them is
whose news they share, not language. No atlas, no coordinates: the
model never sees geography, only text.
"You shall know a word by the company it
keeps." — J. R. Firth
(1957)
2a name becomes 300 numbers
Each name's learned vector is a list of 300 numbers — here are the first
five of Sydney's, colour encoding the value:
Sydney →
… ×300
And the actual vectors of all three cities, 300 numbers side by side:
negative
≈ 0
positive
dimensions 1…300
Scan a few columns: Melbourne's stripes match Sydney's far more often than
New York's do — that shared pattern is the similarity.
3cosine: the angle between vectors
The same list of numbers can be drawn as an arrow: 300 numbers = an
arrow in a 300-axis space (two axes shown). The closer two arrows point the
same way, the smaller the angle θ between them, and
cos θ turns that
angle into a similarity score:
cos 0° = 1 for
identical directions,
cos 90° = 0
when they share no direction in this representation. Below, each arrow is drawn
at its real, measured angle to Sydney, the reference:
One caveat that previews the whole problem: the gap you
see between Melbourne and New York (≈ 41°) is not their
real angle. In the full 300-d space those two are the least alike of
the three (cos .26, θ ≈ 75°) — three 300-d
arrows simply cannot be flattened onto a plane without distorting some angle.
That is the very compression MDS negotiates across all 124 cities in
card 4.
4MDS: a map from distances alone
From a table of road distances between cities you could redraw the map of a
country. MDS (Kruskal, 1964) does
exactly that — but the distances are semantic,
d = 1 − cos θ,
not physical: it finds the 2-D points whose mutual distances best reproduce
the whole 124×124 table.
PCA, t-SNE and UMAP (switcher below) offer alternative 2-D views: PCA is a
flat linear shadow of the cloud, while t-SNE and UMAP drop the whole
distance table and instead prioritize each vector's local neighbourhoods.
Explore the maps
The cutoff slider and city search drive
both maps at once (the matrix below always shows every pair).
Select a city — hover, tap or Tab to it —
to preview its five closest neighbours; pin it (click or Enter) to open
the full ranking in the side panel. Try:
·
·
.
cosine ≥ 0.50
0 links · strongest 0% of 7,626 pairs
Geographic network
the familiar world map, with the semantics drawn on top
Here position is real geography — every city sits at
its true coordinates. The word2vec similarity lives only in the lines: a link
joins each pair above the cutoff, and thicker = more similar. Read
it as a test of Tobler's first law of geography — "everything is related
to everything else, but near things are more related than distant
things"(Tobler, 1970) — against
news text: mostly the law wins, and the exceptions are the interesting
part.
Semantic map
the same cities, laid out by meaning instead of geography
Here position is similarity itself: the closer two
cities sit, the more similar their vectors. No geography enters this
chart — the layout is computed from the vectors alone (it is only turned
rigidly afterwards, so that → east and ↑ north match the
globe where possible). How strictly the promise holds depends on the
algorithm you pick below: MDS honours all pairwise distances, t-SNE and
UMAP honour only neighbourhoods, PCA is the flat linear shadow. Links show
the same cutoff as above.
Layout algorithm — try all four:
recall@10 — of each city's 10 truly nearest
neighbours (by cosine, in 300-d), how many stay among its 10 nearest on
this 2-D screen (local faithfulness) · geo-fidelity — rank
correlation between on-screen distances and real great-circle distances,
alignment-free (defined in full below the map) · Stress-1 — how far on-screen distances
deviate from the target dissimilarities (0 = perfect; only MDS optimizes it)
· E–W / N–S r — axis correlation with
longitude / latitude, measured after the geographic alignment, so
descriptive only.
How geographic is each layout? Each map is scored by
geo-fidelity — the Spearman rank correlation, computed over all 7,626
city pairs, between the distance separating a pair on screen and the real
great-circle distance between the two cities. Like any correlation it
runs from −1 to +1: +1 would mean the layout ranks every pair's
distance exactly as geography does, 0 means no relationship, a negative
value would mean it inverts geography. It is a measured quantity, not a
target: for the raw 300-d embedding it works out to ρ = .50 (more
precisely .503), and because it reads distances only, the Procrustes
alignment — which merely rotates the finished map — leaves it unchanged.
What the score counts — three real pairs, each comparing
distance on Earth with word2vec cosine similarity:
Madrid ↔ Barcelona505 km apart · cos .73near on both — agrees
Tokyo ↔ Lisbon11,140 km · cos .23far on both — agrees
Lisbon ↔ Madrid503 km · cos .49near on Earth, distant in text — disagrees
Agreements push the correlation up, disagreements pull it down.
The third pair is the telling one: Lisbon and Madrid are as close as Madrid and
Barcelona (≈ 500 km), yet word2vec rates them far less similar
(.49 vs .73) — Lisbon's vector leans towards EU-institution language. Enough
such misses, summed over all 7,626 pairs, hold even the best layout near
ρ .67 rather than 1.
The deterministic part of the order never moves:
raw .50 < MDS .57 < PCA .60 < t-SNE .64,
and UMAP usually lands on top (.67 in the run shown). The two
neighbourhood methods (t-SNE, UMAP) — which
preserve who-sits-next-to-whom — beat the two global methods (MDS, which
fits every pairwise distance; PCA, the linear variance projection), and both
beat the raw space. Why has only UMAP got a whisker? Because the other
three are deterministic — PCA and classical-init MDS have no random step,
and t-SNE, initialized from PCA rather than a random layout, also lands on the
same result every run (its geo-fidelity was .644 on all 12 seeds tried, so
there is nothing to show). UMAP is the one stochastic method here. Re-running it
under 12 random seeds gave a min of .60 and a max of .68 (mean .65,
SD .02) — that observed min–max range is what the whisker spans (not
a confidence interval), and the run shown, .67, sits near its top. So t-SNE
(.64) and UMAP (.65 ± .02) are effectively tied, and the
neighbourhood ≥ global > raw ordering held in all 12
runs tried — though at its narrowest (UMAP's worst seed .603 vs PCA's .599) by
only .004, so read it as a strong tendency, not a law. Seeds are not the only
uncertainty: the 124 cities are themselves one curated sample. A city-level
bootstrap (1,000 resamples) keeps every layout's advantage over the raw
space outside sampling noise (all four 95% CIs exclude zero), but the
adjacent layout-vs-layout gaps — MDS vs PCA, t-SNE vs UMAP —
all sit within it, so the individual podium positions should not be
over-read.
Why should squeezing 300 dimensions into 2 make the map
more geographic, not less? Throwing away 298 dimensions should lose
information, so you would expect the 2-D distances to track geography worse than
the full-space ones — yet on this metric they track it better. Two candidate
mechanisms fit that result, and they read very differently.
Denoising: word2vec distance blends geography with non-geographic
variation (news salience, city size, language, name collisions) smeared across
all 300 axes; a projection keeps a few dominant or neighbourhood directions,
and when the dropped ones are mostly non-geographic, the surviving distances
are less diluted. Cluster quantization: the neighbourhood methods
exaggerate the separation between regional clusters and shrink the
spread within them — the very between-cluster distances this page
elsewhere warns are "largely artefacts of the optimizer" — and since most city
pairs lie in different regions, a metric over all pairs rewards exactly that
exaggeration. The projection cannot add geography that is not there; the real
question is which kind of geography the score is picking up. The
decomposition below suggests the answer is: mostly the coarse, regional
kind.
What kind of geography is the score rewarding? Three
probes on the same data, side by side (computed in
robustness_study.py):
raw 300-d
MDS
PCA
t-SNE
UMAP
geo-fidelity, all 7,626 pairs
.50
.57
.60
.64
.67
within-region pairs only (12%)
.33
.23
.23
.33
.28
region-collapsed (9 points)
.82
.71
.71
.68
.72
geographic neighbours kept, recall@10
.59
.45
.36
.61
.61
Read row by row: within regions the raw space ties the
best layout (.33) and beats the rest — the projections add nothing there.
Collapse to nine region points — destroying every within-region
detail — and the score rises for all five (e.g.
UMAP .67 → .72), because 88% of city pairs are between-region;
the raw space rises most of all (.50 → .82: nine region-mean
vectors track great-circle distance better than any 2-D layout retains,
so the embedding's regional core is richer than what reaches the screen).
And on keeping each city's ten nearest geographic neighbours, the raw
space (.59) beats both global layouts outright and is within a whisker of
t-SNE/UMAP (.61).
Aren't nine hand-drawn regions an artificial yardstick? Three
controls say the collapse result is real. The lift does not need the
labels: cutting this page's own similarity dendrogram into nine
data-driven clusters (no geography, no labels) lifts the raw space and
MDS/PCA/t-SNE the same way (raw .50→.71; .57→.69, .60→.66,
.64→.67; UMAP flat). Grouping by
k-means on the true coordinates lifts scores higher still (layouts up
to .74, raw to .83).
And collapsing by random groupings of the same sizes crashes every score
to noise level (ρ ≈ 0, means .01–.03 over 20 draws) —
collapsing per se earns nothing; only
geographically meaningful grouping does, and the layouts discovered that
grouping themselves. So "every projection beats the raw space" is true for the
headline metric, but the gain lives almost entirely in between-region
structure. The nine collapsed points are no foreign object — they sit
where each layout put the regions, genuinely recovered geography at
continental scale. That is the precise sense in which language reconstructs
"a map": a sharp map of the world's regions, a blurry map inside them.
Similarity matrix
all 7,626 pairs at once, ordered by hierarchical clustering
The raw material of every view above. Rows and
columns are the 124 cities; each cell is one cosine similarity. Hierarchical
clustering (average linkage on
d = 1 − cos θ)
reorders them so similar cities sit together: red blocks on the diagonal are
regions emerging on their own, warm patches off the blocks are cross-region
bridges, pale rows are loners. The tree at left shows where groups merge —
shorter = more similar. Row names are coloured by region; hover any
cell for the pair, click to pin the row's city.
A few things the map gets right, and a few it gets wrong.
Click a city to light it up in both maps.
The tightest pair in the whole matrix is
&
(cos = .86)
— plausibly because Australian cities appear in near-interchangeable
contexts in world news (though with only five Oceania cities sampled,
"tightest in the matrix" is partly a fact about the sample).
A city with a wide footprint.
is a Gulf city first —
its nearest neighbours are Abu Dhabi, Jeddah, Doha and Riyadh — but its
top ten reaches through Amman into Southeast Asia (Singapore,
Kuala Lumpur) and South Asia (Karachi, Mumbai, and the ambiguous token
Hyderabad), consistent with its trade and labour-migration links.
Where the corpus bends the map.
drifts off Iberia —
the Treaty of Lisbon pulls its vector towards EU-institution language
rather than towards Madrid or Barcelona.
The transatlantic hinge.
leans towards the
United States about as much as any European city — a hub both news spheres
share (by mean cosine to the North American cities it edges Madrid only
narrowly, .31 vs .30, so read it as "among the closest", not a
podium).
A data-quality near-miss.
would have
landed inside the US cluster with the obvious token, which is dominated by
St. Petersburg, Florida (see Methodology → Token
resolution).
The projections beat the raw space — on the headline metric. Every
2-D layout scores higher geo-fidelity than the raw 300-d cosine distances
(ρ .57–.67 vs a measured baseline of .50), and the advantage
survives a city-level bootstrap. But the decomposition under the semantic map
shows where the gain lives: almost entirely in between-region structure —
within regions the raw space ties the best layout, and collapsing any layout to
nine region points raises its score. Switch between MDS, PCA, t-SNE and
UMAP to feel the difference, and read the result as regional sorting made
legible, not street-level cartography.
The map's two systematic failures — showcased, not hidden. First,
the default MDS view recovers almost no north–south structure
(latitude r = .17; even the best possible rotation only
reaches .21, while t-SNE manages .41). Second, on-screen adjacency lies:
about half of each city's true top-10 neighbours sit somewhere else in 2-D
(recall@10 .52 for MDS), which is why the pinned drawer always ranks
neighbours from the true 300-d cosines. The charming single-city quirks above
are the memorable failures; these two are the consequential ones.
Methodology
Data and representation
Embedding model. GoogleNews-vectors-negative300: word2vec
(skip-gram with negative sampling) trained by Google on ~100 billion
words of Google News text, circa 2013
(Mikolov, Sutskever, et al., 2013).
Vocabulary of 3 million tokens, 300 dimensions per vector, with
frequent multiword phrases merged into single tokens
(New_York, Buenos_Aires).
Under the distributional hypothesis
(Harris, 1954), cities mentioned in
similar news contexts receive similar vectors — the cosine computation
itself sees only text. One honest qualification: choosing which token
represents an ambiguous name was adjudicated with geographic ground truth in
hand (step 3) — a fully blind pipeline would have put St Petersburg
in Florida — so "no geography enters" holds for the similarity computation,
not for every judgment call around it. Two caveats follow
directly from the training data: what drives similarity is news
salience, not geography (a shared war, league or stock exchange pulls
cities together as surely as a shared border), and the corpus is frozen
in ~2013, so prominence and usage reflect that period's coverage. That
geography is recoverable from this text at all is a long-known effect
(see Related work): the signal rides on how cities
are described — country names, climate words — never on
coordinates.
City list. 124 cities curated by hand: metropolitan-area
population roughly >1 million and global prominence, deliberately
balanced across 9 regions rather than ranked by population — a
strict top-N by population would be dominated by Chinese and South-Asian
metros, and the map would lose most of the regions a general reader
recognizes. Region labels are used only for colouring — they play no role
in the computation.
Token resolution. word2vec knows only tokens, not
"cities", so each city is mapped to the vocabulary entry that best carries
its meaning. Multiword names are the hard part: GoogleNews merged word
pairs into single tokens only where they co-occur unusually often, so
coverage is arbitrary — New_York and
Buenos_Aires exist, but
Mexico_City, New_York_City,
New_Delhi and Ho_Chi_Minh_City
do not (verified against all 3M entries). The resolver walks an ordered
candidate list and takes the first hit; the non-obvious choices:
Mexico City → mean of Mexico
+ City, as no phrase token exists. The
all-caps MEXICO_CITY (from agency datelines,
"MEXICO CITY (Reuters) —…") was tested and rejected:
dateline tokens keep company with other datelines, so their cosines
run uniformly low and push the city to the map's edge.
Ho Chi Minh City → Saigon: the
full name fragmented into pieces, while Saigon
— still common in news and historical coverage — is a well-trained
token with the right meaning.
St Petersburg → Saint_Petersburg,
not the commoner St._Petersburg — which is
dominated by St. Petersburg, Florida (cos to Tampa .68 vs
Moscow .60).
Kyiv → Kyiv: this spelling
already had its own token in the 2013 corpus, years before it displaced
"Kiev" as the standard English form (most news style guides switched
around 2019). New York and
Delhi fall back to New_York and
Delhi.
Every token still fuses all senses of its string — Treaty-of-Lisbon
coverage drags Lisbon off Iberia, and
Santiago and Hyderabad
each name several cities. No resolver can untangle that; entity-level
embeddings could (Beyond word2vec, below).
Similarity
Similarity matrix. Vectors are L2-normalized and all
pairwise cosine similarities computed,
cos(u,v) = u·v / (‖u‖ ‖v‖)
giving a symmetric 124×124 matrix (7,626 unique pairs). Observed
range −.06 (Houston–Lisbon) to .86 (Sydney–Melbourne),
M = .30.
Dissimilarity: why
d = 1 − cos θ.
Three monotone transforms were compared empirically on this data with
identical SMACOF runs (monotone ⇒ a nonmetric MDS would not
distinguish them at all):
transform
Stress-1
recall@10
fit ρ (d ↔ 2-D)
layout Δ vs 1−cos
1 − cos
.347
.515
.709
—
√(2(1−cos))
.392
.505
.687
.005
arccos(cos)
.384
.511
.692
.003
The textbook objection to 1 − cos is that it is only a
semi-metric: it can violate the triangle inequality, while the chord
√(2(1−cos))
and the angle arccos are true metrics
(Borg & Groenen, 2005). On this
dataset the objection is nearly moot: enumerating all
C(124,3) = 310,124
triples, exactly 2 violate the triangle inequality, by a
largest excess of just .023 — negligible for SMACOF. Meanwhile
1 − cos fits its target best, preserves the cosine ranking
best, and the three layouts are nearly identical anyway (Procrustes
disparity ≤ .005). Chord would be the safer default for datasets
with near-duplicate items; here the simplest transform is also the
best-behaved, so the map keeps d = 1 − cos.
Projection and evaluation
MDS. Metric MDS
(Borg & Groenen, 2005;
Kruskal, 1964)
via SMACOF (scikit-learn 1.9) on the
precomputed dissimilarities: 2 components, classical-MDS (Torgerson)
initialization followed by stress-majorization iterations (max 3000,
tolerance 10−9), which makes the solution deterministic.
SMACOF minimizes raw stress
Σ(d̂ₖₗ − dₖₗ)²
between input dissimilarities
d̂ and embedding
distances d.
Fit diagnostics. Kruskal Stress-1,
Stress-1 = √(Σ(d̂ − d)² / Σ d²) = .347
with Pearson correlation between input dissimilarities and 2-D distances
r = .71 (Spearman ρ = .71). By Kruskal's rule of thumb
(<.025 excellent, <.05 good, >.20 poor) this is a heavily compressed fit —
unavoidable when flattening the high-rank similarity structure of 300-d
embeddings into a plane. Read the map accordingly: broad groupings are
informative, but exact nearest neighbours should be taken from the pinned
similarity ranking, not from which dot looks closest. The hover overlay
shows each city's true 300-d nearest neighbours precisely so the
projection's compromises stay visible.
Alternative layouts (the switcher). The four
algorithms, in historical order, answer progressively different
questions, all on the same vectors with cosine distance. PCA(Pearson, 1901) projects the cloud
onto the two directions of greatest variance — linear, so it cannot bend
around curved structure and keeps the fewest true neighbourhoods
(recall@10 = .41). MDS is the only one that explicitly optimizes
all pairwise distances (Stress-1 = .347, recall@10 = .52), which is why
it is the default. t-SNE(van
der Maaten & Hinton, 2008) and UMAP(McInnes et al., 2018) are
nonlinear methods prioritizing local neighbourhoods, both on cosine
distance (t-SNE: perplexity 20, PCA init, learning-rate
"auto"; UMAP: n_neighbors 15,
min_dist 0.3): they preserve local structure far better
(recall@10 = .71 / .70) at the price that distances between
clusters stop being comparable.
On the geography question (which map looks most like the world?),
the alignment-free geo-fidelity ρ — rank correlation of on-screen
distances with real great-circle distances — has a natural reference: the
raw 300-d cosine distances, before any projection, which you might
expect to be the best a 2-D map could hope to match. They score only
ρ ≈ .50 (measured .503), and every 2-D layout
beats that baseline on this metric (MDS .57, PCA .60,
t-SNE .64, UMAP .67). Two mechanisms can produce that gain —
denoising (the projection drops mostly non-geographic directions) and
cluster quantization (the neighbourhood methods exaggerate
between-region separation, which a metric dominated by between-region pairs
rewards) — and the decomposition under the semantic map indicates the gain
lives almost entirely in between-region structure: within regions the raw
space ties the best layout, and collapsing any layout to nine region points
raises its score. The tier ordering
neighbourhood > global > raw is stable
across reruns, and each layout's advantage over the raw space survives a
city-level bootstrap; adjacent layout-vs-layout gaps do not.
Stability details (seeds, initialization, bootstrap)
PCA, classical-init MDS and PCA-init t-SNE are
deterministic — the classical-init MDS sweep in
compute_intervals.py returns ρ = .572
on all 12 seeds — and only UMAP varies with the random seed
(ρ .60–.68, mean .65), so the t-SNE .64 /
UMAP .67 gap is within that noise. Initialization matters more than
seeds: SMACOF started from random configurations instead of the
classical solution spans ρ .50–.58 over 12 starts — an
init-sensitivity result reported separately in the same script. A
1,000-resample city-level bootstrap (robustness_study.py)
gives 95% CIs excluding zero for every layout-minus-raw difference
(e.g. PCA−raw [.04, .15]) and including zero for every adjacent
layout difference (PCA−MDS [−.02, .08],
UMAP−t-SNE [−.05, .10]).
All four are scaled to a common size and rigidly rotated onto geography by
the same Procrustes step (step 9); the reported metrics are invariant
to that alignment.
Orientation (geographic). An MDS solution is unique
only up to rotation, reflection and translation, so the raw axes are
meaningless. Instead of an arbitrary convention, the configuration is
aligned to real geography by orthogonal
Procrustes — the single rotation (plus reflection) that best
superimposes one set of points on another, solved in closed form from an
SVD (Schönemann, 1966). Here it
best maps the embedding onto each city's true (longitude, latitude), with
the two geographic axes standardized so east–west and north–south
count equally. This is a rigid transform — it
preserves every pairwise distance and the stress exactly, and only
decides which way is up. Afterwards east–west correlates with
longitude at r = .70 and north–south with latitude at only
r = .17; even the single best rotation cannot lift the MDS layout's
latitude past r = .21 (a 3,600-angle rotation scan in
robustness_study.py), so the MDS map recovers
little north–south structure (a statement about this projection,
not a claim that the 300-d space contains none — the same scan on t-SNE
reaches north–south r = .41). These axis correlations are
measured after an alignment that itself uses the real coordinates,
so they describe residual correspondence rather than prove unsupervised
recovery — for that, see the alignment-free geo-fidelity metric under the
layout switcher.
Additional views and limitations
Geographic network view. The same similarity matrix drawn over
real geography: cities at their true (longitude, latitude) on an
equirectangular projection, with a simplified Natural Earth 110m land
outline embedded in the page (no external tiles). A link joins every pair
with cosine ≥ the cutoff; width and opacity grow with similarity. The
slider spans 0.30–0.86; the default 0.50 keeps ≈450 of the
7,626 pairs. The link count falls off sharply with the cutoff (log scale):
Clustered similarity matrix. The heatmap reorders the full
124×124 matrix by agglomerative hierarchical clustering with
average linkage (UPGMA). Concretely,
scipy.cluster.hierarchy.linkage is run on the
condensed upper triangle of
d = 1 − cos θ
with method="average" and
optimal_ordering=True: starting from 124
singletons it repeatedly merges the two clusters with the smallest
mean pairwise dissimilarity, recording the entire merge tree.
No cluster count is imposed — the dendrogram keeps the full
history, and the leaf order is refined by optimal leaf ordering(Bar-Joseph et al., 2001),
which flips branches to place the most similar neighbours
adjacent without changing the tree. That ordering alone makes the block
structure legible: it is the exact matrix from card 4, complete and
seriated — diagonal blocks = regions, off-block warm bands = cross-region
bridges (find the Gulf ↔ South Asia patch), pale rows =
cities similar to nothing in particular.
Beyond word2vec. The 2013 model is kept deliberately: it is the
canonical teaching model, ships ready-made phrase tokens, and its quirks
(Lisbon, St Petersburg) are instructive. Cleaner representations would
fix those quirks. Wikipedia2Vec embeds Wikipedia entities,
so "Santiago (Chile)" and "Santiago de Cuba" stop sharing one vector — the
cleanest fix for name collisions
(Yamada et al., 2020);
fastText adds subword information and handles unseen spellings
(Bojanowski et al., 2017);
GloVe is a close word2vec alternative trained
on global co-occurrence counts
(Pennington et al., 2014);
modern sentence or LLM embeddings could encode a
whole city description, trading the elegant "meaning from raw
co-occurrence" story for quality.
Software
The pipeline runs on Python 3.11. The GoogleNews-vectors-negative300
word2vec vectors (Mikolov, Sutskever,
et al., 2013) are read straight from Google's published binary by a small NumPy
parser (no gensim dependency); numerical work uses NumPy 2.4 and
pandas 3.0. The projections use scikit-learn 1.9.0 (MDS, PCA, t-SNE)
and umap-learn 0.5.12, and the pairwise distances, hierarchical clustering
and orthogonal-Procrustes alignment use SciPy 1.17.1.
The figures are drawn in the browser with no charting library: the two maps,
the geo-fidelity bar chart and the clustered matrix are
hand-written inline SVG and HTML <canvas>, and
the formulae are typeset with KaTeX 0.16. The non-overlapping city labels
were pre-computed offline with matplotlib 3.11 and adjustText 1.4,
then baked into the page as fixed coordinates. The faint continent outlines
behind the network map are the land layer of Natural Earth —
a free, public-domain world basemap — at its 1:110m (one-to-110-million)
resolution, the coarsest it ships. Source, data and build scripts are in the
GitHub
repository.
Related work
Recovering geography from text alone has a long pedigree — word2vec itself
famously encodes geographic relations as vector offsets, answering
Paris − France + Italy ≈ Rome(Mikolov, Yih, & Zweig, 2013).
Louwerse and Zwaan (2009)
applied MDS to newspaper-text similarities for the 50 largest US cities and
recovered their latitude and longitude, connecting it to Tobler's first law;
the approach even extends to estimating the locations of unseen place
names from their linguistic associations
(Recchia & Louwerse, 2014) and
reconstructs an invented world — the cities of Middle-earth from
the co-occurrences in Tolkien
(Louwerse & Benesh, 2012). The
very reading this page relies on — screen distance as similarity — is the
"first law of cognitive geography" that spatialization research has tested
on human readers directly
(Montello et al., 2003). The
closest precedent to this page is
Konkol et al. (2017), who fit
city vectors from 16 embedding models to real coordinates as a benchmark —
with a more rigorous setup (a spherical 3-D target, error reported in
kilometres, noise-robustness and cross-validation) and exactly the failure
mode this map shows: the worst errors come from a name overlapping a more
famous entity (their Kobe → the basketball player,
Bismarck → the chancellor; here Lisbon, St Petersburg,
Santiago); supervised probes recover referential attributes of entities from
distributional vectors more generally
(Gupta et al., 2015). For
contemporary language models the same signal appears in
hidden states — probed early by Liétard et al.
(2021) and mapped in detail by
Gurnee and Tegmark (2024) and Godey
et al. (2024) — linearly decodable,
improving with scale, but geographically uneven, weakest where corpus
coverage is thinnest; a different mechanism from this map's weak
north–south recovery (a projection artefact), but the same lesson:
geographic signal in text models is unevenly distributed. And
Barenholtz (2026) showed plain
word2vec/GloVe already carry it, riding on lexical directions (country and
climate words) rather than on any built-in coordinate.
What this page adds is small and specific. The central finding is
not new, and Konkol et al. (2017)
established it more rigorously; the contribution
here is an interactive, fully documented re-examination — deliberately both
a teaching demonstration and a small standalone investigation — plus three
minor empirical points I did not find in the geographic-embeddings literature
(projection-quality comparison is of course a field of its own;
Espadoto et al., 2021 — the
geographic instantiation, not the comparison itself, is the new part).
(1) The map is
compared across projections rather than across embeddings, and all
four 2-D layouts score higher geo-fidelity than the raw 300-d cosine
distances they come from (ρ ≈ .57–.67
vs a raw-space baseline of ρ ≈ .50) — though the
decomposition on the page shows the gain is almost entirely between-region
structure, so this is a claim about the global rank metric on this curated
sample, not about street-level geography surviving projection.
(2) The
semi-metric objection to d = 1 − cos θ
is checked exhaustively (all 310,124 triples; 2 violations, max excess
.023) rather than assumed — a check of this dataset, not a general result
about 1 − cos. (3) The dateline-token artefact —
MEXICO_CITY sitting among other agency datelines,
so its cosines to ordinary words run uniformly low — is a concrete,
checkable fact about the GoogleNews vectors. A caveat the literature
predicts and this page inherits: a supervised probe trained to regress
coordinates recovers geography far better (R² ≈ .8,
reported in a preprint by Barenholtz,
2026) than these
unsupervised layouts do
(geo-fidelity ρ ≈ .57–.67) — the two figures are
different metrics on different scales (variance-explained vs rank correlation),
so read them as a direction, not a subtraction. Either way, what you see is a
map of discourse more than of the Earth.
References
Barenholtz, E. (2026). World properties without
world models: Recovering spatial and temporal structure from co-occurrence
statistics in static word embeddings. arXiv.
https://arxiv.org/abs/2603.04317
Bojanowski, P., Grave, E., Joulin, A., & Mikolov, T.
(2017). Enriching word vectors with subword information.
Transactions of the Association for Computational Linguistics, 5,
135–146. https://doi.org/10.1162/tacl_a_00051
Borg, I., & Groenen, P. J. F. (2005). Modern
multidimensional scaling: Theory and applications (2nd ed.). Springer.
https://doi.org/10.1007/0-387-28981-X
Espadoto, M., Martins, R. M., Kerren, A., Hirata,
N. S. T., & Telea, A. C. (2021). Toward a quantitative survey of
dimension reduction techniques. IEEE Transactions on Visualization and
Computer Graphics, 27(3), 2153–2173.
https://doi.org/10.1109/TVCG.2019.2944182
Firth, J. R. (1957). A synopsis of linguistic theory
1930–1955. In Studies in linguistic analysis (Special volume of
the Philological Society, pp. 1–32). Blackwell.
Godey, N., de la Clergerie, É., & Sagot, B. (2024).
On the scaling laws of geographical representation in language
models. arXiv. https://arxiv.org/abs/2402.19406
Gupta, A., Boleda, G., Baroni, M., & Padó, S. (2015).
Distributional vectors encode referential attributes. In Proceedings of
the 2015 Conference on Empirical Methods in Natural Language Processing
(pp. 12–21).
https://aclanthology.org/D15-1002/
Gurnee, W., & Tegmark, M. (2024). Language models
represent space and time. In International Conference on Learning
Representations. https://arxiv.org/abs/2310.02207
Konkol, M., Brychcín, T., Nykl, M., & Hercig, T. (2017).
Geographical evaluation of word embeddings. In Proceedings of the Eighth
International Joint Conference on Natural Language Processing (Volume 1:
Long Papers) (pp. 224–232). https://aclanthology.org/I17-1023/
Kruskal, J. B. (1964). Multidimensional scaling by
optimizing goodness of fit to a nonmetric hypothesis.
Psychometrika, 29(1), 1–27.
https://doi.org/10.1007/BF02289565
Liétard, B., Abdou, M., & Søgaard, A. (2021). Do
language models know the way to Rome? In Proceedings of the Fourth
BlackboxNLP Workshop on Analyzing and Interpreting Neural Networks for
NLP (pp. 510–517).
https://aclanthology.org/2021.blackboxnlp-1.40/
Louwerse, M. M., & Benesh, N. (2012). Representing
spatial structure through maps and language: Lord of the Rings encodes the
spatial structure of Middle Earth. Cognitive Science, 36(8),
1556–1569. https://doi.org/10.1111/cogs.12000
McInnes, L., Healy, J., & Melville, J. (2018).
UMAP: Uniform manifold approximation and projection for dimension
reduction. arXiv. https://arxiv.org/abs/1802.03426
Mikolov, T., Sutskever, I., Chen, K., Corrado, G. S., &
Dean, J. (2013). Distributed representations of words and phrases and their
compositionality. Advances in Neural Information Processing Systems,
26, 3111–3119. https://arxiv.org/abs/1310.4546
Mikolov, T., Yih, W.-t., & Zweig, G. (2013).
Linguistic regularities in continuous space word representations. In
Proceedings of the 2013 Conference of the North American Chapter of the
Association for Computational Linguistics: Human Language Technologies
(pp. 746–751).
https://aclanthology.org/N13-1090/
Montello, D. R., Fabrikant, S. I., Ruocco, M., &
Middleton, R. S. (2003). Testing the first law of cognitive geography on
point-display spatializations. In Spatial information theory
(COSIT 2003), Lecture Notes in Computer Science, 2825
(pp. 316–331). Springer.
https://doi.org/10.1007/978-3-540-39923-0_21
Pearson, K. (1901). On lines and planes of closest fit to
systems of points in space. The London, Edinburgh, and Dublin
Philosophical Magazine and Journal of Science, 2(11), 559–572.
https://doi.org/10.1080/14786440109462720
Pennington, J., Socher, R., & Manning, C. D. (2014).
GloVe: Global vectors for word representation. In Proceedings of the 2014
Conference on Empirical Methods in Natural Language Processing
(pp. 1532–1543). https://doi.org/10.3115/v1/D14-1162
Recchia, G., & Louwerse, M. M. (2014). Grounding the
ungrounded: Estimating locations of unknown place names from linguistic
associations and grounded representations. In Proceedings of the 36th
Annual Conference of the Cognitive Science Society (pp. 1270–1275).
https://escholarship.org/uc/item/2g6976kg
Schönemann, P. H. (1966). A generalized solution of the
orthogonal Procrustes problem. Psychometrika, 31(1), 1–10.
https://doi.org/10.1007/BF02289451
Tobler, W. R. (1970). A computer movie simulating urban
growth in the Detroit region. Economic Geography, 46(Suppl.),
234–240. https://doi.org/10.2307/143141
Yamada, I., Asai, A., Sakuma, J., Shindo, H., Takeda, H.,
Takefuji, Y., & Matsumoto, Y. (2020). Wikipedia2Vec: An efficient
toolkit for learning and visualizing the embeddings of words and entities
from Wikipedia. In Proceedings of the 2020 Conference on Empirical
Methods in Natural Language Processing: System Demonstrations
(pp. 23–30). https://doi.org/10.18653/v1/2020.emnlp-demos.4