Skip to content

Instantly share code, notes, and snippets.

@softwaredoug
Last active April 6, 2023 23:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save softwaredoug/2ffe98e30d75e5d766b7 to your computer and use it in GitHub Desktop.
Save softwaredoug/2ffe98e30d75e5d766b7 to your computer and use it in GitHub Desktop.
Additive vs Multiplicative Boosting Solr & Elasticsearch

Ramblings for Relevant Search. Primary and Secondary ranking factors in relevance. Problem: you want to rank with two factors. Simply multiplying scores ignores the relative significance of the primary/secondary scores. For example, in the tables below, if the first column is much more important to ranking than the second factor. The second factor is more of a tie breaker for ties in the primary criteria. Additive boosting seems to do a better job at this:

Additive Boosting

Primary Secondary Sum
10 0.9 10.9
10.1 0.7 10.8
10 0.8 10.8

Multiplicative Boosting

Primary Secondary Product
10 0.9 9.0
10.1 0.7 7.06
10 0.8 8

Notice how on the second row of multiplicative boosting table, you see a step down from 0.8 -> 0.7 in the secondary ranking factor has caused a significant step down in the relevance score. This secondary impact for additive boosting has had a minor impact on the score, acting more like a nudge or tie breaker. Multiplying by a difference of 0.1 is a rather significant change in the final product.

You could solve this with multiplicative boosting by translating the secondary boost to a much lighter scalar. Instead of multiplying to scores together, you could make multiplicative boosting have a much lighter touch by computing a different factor. This requires you to really know the ranges of the secondary factor

Primary Secondary Scalar Product
10 0.9 0.99 9.9
10.1 0.7 0.98 9.89
10 0.8 0.97 9.7

Would computing a scalar from a relevance score be difficult?

In some ways, when there's no clear primary vs secondary relationship, and instead you just have a bunch of ranking factors of amorphous prioritization, trying to narrow things down to an appropriate scalar might be most appropriate.

Additive & Multiplicative Boosts Are The same

Ultimately, you can restate an additive boost as a multiplicative boost and vice-versa.

Given base score X and additive boost value A, A can be restated as multiplicative boost as follows:

X + A = A + X
      = Y * X
    Y = (X + A) / X

So the additive boost can be restated multiplicative as:

X * (X + A) / X 

Similarly multiplicative boost (M), restated as additive:

X * M = MX
X + (M - 1)X = MX

What's not satisfying is now the translated additive/multiplicative boosts are now functions of the base score X. Instead of a simple addition of A to the base score, you now multiply (X + A) / X.

Fundamentally this equivalence doesn't satisfy the question when you add vs when you multiply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment