Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiclass Classifier Consumes Large Memory #4689

Open
lordm opened this issue Apr 2, 2024 · 1 comment
Open

Multiclass Classifier Consumes Large Memory #4689

lordm opened this issue Apr 2, 2024 · 1 comment
Labels
Bug Bug in learning semantics, critical by default

Comments

@lordm
Copy link

lordm commented Apr 2, 2024

Describe the bug

After training a multiclass classifier, it produced a model with file size of 78 MB. Later, when the model is loaded for testing and predictions, the model consumes around 1GB of memory.

The large memory behaviour happens for both the python VW daemon. It happens only with multiclass models even if the number of classes is just 2, binary scalar models do not exhibit the same behaviour.

How to reproduce

Used this command line
vw -d train.vw -f model.model -c --holdout_after 671358 --oaa 2 --probabilities --sgd -b 28 --decay_learning_rate 0.960291948391061 -l 0.058964302633529454 --l1 7.3193537905481405e-06 --l2 1.472820769966616e-07 --loss_function logistic --passes 60 --power_t 0.013904659435534318 --random_seed 17

Number of examples 600K

Version

9.8.0

OS

Linux

Language

Python, CLI

Additional context

No response

@lordm lordm added the Bug Bug in learning semantics, critical by default label Apr 2, 2024
@JohnLangford
Copy link
Member

Can you quantify how much memory the model is using as a function of the number of classes?

If only a small number of the parameters are non zero you can use the sparse representation (--sparse_weights).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug in learning semantics, critical by default
Projects
None yet
Development

No branches or pull requests

2 participants