Usage of lm_alpha and lm_beta while testing

Hello,
I have been able to build a model with librispeech to understand the entire process.
Now, to infer (test) the model, I was initially using native_client/python/client.py.
Then I understood that building & using scorer greatly improves the testing capability. It can be used along with deepspeech executable.
I also read scorer related documentation from the official site.
I read couple of following discussion threads…

Questions about the lm_optimizer.py process??
Usage instructions for lm_optimizer?

I am still not clear about usage of lm_alpha and lm_beta hyperparameters.
When do I have to use the optimized hyperparameters for inference? Do I have to pass them along with scorer to deepspeech?
e.g. deepspeech --model /path/to/model --scorer /path/to/scorer --lm_alpha alpha_value --lm_beta beta_value --audio /path/to/audio ?
Please guide me on how and where to use lm_beta and lm_alpha…
Thanks for your guidance.

Always, as they influence how the beam search results are weighted. Different lms, different results.

Yes, lms belong to a certain combination of model and scorer. If you change any of them, you need new values.

Depending on the model, the lms don’t have a huge influence. E.g. if I use the ones from the official release for my custom German model, results are still ok. But I get better results after using the optimizer :slight_smile:

OK. So, I understand that alpha / beta values are optional along with scorer.
Apart from deepspeech, are there any other inference executables which takes as input the model, scorer and alpha/beta combines?

Newer API makes the values defaulted in scorer file, so you don’t have to force.

While running the lm_optimizer, it is taking too much time. I am running lm_optimizer on librispeech clean test dataset. I did not give any n_trial input and hence I consider it will run for 2400 times. However, one trial itself was taking almost 2.5 hrs to complete. I had set NUMEXPR_MAX_THREADS to 32 with 64 cores of CPU available. Can you please confirm if it really takes this much time? Or am I doing something wrong?
Thanks for your support.

Yes, it does, it’s quite CPU intensive.

Hello,
Just to clarify on lm_optimizer, how does it work? Does it run for 2400 trials always or if it finds the optimized alpha and beta values before, it stops earlier?

Check the code. Last time I checked it runs optuna for that. And as we don’t know the optimal parameters in advance, we have to check all possible combinations :slight_smile: