Semantic Experiences

Semantic Reactor Rule Reranker

Modify bot behavior in the Semantic Reactor

The Rule Reranker

The Rule Reranker is an advanced feature of the Semantic Reactor that allows you to tweak the default behavior of the models by applying a set of rules. When the conditions specified in a rule are satisfied in a particular candidate, then the score for that candidate adjusts and the full list of candidates is resorted.

Rule Reranker example sheet

Rules operate under a simple condition: “If the user input is similar to the Target Input and the candidate is similar to the Target Response, then boost the candidate’s score.”

Each rule is made up of five parts and each rule is applied to every candidate.

The rule’s potency is affected by the similarity of the input and response matches. If both are near perfect matches to the target, then the rule will change the candidate’s score by nearly the full rule boost. If either are just barely above their similarity minimum, then the rule will apply a much smaller change to the candidate’s score.

When a rule is applied, the score appears underlined in the results table. Click on the score to see a breakdown of the rule’s effect.

Rule Reranker example response

Any candidate list can have rules attached to it. Simply add another sheet (tab) and give it the same name as your candidate list but with “.rules” appended to it. Then make sure the “...with Reranker” option is selected, reload, and click “React” to see the effect. Note: the first line of the rules file is treated as a header row and has no effect on the sort.

Rule Reranker example response

Here is a sheet you can experiment with.

Tips

Formula

The rules system works by giving example input / response pairs and specifying how similar results should be biased.

The rule inputs are compared to the user’s input with the Semantic Matcher. Any rules which satisfy the Input Similarity Minimum (i.e. the rule’s input and user’s input have a semantic match score above that threshold) will then move on to the response matching phase.

Similar to the input phase, the rule’s response field will be semantically matched against all the candidates in the sheet’s default tab. All candidates that semantically match above that response similarity minimum will have a bias added.

The bias is calculated by multiplying three values:

input weight * response weight * rule boost = rule bias

Input weight is a (0, 1] value calculated with the formula:

Rule Reranker input formula

Similarly, the response weight is a (0,1] value calculated with the formula:

Rule Reranker response formula

Input weight and response weight are visualized with this graph:

Rule Reranker graph

Rule boost is the final field specified in the rules sheet.

Once the three values are multiplied together, this rule bias is added into the candidate’s bias.