User Warning: constrain_similarities

Hey @ChrisRahme, I hope you’re doing well.

I came across your answer in a post on constrain_similarities but I could not find more information about why I get the following warning:

UserWarning: constrain_similarities is set to False. It is recommended to set it to True when using cross-entropy loss.

Other than adding a retrival_intent on a ResponseSelector, the config file is the same as default:

recipe: default.v1
assistant_id: 20230424-171208-zesty-range
language: en
pipeline:
- name: WhitespaceTokenizer
- name: RegexFeaturizer
- name: LexicalSyntacticFeaturizer
- name: CountVectorsFeaturizer
- name: CountVectorsFeaturizer
  analyzer: char_wb
  min_ngram: 1
  max_ngram: 4
- name: DIETClassifier
  epochs: 100
  constrain_similarities: true
- name: EntitySynonymMapper
- name: ResponseSelector
  epochs: 100
  constrain_similarities: true
- name: FallbackClassifier
  threshold: 0.3
  ambiguity_threshold: 0.1
- name: ResponseSelector
  epochs: 100
  retrieval_intent: faq
policies:
- name: MemoizationPolicy
- name: RulePolicy
- name: UnexpecTEDIntentPolicy
  max_history: 5
  epochs: 100
- name: TEDPolicy
  max_history: 5
  epochs: 100
  constrain_similarities: true

The warning is also issued after starting the training on the ResponseSelector. If you notice, I have not added constrain_similarities: true for the ResponseSeelctor that has the retrieval_intent: true. Does adding the constrain_similarities to this ResponseSelector remove the warning? If so, why?

What are some of the things I should look out for when I encounter this warning? Is it possible to give me a brief idea about why this warning occurs and how constrain_similarties work?

Thanks!

1 Like

I have the same issue. I already set the constrain_similarities: true to My DIETClassifier config. This warning is always shown.