Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] fix NLP question_answering task when best answer is only one token #88347

Merged
merged 6 commits into from
Jul 8, 2022

Conversation

benwtrent
Copy link
Member

There are scenarios when question_answering find the best start/end token and they are the same token. An example of this is:

context: "My name is Ben and I live in London" question: "Where do I live?"

The correct answer here is London and its a single token. Without this fix, we will return in London with a lower probability.

@benwtrent benwtrent added >bug :ml Machine learning v8.4.0 labels Jul 7, 2022
@elasticmachine elasticmachine added the Team:ML Meta label for the ML team label Jul 7, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/ml-core (Team:ML)

@elasticsearchmachine
Copy link
Collaborator

Hi @benwtrent, I've created a changelog YAML for you.

@benwtrent
Copy link
Member Author

@elasticmachine update branch

@@ -212,7 +212,7 @@ static void topScores(
if (startNormalized[i] == 0) {
continue;
}
for (int j = i + 1; j < (maxAnswerLength + i) && j < tokenSize; j++) {
for (int j = i; j < (maxAnswerLength + i) && j < tokenSize; j++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 227 still has i + 1. Is that correct? If it is then it would be good to add a comment explaining why a different start point is used in the two places.

@benwtrent
Copy link
Member Author

@elasticmachine update branch

Copy link
Contributor

@droberts195 droberts195 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@benwtrent benwtrent merged commit 9abfe4b into elastic:master Jul 8, 2022
@benwtrent benwtrent deleted the bugfix/ml-q_and_a-nlp-task branch July 8, 2022 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :ml Machine learning Team:ML Meta label for the ML team v8.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants