You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/ai-services/language-service/question-answering/concepts/best-practices.md
+24-25Lines changed: 24 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ ms.service: azure-ai-language
5
5
author: laujan
6
6
ms.author: lajanuar
7
7
ms.topic: conceptual
8
-
ms.date: 07/16/2025
8
+
ms.date: 07/17/2025
9
9
ms.custom: language-service-question-answering
10
10
---
11
11
@@ -19,15 +19,15 @@ Custom question answering is continually improving the algorithms that extract q
19
19
20
20
## Creating good questions and answers
21
21
22
-
We've used the following list of question and answer pairs as representation of a project to highlight best practices when authoring projects for custom question answering.
22
+
We use the following list of question and answer pairs to represent a project. This approach helps highlight best practices when creating projects for custom question answering.
23
23
24
24
| Question | Answer |
25
25
|----------|----------|
26
26
| I want to buy a car |There are three options to buy a car.|
27
27
| I want to purchase software license |Software license can be purchased online at no cost.|
28
28
| What is the price of Microsoft stock? | $200. |
29
29
| How to buy Microsoft Services | Microsoft services can be bought online.|
30
-
| Want to sell car |Please send car pics and document.|
30
+
| Want to sell car |Send car pics and document.|
31
31
| How to get access to identification card? | Apply via company portal to get identification card.|
32
32
33
33
### When should you add alternate questions to question and answer pairs?
@@ -45,55 +45,55 @@ The service can return the expected response for semantically similar queries su
45
45
"What is the market value of a Microsoft stock?"
46
46
"What is the market value of a Microsoft share?"
47
47
48
-
However, it's important to understand that the confidence score with which the system returns the correct response will vary based on the input query and how different it is from the original questionanswer pair.
48
+
The confidence score that the system assigns to its response can vary. This variation depends on the input query and how much it differs from the original question-answer pair.
49
49
50
-
There are certain scenarios that require the customer to add an alternate question. When it's already verified that for a particular query the correct answer isn't returned despite being present in the project, we advise adding that query as an alternate question to the intended question answer pair.
50
+
There are certain scenarios that require the customer to add an alternate question. If you already verified that a specific query doesn't return the correct answer, even though the answer exists in the project, we recommend taking further action. Add that query as an alternate question to the intended question and answer pair. This step can help ensure users receive the correct response in the future.
51
51
52
52
### How many alternate questions per question answer pair is optimal?
53
53
54
-
Users can add as many alternate questions as they want, but only first 5 will be considered for core ranking. However, the rest will be useful for exact match scenarios. It is also recommended to keep the different intent/distinct alternate questions at the top for better relevance and score.
54
+
Users can add as many alternate questions as they want, but only first 5 are considered for core ranking. However, the rest is useful for exact match scenarios. We also recommended keeping the different intent/distinct alternate questions at the top for better relevance and score.
55
55
56
56
Semantic understanding in custom question answering should be able to take care of similar alternate questions.
57
57
58
-
The return on investment will start diminishing once you exceed 10 questions. Even if you're adding more than 10 alternate questions, try to make the initial 10 questions as semantically dissimilar as possible so that all kinds of intents for the answer are captured by these 10 questions. For the project at the beginning of this section, in question answer pair #1, adding alternate questions such as "How can I buy a car", "I wanna buy a car" aren't required. Whereas adding alternate questions such as "How to purchase a car", "What are the options of buying a vehicle" can be useful.
58
+
The return on investment decreases after you exceed 10 questions. Even if you include more than 10 alternate questions, focus on making the first 10 questions as semantically different as possible. By doing so, you ensure that these 10 questions capture all possible intents for the answer. For the project at the beginning of this section, in question answer pair #1, adding alternate questions such as *How can I buy a car* or *I want to buy a car* aren't required. Whereas adding alternate questions such as *How to purchase a car*, *What are the options of buying a vehicle* can be useful.
59
59
60
60
### When to add synonyms to a project?
61
61
62
62
Custom question answering provides the flexibility to use synonyms at the project level, unlike QnA Maker where synonyms are shared across projects for the entire service.
63
63
64
-
For better relevance, you need to provide a list of acronyms that the end user intends to use interchangeably. The following is a list of acceptable acronyms:
64
+
For better relevance, you need to provide a list of acronyms that the end user intends to use interchangeably. The following list details acceptable acronyms:
65
65
66
66
*`MSFT` – Microsoft
67
67
*`ID` – Identification
68
68
*`ETA` – Estimated time of Arrival
69
69
70
-
Other than acronyms, if you think your words are similar in context of a particular domain and generic language models won't consider them similar, it's better to add them as synonyms. For instance, if an auto company producing a car model X receives queries such as "my car's audio isn't working" and the project has questions on "fixing audio for car X", then we need to add 'X' and 'car' as synonyms.
70
+
Other than acronyms, if you think your words are similar in context of a particular domain and generic language models doesn't consider them similar, it's better to add them as synonyms. For instance, an auto company producing a car model X receives queries such as *my car's audio isn't working* and the project has questions on *fixing audio for car X*. Then, we need to add 'X' and 'car' as synonyms.
71
71
72
-
The transformer-based model already takes care of most of the common synonym cases, for example: `Purchase – Buy`, `Sell - Auction`, `Price – Value`. For another example, consider the following question answer pair: Q: "What is the price of Microsoft Stock?" A: "$200".
72
+
The transformer-based model already takes care of most of the common synonym cases, for example: `Purchase – Buy`, `Sell - Auction`, `Price – Value`. For another example, consider the following question answer pair: Q: *What is the price of Microsoft Stock?* A: *$200*.
73
73
74
-
If we receive user queries like "Microsoft stock value"," Microsoft share value", "Microsoft stock worth", "Microsoft share worth", "stock value", etc., you should be able to get the correct answer even though these queries have words like "share", "value", and "worth", which aren't originally present in the project.
74
+
If users ask questions like *Microsoft stock value*, *Microsoft share value*, *Microsoft stock worth*, *Microsoft share worth*, or just *stock value*, you should still be able to provide the correct answer. It's important to maintain this clarity, even though terms such as *share*, *value*, and *worth*aren't originally included in the project.
75
75
76
-
Special characters are not allowed in synonyms.
76
+
Special characters aren't allowed in synonyms.
77
77
78
78
### How are lowercase/uppercase characters treated?
79
79
80
80
Question answering takes casing into account but it's intelligent enough to understand when it's to be ignored. You shouldn't be seeing any perceivable difference due to wrong casing.
81
81
82
82
### How are question answer pairs prioritized for multi-turn questions?
83
83
84
-
When a project has hierarchical relationships (either added manually or via extraction) and the previous response was an answer related to other question answer pairs, for the next query we give slight preference to all the children questionanswer pairs, sibling questionanswer pairs, and grandchildren question answer pairs in that order. Along with any query, the [custom question answering REST API](/rest/api/questionanswering/question-answering/get-answers) expects a `context` object with the property `previousQnAId`, which denotes the last top answer. Based on this previous `QnAID`, all the related `QnAs` are boosted.
84
+
When a project includes hierarchical relationships—whether they're added manually or through extraction—special handling is applied. If the previous response addressed a question that belongs to a related set of question-answer pairs, it affects how we handle subsequent queries. For the next query, we give slight preference to all child question-answer pairs first. Preference is then given to sibling question-answer pairs, followed by grandchild question-answer pairs, in that order. Along with any query, the [custom question answering REST API](/rest/api/questionanswering/question-answering/get-answers) expects a `context` object with the property `previousQnAId`, which denotes the last top answer. Based on this previous `QnAID`, all the related `QnAs` are boosted.
85
85
86
86
### How are accents treated?
87
87
88
-
Accents are supported for all major European languages. If the query has an incorrect accent, the confidence score might be slightly different, but the service still returns the relevant answer and takes care of minor errors by leveraging fuzzy search.
88
+
Accents are supported for all major European languages. If the query has an incorrect accent, the confidence score might be slightly different, but the service still returns the relevant answer and takes care of minor errors by using fuzzy search.
89
89
90
90
### How is punctuation in a user query treated?
91
91
92
92
Punctuation is ignored in a user query before sending it to the ranking stack. Ideally it shouldn't impact the relevance scores. Punctuation that is ignored is as follows: `,?:;\"'(){}[]-+。./!*؟`
93
93
94
94
## Chit-Chat
95
95
96
-
Add chit-chat to your bot, to make your bot more conversational and engaging, with low effort. You can easily add chit-chat data sources from pre-defined personalities when creating your project, and change them at any time. Learn how to [add chit-chat to your KB](../How-To/chit-chat.md).
96
+
Add chit-chat to your bot, to make your bot more conversational and engaging, with low effort. You can easily add chit-chat data sources from predefined personalities when creating your project, and change them at any time. Learn how to [add chit-chat to your KB](../How-To/chit-chat.md).
97
97
98
98
Chit-chat is supported in [many languages](../how-to/chit-chat.md#language-support).
99
99
@@ -113,15 +113,14 @@ The responses range from formal to informal and irreverent. You should select th
113
113
114
114
### Edit bot-specific questions
115
115
116
-
There are some bot-specific questions that are part of the chit-chat data set, and have been filled in with generic answers. Change these answers to best reflect your bot details.
116
+
There are some bot-specific questions that are part of the chit-chat data set, and are completed with generic answers. Change these answers to best reflect your bot details.
117
117
118
118
We recommend making the following chit-chat question answer pairs more specific:
119
119
120
120
* Who are you?
121
121
* What can you do?
122
-
*How old are you?
122
+
*What is your age?
123
123
* Who created you?
124
-
* Hello
125
124
126
125
### Adding custom chit-chat with a metadata tag
127
126
@@ -135,11 +134,11 @@ The custom question answering REST API uses both questions and the answer to sea
135
134
136
135
Use the [`RankerType=QuestionOnly`](#choosing-ranker-type) if you don't want to search answers.
137
136
138
-
An example of this is when the project is a catalog of acronyms as questions with their full form as the answer. The value of the answer won't help to search for the appropriate answer.
137
+
An example is when the project is a catalog of acronyms as questions with their full form as the answer. The value of the answer doesn't help to search for the appropriate answer.
139
138
140
139
## Ranking/Scoring
141
140
142
-
Make sure you're making the best use of the supported ranking features. Doing so will improve the likelihood that a given user query is answered with an appropriate response.
141
+
Make sure you're making the best use of the supported ranking features. Doing so improves the likelihood that a given user query is answered with an appropriate response.
143
142
144
143
### Choosing a threshold
145
144
@@ -151,7 +150,7 @@ By default, custom question answering searches through questions and answers. If
151
150
152
151
### Add alternate questions
153
152
154
-
Alternate questions to improve the likelihood of a match with a user query. Alternate questions are useful when there are multiple ways in which the same question may be asked. This can include changes in the sentence structure and word-style.
153
+
Alternate questions to improve the likelihood of a match with a user query. Alternate questions are useful when there are multiple ways in which the same question may be asked. The alternate questions can include changes in the sentence structure and word-style.
155
154
156
155
|Original query|Alternate queries|Change|
157
156
|--|--|--|
@@ -160,15 +159,15 @@ Alternate questions to improve the likelihood of a match with a user query. Alte
160
159
161
160
### Use metadata tags to filter questions and answers
162
161
163
-
Metadata adds the ability for a client application to know it shouldn't take all answers but instead to narrow down the results of a user query based on metadata tags. The project answer can differ based on the metadata tag, even if the query is the same. For example, *"where is parking located"* can have a different answer if the location of the restaurant branch is different - that is, the metadata is *Location: Seattle* versus*Location: Redmond*.
162
+
Metadata adds the ability for a client application to know it shouldn't take all answers but instead to narrow down the results of a user query based on metadata tags. The project answer can differ based on the metadata tag, even if the query is the same. For example, the answer to *where is parking located* can vary depending on the branch location. If the metadata is *Location: Seattle*, the answer is different than if the metadata is*Location: Redmond*.
164
163
165
164
### Use synonyms
166
165
167
166
While there's some support for synonyms in the English language, use case-insensitive [word alterations](../tutorials/adding-synonyms.md) to add synonyms to keywords that take different forms.
168
167
169
168
|Original word|Synonyms|
170
169
|--|--|
171
-
|buy|purchase<br>net-banking<br>net banking|
170
+
|buy|purchase<br>Net-banking<br>Net banking|
172
171
173
172
---
174
173
@@ -183,11 +182,11 @@ For example, you might have two separate question answer pairs with the followin
183
182
|where is the parking *location*|
184
183
|where is the ATM *location*|
185
184
186
-
Since these two questions are phrased with very similar words, this similarity could cause very similar scores for many user queries that are phrased like *"where is the `<x>` location"*. Instead, try to clearly differentiate with queries like *"where is the parking lot"* and *"where is the ATM"*, by avoiding words like "location" that could be in many questions in your project.
185
+
Since these two questions are phrased with similar words, this similarity could cause similar scores for many user queries that are phrased like *where is the `<x>` location*. Instead, try to clearly differentiate your queries. For example, use specific questions like *where is the parking lot* and *where is the ATM*. Avoid using general words like *location*, since they could appear in many different questions throughout your project.
187
186
188
187
## Collaborate
189
188
190
-
Custom question answering allows users to collaborate on a project. Users need access to the associated Azure resource group in order to access the projects. Some organizations may want to outsource the project editing and maintenance, and still be able to protect access to their Azure resources. This editor-approver model is done by setting up two identical language resources with identical custom question answering projects in different subscriptions and selecting one for the edit-testing cycle. Once testing is finished, the project contents are exported and transferred with an [import-export](../how-to/migrate-knowledge-base.md) processto the language resource of the approver that will finally deploy the project and update the endpoint.
189
+
Custom question answering allows users to collaborate on a project. Users need access to the associated Azure resource group in order to access the projects. Some organizations may want to outsource the project editing and maintenance, and still be able to protect access to their Azure resources. This editor-approver model is done by setting up two identical language resources with identical custom question answering projects in different subscriptions and selecting one for the edit-testing cycle. Once testing is finished, the project contents are exported. They're then transferred using an [import-export](../how-to/migrate-knowledge-base.md) process. This process moves the contents to the language resource of the approver, who deploys the project and updates the endpoint.
0 commit comments