How do you turn a fuzzy idea like “AI + chips” into a living, breathing portfolio that adapts as markets move? A new framework called THEME proposes a crisp answer: train stock embeddings that understand both the meaning of a theme and the momentum around it, then retrieve candidates that are simultaneously on‑theme and investment‑suitable.

Unlike static ETF lists or naive keyword screens, THEME learns a domain‑tuned embedding space in two steps: first, align companies to the language of themes; second, nudge those semantics with a lightweight temporal adapter that “listens” to recent returns. The result is a retrieval engine that feeds a dynamic portfolio constructor—and in backtests, it beats strong LLM/embedding baselines and even average thematic ETFs on risk‑adjusted returns.

Why this matters for operators and allocators

Most “thematic” pipelines stall at two points:

  1. Coverage & drift. Real themes sprawl across sectors and mutate quickly; ETF baskets lag and miss up‑and‑comers.
  2. Relevance to P&L. Pure semantics finds the right companies in spirit, but not always the names with near‑term payoff.

THEME closes both gaps by (a) expanding theme coverage via an augmented Thematic Representation Set (TRS), and (b) injecting temporal refinement so the top‑k list isn’t just on‑message—it’s on‑trade.

How THEME works (business‑level view)

Stage What it learns Input signals Output used for
1. Thematic Alignment Stock–theme semantic proximity Theme descriptions, stock text profiles (filings, news) A finance‑tuned embedding space where same‑theme names cluster
2. Temporal Refinement Short‑horizon investability within a theme Recent L‑day returns; theme anchor as reference A fused embedding that ranks theme constituents by forward‑return potential
3. Inference Fast retrieval at query time User theme text → vector; precomputed stock vectors Top‑K candidates for screening or auto‑portfolio build

What’s novel

  • Hierarchical contrastive learning. Train on theme↔stock pairs (not just stock↔stock resemblance), then add triplet ranking with future return labels to teach the model which on‑theme names are likely to lead in the next H days.
  • TRS > ETFs. Start from 1,153 thematic ETFs but broaden the universe using industry taxonomies and news to avoid the classic IT/clean‑energy bias—so niche or nascent themes aren’t underrepresented.
  • LoRA‑style adaptation. Keep a strong text‑embedding backbone frozen; adapt with small trainable layers for fast updates as themes evolve.

Evidence that it works

In held‑out tests, THEME‑enhanced variants improved Hit Rate and Precision at K across a slate of embedding backbones—and even outperformed powerful general LLMs used as retrievers. More importantly for practitioners, equal‑weight top‑k portfolios (rebalanced on a rolling 14‑day horizon) saw higher Sharpe and cumulative return with drawdowns on par or better than baselines.

Takeaway: marrying language (what fits the idea) with returns (what’s working now) yields portfolios that are both faithful to the narrative and responsive to the tape.

A simplified snapshot of portfolio results

Backbone (example) Sharpe @3 Max DD @3 Cumulative Return @3
Vanilla model 0.50 −0.24 0.09
THEME‑enhanced 0.76 −0.24 0.16
Avg real thematic ETFs 0.48 −0.24 0.07

Illustrative figures distilled from the paper’s multi‑model tables; your mileage will vary by theme, K, and horizon.

What we think at Cognaptus

We’ve long argued that theme ≠ sector and narrative without timing is charity. THEME operationalizes both beliefs:

  • It encodes cross‑sector narratives (e.g., “AI software and chipmakers,” “climate‑resilient agriculture,” “privacy‑first adtech”).
  • It respects market regimes by learning from recent performance without hard‑wiring a single factor like momentum.

For our own client work, the most compelling use is as a front‑end filter and weighting prior: let THEME produce the on‑theme, near‑term‑viable pool; then layer fundamentals, liquidity, and risk controls to assemble production portfolios.

Pragmatic implementation notes

If you’re considering an internal build or a vendor evaluation, here’s a checklist to separate signal from slideware:

  1. Data breadth & hygiene

    • Theme corpus: ETF text + industry taxonomies + curated news.
    • Stock profiles: filings (MD&A, business descriptions), high‑quality news; dedupe boilerplate.
  2. Training design

    • Anchor choice: prefer theme text → stock over stock → stock; it generalizes better to novel themes.
    • Temporal labels: triplet loss using forward H‑day returns; tune (L, H) per asset class and turnover target.
    • Adaptation: LoRA for semantic stage; a small 2‑layer adapter to fuse returns for temporal stage.
  3. Evaluation that maps to P&L

    • Beyond HR/P@K, insist on rolling SR, MDD, CR with realistic frictions.
    • Run ablation on (i) anchor strategy and (ii) ETF‑only vs TRS‑augmented training.
  4. Operations

    • Precompute embeddings nightly; refresh temporal vectors on your rebalance cadence (e.g., every 5–10 trading days).
    • Expose via a simple similarity API, with guardrails for liquidity/min size and compliance screens.
  5. Governance

    • Keep model cards: theme coverage, data windows, known biases (e.g., media attention effects).
    • Monitor drift: alert when a theme’s top‑k turnover exceeds a threshold or when factor exposures jump.

Where this can go next

  • Richer signals: fundamentals (quality/valuation), event streams (earnings, ESG incidents), supply‑chain graphs for second‑order theme exposure.
  • User‑in‑the‑loop: analysts can tag “on‑narrative but too illiquid” or “overhyped”; the system should learn from that feedback.
  • Personalized thematics: tailor top‑k by investor constraints (region, carbon intensity, Sharia compliance, volatility budget).

Example: From prompt to portfolio

Prompt: “AI software and chipmakers with exposure to edge devices” System: encodes the phrase → retrieves semantically tight names → re‑orders with temporal adapter → outputs top‑k with notes (role in theme, catalyst hints, risk flags). PM workflow: apply liquidity/factor filters → equal‑weight or risk‑parity weight → set a 2‑week review cadence.


Bottom line: if you already screen themes by text and then eyeball charts for “what’s working,” THEME is the disciplined, scalable version of that instinct—codified, measurable, and refreshable.

Cognaptus: Automate the Present, Incubate the Future