# DeepWalk: Online Learning of Social Representations

DeepWalk learns social network vertex vectors from random walks like sentences

Bryan Perozzi, Rami Al-Rfou, Steven Skiena · arXiv · 2014-3-26

- **Problem** Classifiers that use links between members struggle when most members of a social network are unlabeled. Sparse labels leave approximate inference over the network with little to work with.
- **Method** DeepWalk treats short random walks as sentences and learns one vector per vertex with SkipGram. Instead of using global structure, it uses only local walk context, and a binary tree speeds up the softmax.
- **Results** On BlogCatalog with 10% labeled, DeepWalk scored 36.00 Micro-F1, compared to 31.06 for SpectralClustering.

## Why label-based classifiers stall on sparse social graphs

The setting is a social network in which only some members carry labels. Relational classifiers use the links between members, usually through approximate inference over a Markov network, such as iterative classification or Gibbs sampling. Sparsity makes this harder, because a graph with few labels gives the inference little to work with.

Iterative methods can also let early mistakes cascade through later predictions. So the authors look for structural features that do not depend on the label distribution. Such a representation can serve several classification tasks on the same network.

## A label-free representation built from random walks

DeepWalk learns one vector per vertex from short random walks, and a language model treats each walk as a sentence. The vectors form a matrix with one row per vertex, and the walks are the only training text. The authors expected this to work because vertex visits in such walks follow a power law, the same shape as word frequencies in text.

Training runs in passes, and each pass shuffles the vertices and starts one walk from each of them. Each walk moves to a uniformly chosen neighbor of its last vertex until it reaches the walk length t. SkipGram then scans each walk with a window of size w and updates the vectors so that the central vertex predicts the vertices around it, without regard to their order.

A full softmax over millions of vertices is too costly, so the authors place the vertices at the leaves of a binary tree. The probability of a vertex then becomes a product of binary decisions along its tree path, which cuts the cost from O(\|V\|) to O(log\|V\|). Huffman coding gives frequent vertices shorter paths, which speeds up training further.

The parameters are updated by stochastic gradient descent, with a learning rate of 2.5% at the start that decreases linearly as vertices are seen. Gradients are computed by back-propagation, so the update depends on the path of each walked vertex through the tree.

The key choice is the relaxed prediction task, where a vertex predicts its context without regard to position. This matches the idea that nearby vertices on random walks share local structure. In the Karate network, linearly separable regions of the two-dimensional embedding match modularity-based clusters of the input graph.

## Why parallel and streaming training are possible

Because vertex frequencies have a long tail, most updates touch only a few rows of the vertex matrix. Such sparse updates let the authors use asynchronous stochastic gradient descent without locks on the shared parameters. So several workers can update the same model concurrently.

The parallel runs used several threads on one machine, with up to 8 workers. The authors report that the speed-up stayed consistent on BlogCatalog and Flickr as workers increased. They also report no loss of predictive performance relative to serial training.

A streaming variant would pass small walks straight into the learner, so the model updates without building the whole graph first. That variant would need a fixed learning rate instead of a decaying one, and a tree sized for a bounded vertex count. The paper describes this variant but reports no experiment for it.

## Multi-label results on three social networks

The authors follow the protocol of earlier work: they sample a fraction TR of labeled nodes for training and test on the rest. Each setting is repeated ten times and averaged, using one-vs-rest logistic regression on the DeepWalk features with gamma 80, w 10 and d 128. The main score is Micro-F1, with Macro-F1 reported alongside.

On BlogCatalog with 10% labeled, DeepWalk scored 36.00 Micro-F1, compared to 31.06 for SpectralClustering. At 90% labeled, SpectralClustering scored 42.62, compared to 42.00 for DeepWalk. So the representation's lead is largest when labels are rare, and the spectral baseline is strongest once more labels are available. The authors note that DeepWalk trained on 20% labeled beats EdgeCluster, Modularity and wvRN when they get 90%.

On Flickr the training ratio runs from 1% to 10%, which means about 800 to 8,000 labeled nodes. At 1% labeled, DeepWalk scored 32.4 Micro-F1, compared to 27.43 for SpectralClustering. At 3% labeled DeepWalk reached 35.9, above the 35.41 that SpectralClustering reached at 10%. The authors read this as DeepWalk matching the baselines with 60% less training data.

YouTube has 1,138,499 vertices, and SpectralClustering and Modularity could not run on it. The authors report that the gap narrows as labels increase, ending with a 3% Micro-F1 lead. So the advantage holds on a graph much larger than the other two datasets.

## Sensitivity to dimensions and walks per vertex

The authors fixed w at 10 and t at 40, then varied the dimensions d, the walks per vertex gamma and the training ratio. Most of the benefit appeared once each vertex started 30 walks. The best dimensionality depends on how many labels are available, since 1% of Flickr has about as many labeled examples as 10% of BlogCatalog.

Gains from more walks are large at first and slow after gamma of 10. The authors take this to mean that a small number of walks already gives meaningful vertex vectors. This sweep covers only Flickr and BlogCatalog.

## Limitations

Only three datasets were evaluated, all with multi-label classification. The baselines ran at d=500, while DeepWalk used d=128, and some baseline numbers come from the original papers. Restarts were tried in preliminary runs and showed no advantage.

The parallel experiments ran on one machine with threads, not across machines. The streaming and non-random walk variants are described, but the paper reports no experiment for them.

## Paper info

- **Authors**: Bryan Perozzi, Rami Al-Rfou, Steven Skiena
- **Venue**: arXiv · Preprint
- **First published**: 2014-3-26
- **Added**: 2026-11-11
- **Updated**: 2014-6-27
- **Version**: v2
- **arXiv**: 1403.6652
- **DOI**: 10.1145/2623330.2623732
- **Category**: cs.SI · cs.LG
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

[Original paper ↗](https://arxiv.org/abs/1403.6652v2) · [PDF ↗](https://arxiv.org/pdf/1403.6652v2)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Quote from the paper

Bryan Perozzi, Rami Al-Rfou, Steven Skiena (2014). DeepWalk: Online Learning of Social Representations. arXiv:1403.6652v2. https://doi.org/10.1145/2623330.2623732

**BibTeX**

```
@article{perozzi2014deepwalk,
  title = {{DeepWalk: Online Learning of Social Representations}},
  author = {Bryan Perozzi and Rami Al-Rfou and Steven Skiena},
  year = {2014},
  eprint = {1403.6652},
  archivePrefix = {arXiv},
  doi = {10.1145/2623330.2623732},
  url = {https://arxiv.org/abs/1403.6652v2}
}
```

## Related papers

- [Graph Embedding Techniques, Applications, and Performance: A Survey](https://refivu.com/en/papers/eeed1384-bf87-452c-b3b1-9ecc6ce7d43b-graph-embedding-techniques-applications-and-performance-a.md)
- [LINE: Large-scale Information Network Embedding](https://refivu.com/en/papers/395ad92f-93c2-44fe-8480-bbf8df48c4cf-line-large-scale-information-network-embedding.md)
- [node2vec: Scalable Feature Learning for Networks](https://refivu.com/en/papers/dc0725e4-ec21-4d60-9363-0eac2fc69a10-node2vec-scalable-feature-learning-for-networks.md)
- [Anomaly Detection on Attributed Networks via Contrastive Self-Supervised Learning](https://refivu.com/en/papers/c20bdbfe-b419-4df5-8f33-b1066c4f4576-anomaly-detection-on-attributed-networks-via-contrastive.md)
- [Distributed Representations of Sentences and Documents](https://refivu.com/en/papers/f945f364-5ce3-4c12-bc05-c40bf55f4f8d-distributed-representations-of-sentences-and-documents.md)
- [A Comprehensive Survey of Graph Embedding: Problems, Techniques and Applications](https://refivu.com/en/papers/ec23e11b-6984-4611-aa20-93a65865b536-a-comprehensive-survey-of-graph-embedding-problems.md)

## Other paper commentary

- [Representation Learning: A Review and New Perspectives](https://refivu.com/en/papers/b38149f8-9f53-4406-8d25-bb93c21c4bc9-representation-learning-a-review-and-new-perspectives.md)
- [Representation Learning with Contrastive Predictive Coding](https://refivu.com/en/papers/cd05bbc6-eff6-4b02-b9ef-45070ef6704a-representation-learning-with-contrastive-predictive-coding.md)
- [GloVe: Global Vectors for Word Representation](https://refivu.com/en/papers/d4308808-78ba-4fc7-a70c-6e67f906e337-glove-global-vectors-for-word-representation.md)
- [Self-supervised Learning for Human Activity Recognition Using 700,000 Person-days of Wearable Data](https://refivu.com/en/papers/7d06c47d-a111-423f-a4f8-68d244e1093c-self-supervised-learning-for-human-activity-recognition.md)
- [Multi-task Self-Supervised Learning for Human Activity Detection](https://refivu.com/en/papers/ae7c537d-33fb-4fec-8014-37dab4536341-multi-task-self-supervised-learning-for-human-activity.md)
- [Rethinking Atrous Convolution for Semantic Image Segmentation](https://refivu.com/en/papers/d417603b-a8c0-438a-8aaf-2a2da3403f74-rethinking-atrous-convolution-for-semantic-image.md)
- [Fashion-MNIST: a Novel Image Dataset for Benchmarking Machine Learning Algorithms](https://refivu.com/en/papers/a95484f1-3372-4671-ab1c-c9d084962641-fashion-mnist-a-novel-image-dataset-for-benchmarking.md)
- [Gemini: A Family of Highly Capable Multimodal Models](https://refivu.com/en/papers/210f7673-6e80-4763-9ef2-d58f1a878648-gemini-a-family-of-highly-capable-multimodal-models.md)
- [Searching for MobileNetV3](https://refivu.com/en/papers/0831f87e-094f-403b-b55b-27cf192fd9c4-searching-for-mobilenetv3.md)
- [Enriching Word Vectors with Subword Information](https://refivu.com/en/papers/c9e8d8e6-e24f-4128-8771-cadeb8b6c17e-enriching-word-vectors-with-subword-information.md)
- [DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models](https://refivu.com/en/papers/1de65a84-2d26-40df-8104-656807b7a166-deepseekmath-pushing-the-limits-of-mathematical-reasoning-in.md)
- [UNet++: A Nested U-Net Architecture for Medical Image Segmentation](https://refivu.com/en/papers/156db9ed-e303-494d-af9e-c37b8715a287-unet-a-nested-u-net-architecture-for-medical.md)

## Terms in this paper

- [Stochastic Gradient Descent](https://refivu.com/en/terms/a49650824022-stochastic-gradient-descent)
- [Logistic Regression](https://refivu.com/en/terms/3551369d301a-logistic-regression)
- [language modeling](https://refivu.com/en/terms/8f3aaf7f8ef0-language-modeling)
- [Macro-F1](https://refivu.com/en/terms/bac7d2670b4d-macro-f1)
- [hierarchical softmax](https://refivu.com/en/terms/3cdc16770ffd-hierarchical-softmax)
- [Micro-F1](https://refivu.com/en/terms/984be90cfb2a-micro-f1)
- [BLOGCATALOG](https://refivu.com/en/terms/8a1839cb1f57-blogcatalog)
- [Random Walk](https://refivu.com/en/terms/1eea91355912-random-walk)
- [Flickr](https://refivu.com/en/terms/87065eb8080c-flickr)
- [YouTube](https://refivu.com/en/terms/a3648f1520e9-youtube)
- [Random Walks](https://refivu.com/en/terms/f544819ae283-random-walks)
- [SkipGram](https://refivu.com/en/terms/c7e6c5dcbbd7-skipgram)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/dd05ed66-43b8-4f25-93ca-264ea076a439-deepwalk-online-learning-of-social-representations)
