Basic idea
Topic modeling helps you discover hidden themes in large document collections—but traditional methods crawl when datasets grow to millions of records. This playbook shows how to process large product-review corpora in minutes using GPU-accelerated BERTopic.
BERTopic combines transformer embeddings with clustering to extract human-readable topics from text. By swapping CPU-based UMAP and HDBSCAN with GPU-accelerated versions from RAPIDS cuML, you get the same results dramatically faster—no code changes required.
- Drop-in GPU acceleration: Load
cuml.accel and your existing UMAP/HDBSCAN code runs on GPU automatically
- Scale to millions: Process datasets that would take hours on CPU in minutes on GPU
- Interactive visualizations: Explore topic distributions, relationships, and document clusters
What you'll accomplish
You'll run a complete topic modeling pipeline on product reviews and generate interactive visualizations of discovered topics on your hardware platform.
By the end, you'll be able to:
- Use cuML's drop-in accelerators for UMAP and HDBSCAN
- Generate sentence embeddings at scale with SentenceTransformers
- Create topic visualizations including heatmaps, barcharts, and document datamaps
What to know before starting
Required:
- Experience with Python and Jupyter notebooks
- Basic understanding of machine learning concepts (embeddings, clustering)
- Familiarity with pandas DataFrames
Optional:
- Experience installing and using conda environments
- Familiarity with Hugging Face model downloads and caching
Supported hardware platforms
Use the matrix below to confirm your hardware platform, recommended default local settings, and whether multi-node applies.
| Hardware platform | OS | Memory | Recommended default local settings | Multi-node capable hardware |
|---|
| DGX Station | DGX OS (Linux) | Large HBM + Grace DRAM | Conda env rapids-25.10 (cuDF/cuML 25.10, Python 3.11, CUDA 13.0); JupyterLab; optional Streamlit on port 8501 | — |
Prerequisites
Hardware requirements
- Supported hardware platform — see Supported hardware platforms matrix above
- Minimum 64 GB GPU memory for processing very large document sets (tens of millions of reviews)
- At least 50 GB available storage for the dataset and embeddings
Software requirements
- Conda (Miniconda or Anaconda):
conda --version
- CUDA 13.0 compatible drivers:
nvidia-smi
- Network access to download the Amazon Reviews dataset (~14 GB compressed) and Python packages
- Web browser access to JupyterLab (and optionally Streamlit on port 8501)
Ancillary files
All required assets can be found in the playbook repository.
assets/video_notebook_for_GPU_Accelerated_Machine_Learning_BERTopic_1M.ipynb — Complete Jupyter notebook with the GPU-accelerated topic modeling pipeline
assets/topic_modeling_app.py — Streamlit dashboard for interactive UMAP/HDBSCAN tuning
assets/run_app.sh — Launcher for the Streamlit dashboard (defaults to the rapids-25.10 conda env)
Time & risk
- Estimated time: 45 MIN (includes environment setup, dataset download, and embedding generation)
- Risk level: Low
- Large dataset download (~14 GB) may take time depending on network speed
- Embedding generation requires significant GPU memory
- Rollback: Delete the downloaded dataset and any generated embedding files; optionally remove the conda environment
- Last Updated: 10/13/2026
- Step 9 now explains the JupyterLab "Running as root" exit on WSL2 and how to resolve it
- Added missing BERTopic diagram PNG so the notebook intro cell renders correctly
- Replaced st.tabs with radio selector to fix deck.gl map initialization and redraw
- Switched to str(fig) to prevent the map from being clipped inside Streamlit's layout
- Added offline mode (inlines deck.gl/d3/Arrow/jQuery/fonts) and a "Download standalone HTML" button
- Added static matplotlib fallback with topic label slider for WebGL-free environments
- Added caching on UMAP/datamap calls so toggling display options doesn't re-run fits
- Added torch.cuda.init() before cuml/cudf imports in both app and notebook
- Removed in-notebook !wget that unnecessarily re-downloaded several GB on each run
- Datamap now plots 70% of documents for a richer visual
- Notebook re-run clean top to bottom (cells 1–16), kernel set to Python (rapids-25.10)
- Marked run_app.sh executable
- README: switched to pip (avoids conda slow solves and missing package errors), pinned torchaudio==2.9.0, registers Jupyter kernel
- README: corrects dataset size to 6 GB, reorders steps 10–13 to match execution order
- README: adds Troubleshooting section (blank map, OOM, LFS errors, HF cache, pip conflicts, cache invalidation)