botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

Recommendation on using multiple LUIS models

Open jakobpn opened this issue 10 years ago • 35 comments

My LUIS model has reached the 20 intent limit and I need to split the model into several models to go beyond that. Do you have any recommendations on what to do in order to have a bot work with multiple LUIS models? Is this something that the Bot Framework is already capable of?

jakobpn avatar May 20 '16 23:05 jakobpn

Are you using C# or Node?

Stevenic avatar May 21 '16 11:05 Stevenic

C#

jakobpn avatar May 21 '16 14:05 jakobpn

I don't know if the Framework makes it feasible or not. Would be nice to know as we have been thinking about this with regards to a situation of having similar utterances for different intents. We were considering having a sort of generic top level LUIS that determined an overall area (such as documentation or diary) and then having a more specific LUIS that covers the utterances in that area. A sort of hierarchy of models. I would stress that we haven't actually tried this approach as yet

IanBoggs avatar May 23 '16 14:05 IanBoggs

This is a limitation on the luis.ai service and not the bot builder SDK. As @IanBoggs mentioned you can use a command dialog or a broader Luis model to categorize the incoming message and then forward the message to the right Luis model for more fine grained entity and intent recognition.

msft-shahins avatar May 23 '16 17:05 msft-shahins

@msft-shahins I need a recommendation from you. I need to use multiple LUIS model as there is a limitation of only 20 intents per LUIS model. I don't seem to fit all my utterances within these intents and I might need more. So, how would I categorize the incoming message and route it to the appropriate LUIS model? Any help would be much appreciated!

knk1988 avatar Jun 05 '16 15:06 knk1988

@knk1988 you can have a top level Luis model that do the categorization for the incoming message and then forward the message to a more specialized Luis model for intent recognition based on the category.

msft-shahins avatar Jun 05 '16 17:06 msft-shahins

@knk1988 Hi there, I am stuck with same problem, I would like to know, what was your approach on resolving this block?

sp2013hem avatar Jun 29 '16 10:06 sp2013hem

@msft-shahins Once our top level LUIS model does the categorization of the incoming message how do I redirect the message to the specialized LUIS model because everything that goes to the LUIS model is through the myBot.listenStdin() command.

botgas avatar Jun 30 '16 09:06 botgas

@botgas If you are using C# SDK, you can forward the message to another dialog using context.forward(...). @Stevenic can comment for node.js.

msft-shahins avatar Jun 30 '16 17:06 msft-shahins

@Stevenic can you please tell the way for the same in node.js. I'm sorry, I forgot to mention that I am using the node.js SDK.

botgas avatar Jul 01 '16 06:07 botgas

HI @Stevenic , can you send me an example to do this Node.js? Huge thanks.

javi-jamaa avatar Jul 11 '16 18:07 javi-jamaa

sure...

var recognizer1 = new builder.LuisRecognizer('<model 1>');
var recognizer2 = new builder.LuisRecognizer('<model 2>');
var intents = new builder.IntentDialog({ recognizers: [recognizer1, recognizer2] });

Stevenic avatar Jul 12 '16 02:07 Stevenic

hi @Stevenic can you please give a sample for C# SDK for the same problem. I tried decorated my class with 2 Luis models. But by default it identifies the "None" Intent of one of the model. How can i solve this> [LuisModel("xxxx", "yyyy")] [LuisModel("aaaa", "bbbb")] [Serializable] public class AbacusForm : LuisDialog<object> { }

b4usat avatar Aug 29 '16 07:08 b4usat

Is there a limit to how many entities can be defined for an application? I am not able to add another entity after 10.

suresh-mobilocity avatar Sep 27 '16 15:09 suresh-mobilocity

@suresh-mobilocity yup - that's the limit :)

brandonh-msft avatar Sep 27 '16 15:09 brandonh-msft

I did not understand how I can create a model or multiple models under the same application? Is the meaning of "multiple LUIS Models" referred in the original question referring to defining more than one App?

suresh-mobilocity avatar Sep 27 '16 15:09 suresh-mobilocity

@suresh-mobilocity it's not multiple models under the same app, but rather multiple apps under your LUIS account.

One way we've seen this done is creating a LUIS App for various "specialties" of your bot.

Example: bot: "hi, i can help you with applying for a license or paying a fine" "pay a fine" all subsequent dialog -> Luis Application A

"apply for a license" all subsequent dialog -> Luis Application B

brandonh-msft avatar Sep 27 '16 16:09 brandonh-msft

@brandonh-msft , thank you for clarifying my questions.

suresh-mobilocity avatar Sep 27 '16 18:09 suresh-mobilocity

@suresh-mobilocity - hi, even I am not able to use multiple Luis Models. Have you got the solution for this issue?.If yes ,can you please provide the solution. Thanks.

manish-chitre avatar Oct 19 '16 04:10 manish-chitre

@brandonh-msft Thanks for recommending that!

Selecting the correct luis app and keeping track of that context, makes more sense for performance and preventing collisions than a hierarchy of luis apps.

If you can select the correct luis app at the beginning of the interaction, then you can continue in that context assuming that luis app. (It is also possible to navigate between apps if each app learns an exit intent which sends that request back to the root model.)

In this way, you always assume the user is continuing with the same luis app context unless there is a intent that allows them to navigate to a different context, so most of the time you only need 1 luis request to discern intent and different apps can have similar intents without conflict.

This is better than a hierarchy of luis apps: The problem with a hierarcy of models is that if you have 2 models that have similar intents, the main model may not be able to know which sub model to use for continued processing. Also, every input requires 2 requests (the main luis app, and the sub luis app). This doubles costs and decreases performance.

ricklove avatar Dec 16 '16 20:12 ricklove