# Character-level Convolutional Networks for Text Classification

Character-level ConvNets classify text using only raw characters, without words

Xiang Zhang, Junbo Zhao, Yann LeCun · arXiv · 2015-9-4

- **Problem** Text classifiers depend on word features, which need text to be split into words, and that split is not always possible. Character-only ConvNets had not been shown to classify text at all, and large datasets for testing them were scarce.
- **Method** Character-level ConvNets treat each text as a sequence of one-hot characters over a fixed alphabet. Temporal convolutions and max-pooling run along that sequence, so no word features are needed.
- **Results** On Amazon Review Polarity, the large thesaurus-augmented model scored 4.93 error, compared to 9.60 for bag-of-words.

## Why word-based classifiers leave gaps

Most text classifiers are built on words, and simple statistics of ordered word combinations, such as n-grams, usually work best. Word features assume the text can be split into words, but that split isn't always possible, while characters are always present. ConvNets have worked well on raw signals in vision and speech, which suggests a route that skips the word layer.

The obvious question is whether a ConvNet that sees only characters can classify text at all. Earlier ConvNet text work used word embeddings or character features inside words, so the authors present their study as the first to apply ConvNets to characters only. ConvNets usually need large datasets, so the authors also built several of their own.

## Turning characters into a fixed-size input

The key idea is to treat each text as a sequence of one-hot characters over a fixed alphabet, and to run one-dimensional convolutions over that sequence. Each character becomes a vector with a single 1 in its alphabet position, and characters outside the alphabet, blanks included, become all-zero vectors. The main alphabet has 70 characters, and input text is cut to a fixed length of 1014 characters, with the order reversed so the newest text sits near the start.

The reversed order means the fully connected layers always find the latest text in the same place.

A temporal convolution slides a kernel of size k over the input with stride d, and each output is a sum of products, written as \\( h(y)=\\sum\_{x=1}^{k} f(x)\\, g(y\\cdot d - x + c) \\) with \\( c = k-d+1 \\). Each output feature sums such convolutions over the input features, so a layer is a set of kernel weights applied along the sequence. Temporal max-pooling then keeps the largest value in each window, \\( h(y)=\\max\_{x=1}^{k} g(y\\cdot d - x + c) \\), and the authors say this pooling let them train ConvNets deeper than six layers.

A rectifier, max(0, x), follows the convolutions, so each convolutional layer behaves like rectified linear units.

The network has nine layers: six convolutional layers with pooling, followed by three fully connected layers. Two dropout modules with probability 0.5 sit between the fully connected layers. The large model uses 1024 features in the convolutional layers and 2048 units in the first two fully connected layers, while the small model uses 256 and 1024.

Kernels are 7 wide in the first two layers and 3 wide in the rest, and the input length of 1014 sets the frame length that reaches the first fully connected layer through \\( l\_6 = (l\_0 - 96)/27 \\).

Training uses stochastic gradient descent with minibatches of 128, momentum of 0.9 and an initial step size of 0.01, which is halved every 3 epochs for 10 times. Each epoch draws a fixed number of random samples, spread evenly across classes. Weights start from a Gaussian with mean 0 and standard deviation 0.02 for the large model and 0.05 for the small one.

## Thesaurus augmentation for more variety

Signal-style augmentations don't fit text, because the exact order of characters carries syntax and meaning. Human paraphrases would be better, but they cost too much at this data volume, so the authors swap words for synonyms instead.

The method extracts all replaceable words and chooses r of them, with the probability of r set by a geometric distribution, \\( P\[r\]\\sim p^{r} \\). For each chosen word, the index s of the synonym is drawn from another geometric distribution, \\( P\[s\]\\sim q^{s} \\), so distant synonyms become less likely. The thesaurus comes from the mytheas component of LibreOffice, which was derived from WordNet and ranks synonyms by closeness to the most common meaning.

The reported results use p = 0.5 and q = 0.5, and because there is no Chinese thesaurus, Sogou News has no augmented results.

## Traditional and word-based baselines

The traditional models pair a hand-crafted feature extractor with multinomial logistic regression. Bag-of-words keeps the counts of the 50,000 most frequent training words, and bag-of-ngrams keeps 500,000 n-grams of up to 5 words. Bag-of-means clusters word2vec vectors of dimension 300 with k-means and uses 5000 means as features.

The word-based ConvNets match the character model in layers and output sizes, and use either pretrained word2vec or lookup tables. The LSTM averages the outputs of all its cells into a 512-dimensional vector and uses gradient clipping with a norm limit of 5. The authors report all results without model selection.

## Building the large-scale datasets

Most open text datasets are small and have far more test than training data, so the authors built their own from hundreds of thousands to several million samples. The eight datasets run from AG's News, with 120,000 training samples, to Amazon Review Polarity, with 3,600,000.

AG's News uses the title and description of the four largest classes, with 30,000 training samples per class. Sogou News is in Chinese, so the authors convert it to Pinyin with pypinyin and jieba, and the English models then run unchanged. The Yelp polarity task treats one and two stars as negative and three and four stars as positive.

## Where character ConvNets lead and lag

On AG's News, the n-grams TFIDF baseline has the lowest error at 7.64, and on Sogou News and DBPedia it has 2.81 and 1.31.

The character model does win on some datasets: the large model with thesaurus augmentation scored 4.93 on Amazon Review Polarity, compared to 9.60 for bag-of-words. On Yahoo! Answers the large thesaurus model had 28.80, and on Yelp Review Full the small full-alphabet thesaurus model had 37.95. Bag-of-means has the highest error on every dataset, for example 16.91 on AG's News against 11.19 for bag-of-words.

No single model is best everywhere, which is the pattern the authors take from these tables.

## Dataset size and text curation

The authors plot relative errors, which are the gap between a comparison model's error and the character model's error, divided by the comparison model's error, for the large thesaurus models. Larger datasets tend to favour the deep models, and n-grams TFIDF stays a strong candidate up to several hundred thousand samples. Character ConvNets only start to do better at the scale of several million samples.

Among the word-based deep models, the character model looks better on less curated user-generated text, such as Amazon reviews against Yahoo! Answers. The authors suggest this may favour real-world use, but it rests on a pattern across three word-based comparisons, not a direct test of curation.

## Case and thesaurus effects

Distinguishing upper and lower case usually gave worse results, but not in every case. For million-scale datasets the lowercase alphabet usually worked better, and the authors attribute this to a possible regularization effect that still needs checking.

Thesaurus augmentation lowered the large model's error on Amazon Review Polarity from 5.51 to 4.93 and on Yahoo! Answers from 29.55 to 28.80. On AG's News it raised the error from 12.82 to 13.39, so the effect of augmentation depends on the dataset.

## What the comparisons do and don't settle

The datasets split into sentiment analysis (Yelp and Amazon) and topic classification (the rest), and this split doesn't seem to decide which method wins. The authors conclude that no single machine learning model works for every kind of dataset, which they call a no free lunch result.

The authors read the bag-of-means result as a misuse of word2vec, since simple averaging of clusters gave the worst error in every case. They limit this to this simple use and say it doesn't speak to other language tasks or other uses of word2vec.

## Limitations

The misspelling and emoticon hypothesis is not tested directly, and the authors call for further analysis because their experiments show no explicit evidence. Only the p and q values of 0.5 are reported for the thesaurus, and the Sogou News dataset has no augmented results.

The authors use only a classification task to exemplify ConvNets, so the results don't cover other language processing tasks. The dataset-size curves come from the large thesaurus models, so the crossover point describes that setting.

## Paper info

- **Authors**: Xiang Zhang, Junbo Zhao, Yann LeCun
- **Venue**: arXiv · Preprint
- **First published**: 2015-9-4
- **Added**: 2026-11-12
- **Updated**: 2016-4-4
- **Version**: v3
- **arXiv**: 1509.01626
- **Category**: cs.LG · cs.CL
- **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/1509.01626v3) · [PDF ↗](https://arxiv.org/pdf/1509.01626v3)

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

Xiang Zhang, Junbo Zhao, Yann LeCun (2015). Character-level Convolutional Networks for Text Classification. arXiv:1509.01626v3. https://arxiv.org/abs/1509.01626v3

**BibTeX**

```
@misc{zhang2015character,
  title = {{Character-level Convolutional Networks for Text Classification}},
  author = {Xiang Zhang and Junbo Zhao and Yann LeCun},
  year = {2015},
  eprint = {1509.01626},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1509.01626v3}
}
```

## Other paper commentary

- [Bidirectional LSTM-CRF Models for Sequence Tagging](https://refivu.com/en/papers/7f421939-0d02-43b3-b25f-86a13896fd18-bidirectional-lstm-crf-models-for-sequence-tagging.md)
- [VQA: Visual Question Answering](https://refivu.com/en/papers/52c3e601-1542-4d3e-bc47-1d51fb1b7a5e-vqa-visual-question-answering.md)
- [BERTopic: Neural topic modeling with a class-based TF-IDF procedure](https://refivu.com/en/papers/3eb59114-35a2-4294-982a-129e3bf9019b-bertopic-neural-topic-modeling-with-a-class-based.md)
- [Think you have Solved Question Answering? Try ARC, the AI2 Reasoning Challenge](https://refivu.com/en/papers/fc6d55cd-53fa-41b7-a998-11a56cc77804-think-you-have-solved-question-answering-try-arc.md)
- [Bag of Tricks for Efficient Text Classification](https://refivu.com/en/papers/48b6ecfa-f1d3-4096-8e4a-50b65a867c17-bag-of-tricks-for-efficient-text-classification.md)
- [Pre-train, Prompt, and Predict: A Systematic Survey of Prompting Methods in Natural Language Processing](https://refivu.com/en/papers/e4640bef-1400-41e6-a928-8e765fc75d0e-pre-train-prompt-and-predict-a-systematic-survey.md)
- [CNN Features off-the-shelf: an Astounding Baseline for Recognition](https://refivu.com/en/papers/7a883e97-7894-49b3-9ad9-4cec774f4e63-cnn-features-off-the-shelf-an-astounding-baseline.md)
- [Learning without Forgetting](https://refivu.com/en/papers/3784f887-f12a-406c-9f7c-0b1573555ee3-learning-without-forgetting.md)
- [Learning Deconvolution Network for Semantic Segmentation](https://refivu.com/en/papers/9a41459e-1e6d-4d79-b532-13493bd8cf30-learning-deconvolution-network-for-semantic-segmentation.md)
- [XNOR-Net: ImageNet Classification Using Binary Convolutional Neural Networks](https://refivu.com/en/papers/a24ab4a0-5bb0-49ce-a4e8-1e280720a977-xnor-net-imagenet-classification-using-binary-convolutional.md)
- [Variational Inference: A Review for Statisticians](https://refivu.com/en/papers/9499b5e2-6ec4-4fcc-8d8e-4709801c41a4-variational-inference-a-review-for-statisticians.md)
- [Qwen2 Technical Report](https://refivu.com/en/papers/edc7be28-5a87-45ae-afa8-a9b7e9819cd7-qwen2-technical-report.md)

## Terms in this paper

- [dropout](https://refivu.com/en/terms/db73f75bbdd3-dropout)
- [Stochastic Gradient Descent](https://refivu.com/en/terms/a49650824022-stochastic-gradient-descent)
- [LSTM](https://refivu.com/en/terms/ba10547646d9-lstm)
- [sentiment analysis](https://refivu.com/en/terms/dcaa4b0924bc-sentiment-analysis)
- [word2vec](https://refivu.com/en/terms/aa6ca7ebd6f5-word2vec)
- [gradient clipping](https://refivu.com/en/terms/6fc07396f3f7-gradient-clipping)
- [Bag-of-words](https://refivu.com/en/terms/ab87ee9e2ea7-bag-of-words)
- [Sogou News](https://refivu.com/en/terms/f036cc205dbc-sogou-news)
- [Yahoo! Answers](https://refivu.com/en/terms/e85228fc0645-yahoo-answers)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/7b769c87-9db2-455d-a744-b9548d185e67-character-level-convolutional-networks-for-text)
