Analysis updated 2026-05-18
Compare traditional machine learning, FastText, and BERT approaches on the same text classification task.
Learn how knowledge distillation can shrink a large BERT model into a smaller, faster student model.
Serve trained text classifiers over an HTTP API using the included Flask setup.
| happy-chen-ch/text_classification | liuluhaixiu/davinci-autoedit-agent | a2328275243/mempalace-evolve | |
|---|---|---|---|
| Stars | 79 | 79 | 78 |
| Language | Python | Python | Python |
| Setup difficulty | hard | moderate | easy |
| Complexity | 4/5 | 3/5 | 3/5 |
| Audience | researcher | vibe coder | developer |
Figures from each repo's GitHub metadata at analysis time.
Requires downloading a large pre-trained BERT model separately and ideally a GPU.
This Python project builds a classifier that sorts Chinese news headlines into one of ten categories: finance, real estate, stocks, education, science, society, politics, sports, gaming, and entertainment. The source data is described as coming from the Toutiao news platform and contains 200,000 labeled examples split into 180,000 for training and 10,000 each for validation and testing. The repository offers three main approaches to the classification problem. The first uses traditional machine learning: headlines are tokenized with the jieba Chinese word segmenter, converted into TF-IDF feature vectors, and fed to a random forest classifier. The second uses FastText, a lightweight neural model that trains on word n-gram features and exposes a REST API via Flask for real-time inference. The third fine-tunes a full Chinese BERT model, a pre-trained deep language model with 110 million parameters, by adding a single linear classification layer on top. A fourth approach explores knowledge distillation. Here the large BERT model acts as a teacher and a much smaller TextCNN model acts as a student. During training the student learns from both the labeled data and the teacher's output probabilities. The final student model is far smaller and faster than BERT while retaining much of its accuracy, which makes it more practical for devices with limited computing power. The BERT model is large, around 390 MB before quantization and 146 MB after applying PyTorch dynamic quantization, and must be downloaded separately from the official source. The README notes that the random forest and FastText paths have been verified to work, but the knowledge distillation path may still contain bugs. The code detects and supports CUDA, Apple Silicon (MPS), and CPU automatically. Each sub-project includes a Flask API for serving predictions over HTTP. The README is written in Chinese. The project is licensed under MIT.
A Chinese news headline classifier comparing traditional ML, FastText, BERT, and a distilled small model across 10 categories.
Mainly Python. The stack also includes Python, PyTorch, BERT.
Use freely for any purpose, including commercial use, as long as you keep the copyright notice.
Setup difficulty is rated hard, with roughly 1h+ to a first successful run.
Mainly researcher.
This repo across BitVibe Labs
Verify against the repo before relying on details.