MaartenGr / MaartenGr/BERTopic

using representation model takes much longer

Open
#1,930 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.8k
Forks
920
Avg merge
22h 24m
Merged PRs (30d)
5

Description

Hello i am running BERTopic on a mabook pro m1 with the following parameters using precomputed embeddings with sentence transformer

```
vectorizer_model = CountVectorizer(stop_words="english")
ctfidf_model = ClassTfidfTransformer(reduce_frequent_words=True)
representation_model = OpenAI(openai_client, model="gpt-3.5-turbo", delay_in_seconds=10, chat=True)

BERTopic(
vectorizer_model = vectorizer_model,
ctfidf_model = ctfidf_model,
nr_topics = 'auto',
min_topic_size = max(int(len(docs)/800),10),
representation_model = representation_model )
```

i noticed a big difference in the fitting time of the model using the representation model, 5 min without, 35 min with

is there a particular reason for that? since it is something that should be run at the end of the entire process of topic modeling it should not take 30 min to retrieve keywords and docs and send a prompt to chat gpt, maybe there is something happening that i am not aware of, thanks in advance

is there maybe a possibility to add the representation layer after fitting the model?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported BERTopic fitting times with and without the shown OpenAI representation_model settings. Trace when representation processing occurs and assess whether it can be applied after fitting; done means providing a supported post-fit workflow or clearly documenting why the extra time is expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.