# FastText

FastText is an open-source library from Facebook AI Research (2016) for learning word representations via subword units and efficient text classification, archived on GitHub in March 2024.

FastText is an open-source library developed by Facebook AI Research (FAIR) for learning word representations and performing text classification. It was publicly released in 2016. The library combines machine-learning techniques with a focus on computational efficiency, making it suitable for large-scale natural language processing tasks. Its GitHub repository was archived on March 19, 2024, indicating the end of active development, though the source code and pretrained models remain available.

## Word representations

FastText builds on the skip-gram model used in word2vec, but also takes the internal structure of words into account. Instead of learning a representation for each word only as a whole, it represents words using character n-grams. Words that share character sequences can therefore share some of the same learned information.

This use of subword information is particularly useful for rare words and languages with complex word formation, and also allows fastText to construct representations for words that were not seen during training. Facebook AI Research later released pretrained fastText vectors for many languages, including a collection for 157 languages trained on Common Crawl and Wikipedia. These vectors have been widely adopted in downstream applications such as [machine-learning](https://www.wikiprompt.org/wiki/machine-learning) classifiers and semantic similarity tasks.

## Text classification

FastText can also be used for supervised text classification. It combines information from the words and word n-grams in a text to predict a class label. The method was designed to be computationally efficient and, in its original evaluation, achieved accuracy comparable to several contemporary deep-learning models while training and making predictions much faster. The supervised mode uses a hierarchical softmax to handle large label sets efficiently, making it practical for tasks like sentiment analysis and document tagging.

## Architecture and training

The core model is a shallow [neural-network](https://www.wikiprompt.org/wiki/neural-network) with a single hidden layer, which contrasts with deeper architectures common in modern [deep-learning](https://www.wikiprompt.org/wiki/deep-learning). In the unsupervised mode, each word is represented as the sum of its character n-gram vectors plus an optional whole-word vector. In the supervised mode, the input text is embedded as the average of its word vectors, which is then fed through a linear classifier. Training is performed with stochastic gradient descent and negative sampling, which reduces computational cost. This simplicity allows fastText to scale to billions of words on a single machine within minutes.

## Legacy and influence

FastText influenced later developments in text representation and classification, particularly in scenarios with limited computational resources. Its subword approach informed research on morphologically rich languages and out-of-vocabulary handling, and it remains a common baseline for evaluating more complex models such as [large-language-model](https://www.wikiprompt.org/wiki/large-language-model)s. The archived repository and released pretrained vectors continue to be used by researchers and practitioners in academia and industry, including within cloud platforms like [amazon-web-services](https://www.wikiprompt.org/wiki/amazon-web-services) and [google-cloud](https://www.wikiprompt.org/wiki/google-cloud) for custom [artificial-intelligence](https://www.wikiprompt.org/wiki/artificial-intelligence) pipelines.

## See also

- [word2vec](https://www.wikiprompt.org/wiki/word2vec) (related concept, not in provided list, but mentioned as text)
- Word2vec
- GloVe
- Neural network (machine learning)
- Natural language processing

---
Source: https://www.wikiprompt.org/wiki/fasttext
License: CC BY-SA 4.0 (https://creativecommons.org/licenses/by-sa/4.0/)
Last updated: 2026-09-07T02:33:21.375832+00:00
