Maximum_decoding_length explained

Hi all,

My goal is to translate some long sentences but it seems there is a limit that I can’t get through. So:

  1. Is maximum_decoding_length in OpenNMT-tf’s parameters applied during training or inference?
  2. Does the null default value for maximum_features_length and maximum_labels_length means that no filtering is done at all in the training set so very long sentences are indeed used during training?

Also, do all of the above three parameters refer to the number of tokens (words/subwords)?

I have trained a model without tampering these values and I’m trying to translate a few moderately long sentences but I can’t pass a limit, no matter how high I set max_decoding_length for inference (I’m using CTranslate2). My training set contains some much longer sentences than the ones I’m trying to translate.

1 Like


  1. maximum_decoding_length is used for inference only.
  2. Yes, null means no filtering by length. Be careful that it is not default value when using auto_config.

They all refer to the number of tokens.

1 Like

Thanks for your quick reply. Could you please elaborate on that? What is the default value then if auto_config is used?

The default value with auto_config depends on the model. For Transformer models, it is set to 100:

You can find this value in the training log when it dumps the final configuration.

1 Like

And that solves the puzzle, thanks!