Papers
Topics
Authors
Recent
Search
2000 character limit reached

Dynamic KeyNMF Framework

Updated 23 March 2026
  • Dynamic KeyNMF is a topic modeling framework that unifies transformer-based keyword importance scoring with NMF to capture evolving topics in large text corpora.
  • It factorizes a non-negative keyword-importance matrix using coordinate descent, yielding semantically rich topics compared to traditional token-count models.
  • The dynamic phase slices the corpus over time and optionally enforces temporal smoothness, enabling fine-grained analysis of topic emergence and resonance.

Dynamic KeyNMF is a topic modeling framework that unifies transformer-based keyword importance scoring with non-negative matrix factorization (NMF) to enable tracking the evolution of topics across contiguous time periods in large text corpora. The central innovation lies in constructing a non-negative “keyword-importance” matrix using contextualized embeddings from pretrained transformers, enabling more semantically meaningful topic induction compared to token-count-based approaches. Dynamic KeyNMF incorporates both static and dynamic phases, with optional temporal regularization, and was designed to support high-resolution analysis of topical information dynamics in settings such as Chinese diaspora media in the leadup to electoral events (Kristensen-McLachlan et al., 2024).

1. Construction of the Keyword-Importance Matrix

Given a corpus of DD documents and a vocabulary VV of candidate keywords, an embedding model f:text→Rdf: \text{text} \to \mathbb{R}^d (e.g., multilingual Sentence-BERT) generates dense representations for each document and each token. For each document dd, its embedding xd=f(d)x_d = f(d) is computed, as well as vw=f(w)v_w = f(w) for candidate tokens ww. The set KdK_d of top-NN tokens for dd is selected to maximize the sum of cosine similarities cos⁡(xd,vw)\cos(x_d, v_w). The D×VD \times V keyword-importance matrix MM is then defined by:

Md,w={max⁡{0,cos⁡(xd,vw)},w∈Kd 0,otherwiseM_{d, w} = \begin{cases} \max\{0, \cos(x_d, v_w)\}, & w \in K_d \ 0, & \text{otherwise} \end{cases}

This matrix is non-negative by construction. Unlike traditional document-term matrices filled by TF–IDF or raw counts, MM encodes semantic strength directly via contextual similarities.

2. Static KeyNMF Decomposition

The static phase factorizes MM into W∈R≥0D×KW \in \mathbb{R}_{\ge 0}^{D \times K} and H∈R≥0K×VH \in \mathbb{R}_{\ge 0}^{K \times V}, where KK is the number of topics. The factorization minimizes the Frobenius norm:

min⁡W≥0,H≥0∥M−WH∥F2\min_{W \ge 0, H \ge 0} \| M - W H \|_F^2

Optimization is performed via non-negative least squares, using coordinate-descent updates. Convergence is declared when the relative change in loss drops below ϵ\epsilon (e.g., 10−410^{-4}).

The coordinate-descent update for HH (for fixed WW) is:

H=max⁡{0,H−η[W⊤WH−W⊤M]}H = \max\{0, H - \eta [W^\top W H - W^\top M]\}

where η\eta is a small step-size. Updates for WW are symmetric.

3. Dynamic Slicing and Topic Evolution

To track topic evolution over TT time slices, Dynamic KeyNMF operates as follows:

  • Compute the static factorization over the entire corpus to obtain WW and HH.
  • For each time slice tt, extract MtM_t (documents from slice tt) and the corresponding WtW_t (rows of WW).
  • Fix WtW_t and re-solve for slice-specific HtH_t:

Ht=arg⁡min⁡H′≥0∥Mt−WtH′∥F2H_t = \arg\min_{H' \ge 0} \| M_t - W_t H' \|_F^2

  • Define the raw “temporal importance” of topic jj at time tt:

Itj=∑d=1Dt(Wt)djI_{t j} = \sum_{d=1}^{D_t} (W_t)_{d j}

  • Normalize It∙I_{t \bullet} to obtain a pseudo-distribution:

P^tj=Itj∑i=1KIti\hat{P}_{t j} = \frac{I_{t j}}{\sum_{i=1}^K I_{t i}}

This pseudo-distribution enables downstream information dynamics analyses such as novelty, transience, and resonance.

4. Optional Temporal Smoothness Regularization

Dynamic KeyNMF supports, but does not require, temporal smoothness regularization over topic assignments across time slices. The joint dynamic-NMF objective adds slice-to-slice continuity penalties:

min⁡{Wt,Ht}≥0∑t=1T∥Mt−WtHt∥F2+λW∑t=2T∥Wt−Wt−1∥F2+λH∑t=2T∥Ht−Ht−1∥F2\min_{\{W_t, H_t\} \ge 0} \sum_{t=1}^T \| M_t - W_t H_t \|_F^2 + \lambda_W \sum_{t=2}^T \| W_t - W_{t-1} \|_F^2 + \lambda_H \sum_{t=2}^T \| H_t - H_{t-1} \|_F^2

where λW\lambda_W and λH\lambda_H are non-negative smoothness weights, typically chosen small (≈0.01\approx 0.01–$0.1$) via cross-validation or grid search. The objective is optimized by alternating projected-gradient or coordinate-descent updates.

5. Preprocessing, Hyperparameters, and Practical Pipeline

Preprocessing steps include tokenization (e.g., jieba for Chinese), stopword removal, and candidate vocabulary construction. The main pipeline follows:

  1. Embedding & Keyword Extraction: For each dd, compute xd=f(d)x_d = f(d) and vw=f(w)v_w = f(w) for all ww. Select top NN tokens per doc by cos⁡(xd,vw)\cos(x_d, v_w).
  2. Matrix Construction: Assemble MM as above.
  3. Static NMF: Initialize WW and HH randomly, update via coordinate descent to convergence.
  4. Dynamic Slicing: For each time tt, extract MtM_t, WtW_t, solve for HtH_t; compute P^t∙\hat{P}_{t \bullet}.
  5. (Optional) Information Dynamics: Compute windowed Jensen–Shannon divergence between topic distributions for novelty, transience, and resonance analysis.

Key hyperparameters include KK (topics, typically 10–50), NN (keywords per doc, typically 15), ϵ\epsilon (convergence threshold), η\eta (step size), λW\lambda_W, λH\lambda_H (smoothness), nn (window size for novelty calculations), and the smoothing span for dynamics curves.

6. Computational Complexity and Scaling

  • Embedding: O(D⋅costf)O(D \cdot \text{cost}_f) for DD documents.
  • Keyword Selection: O(D⋅∣d∣⋅d)O(D \cdot |d| \cdot d).
  • Static NMF: Each iteration O(KDV)O(KDV), for II iterations.
  • Dynamic Ht_t Re-Estimation: Per slice, O(KDtV)O(K D_t V).
  • Total: O(IKDV+TKDˉV)O(I K D V + T K \bar{D} V), with DD documents, TT time slices, average slice size Dˉ\bar{D}, and vocabulary size VV.

For corpora with D≈104D \approx 10^4, T≈200T \approx 200, and V≈5×103V \approx 5 \times 10^3, static NMF computations dominate resource usage.

7. Evaluation Metrics and Benchmarks

Dynamic KeyNMF is evaluated using several metrics:

Metric Description Computed As
Topic-diversity (dd) Fraction of unique words in union of top LL topic words Standard toolkit
Internal coherence (CinC_{in}) Avg. pairwise cosine among top LL topic words Standard toolkit
External coherence (CexC_{ex}) Same as CinC_{in} but using external embeddings Standard toolkit
(Optional) NPMI Normalized pointwise mutual information (coherence) Standard toolkit

These allow comparison against LDA, CTM, BERTopic, Top2Vec, etc., using e.g., the topic-benchmark Python package.

Dynamic KeyNMF has demonstrated competitive performance on several Chinese datasets, substantiating its suitability for high-resolution analysis of topical information dynamics in multilingual and non-Western corpora (Kristensen-McLachlan et al., 2024).

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Dynamic KeyNMF.