-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Featurised slots with initial_value
get wrongly embedded in general rules
#9483
Comments
Exalate commented: samsucik commented: I'm tentatively putting this into Enable's inbox, though it might relate a fair bit to the (research-owned) Either way, I think this bug is a high-priority one, judging by the original one for this same issue. |
Exalate commented: stale[bot] commented: This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Exalate commented: samsucik commented: I just verified that this bug is still present in 3.0. To reproduce, use this adjusted 3.0 domain: version: "3.0" intents: * greet * goodbye slots: num_appts: type: categorical initial_value: single values: * none * single mappings: * type: from_entity entity: num_appts responses: utter_goodbye: * text: "Bye" @TyDunn bringing this to your attention so it doesn't get lost under layers of dust again. |
Exalate commented: JEM-Mosig commented: @JEM-Mosig is reviewer |
Exalate commented: samsucik commented: Alright, I can confirm that the initial exploration was correct and it's indeed the caching mechanism of In short: During training data generation, for each tracker, its states are generated and cached in the tracker's In both 3.0 and 2.8 (current states of the for t in rule_trackers: t._states_for_hashing = None This led to correct test-time predictions. |
Exalate commented: samsucik commented: I've added a test case which catches the bug in 3.0. The test case passes when the simple patch from my previous comment is applied to When we're implementing an actual fix in the branch I started, we should move that test case to a better place (to one of the existing test files). I couldn't quickly decide where to put it because it's a test case that tests |
Exalate commented: samsucik commented: Let's move on to how to fix this bug. There are many ways to think about it. I think the bug fundamentally exists because we currently ignore the need for policy-specific versions of training data – we take our training trackers and pass them to each policy's
Naturally, all potential fixes should be compared in terms of memory concerns as creating policy-specific training data can take consume more memory – whether in the form of storing multiple parametrised versions of cached states in a Now, I feel like we're reaching the Enable/Engine area here, so for deciding on the concrete way of fixing this bug I'd like to bring in @ka-bu (& CC @TyDunn), with the future fixing work potentially belonging to a different squad (of course, |
Exalate commented: ka-bu commented: Regarding the other approaches above:
Adding one more option: 3. This is most costly in terms of refactoring: We could adapt the state creation so that a state is unambiguous - and create both needed versions from that. That is, currently, a state can take to forms based on that ‘omit_unset_slots’ flag, which breaks the caching idea (which will only cache one of those). If we had a more general representation then we could remove the slots that have not been set for the rules in the rule policy (right before hashing again for the lookup). More questions for research:
Some more random thoughts:
@TyDunn this issue fits well with the domain + tracker featurizer disentangling work stream (Note that the domain disentangling alone does not cover this – but the prototype for the tracker featurizer rework does). |
Exalate commented: samsucik commented: At a high level: I'm not aware of past benchmarks w.r.t. the usefulness of caching states in Now to react to your more detailed points, @ka-bu (and thanks a lot for the input!):
As for your questions around the |
Exalate commented: ka-bu commented:
I think the main reason for my confusions is because of these:
I thought one reason might be un-setting a slot. But that kind of slot setting will actually look like a lot is "set" (i.e. "has_been_set" will be true). (There is a Sorry if I'm creating spam by mixing up things again. Thanks for the explanations so far and, nearly forgot to say, nice catch, @samsucik ! |
Exalate commented: ka-bu commented:
Oh, not sure what I was thinking of here but I think I get what you mean now. So this could be a) having two caches per parameter or b) on-demand computation of states with the non-cached parameter, all behind the scenes in the from cache method. So similar to 2?
yep, but not sure why I thought "clear the cache" is a good idea (Friday evening |
Exalate commented: TyDunn commented:
@ka-bu @samsucik Sounds good to me. Let's move this to Engine |
Hey @samsucik, what is the expected behaviour here for rules_loop_for_unhappy_path? Should the initial_values slot get embedded in those rules? I want to understand how the unhappy path rules work. It would be of great help? |
➤ Maxime Verger commented: 💡 Heads up! We're moving issues to Jira: https://rasa-open-source.atlassian.net/browse/OSS. From now on, this Jira board is the place where you can browse (without an account) and create issues (you'll need a free Jira account for that). This GitHub issue has already been migrated to Jira and will be closed on January 9th, 2023. Do not forget to subscribe to the corresponding Jira issue! ➡️ More information in the forum: https://forum.rasa.com/t/migration-of-rasa-oss-issues-to-jira/56569. |
Rasa Open Source version
2.8.3
Rasa SDK version
No response
Rasa X version
No response
Python version
3.8
What operating system are you using?
OSX
What happened?
We encountered this issue a long time ago and thought we fixed it in #8161. But looks like we didn't. If a featurised slot has an
initial_value
set, the slot gets included in rules that don't mention this slot explicitly. This is incorrect as those rules are then not applicable in states where the slot has a value different from the initial one.Findings from initial investigation
See bellow for an example setup to reproduce this issue.
In #8161, we introduced the
omit_unset_slots
flag, which, when trainingRulePolicy
, is used to exclude slots that are unset (i.e. set to their initial values) from general rules (i.e. from rules that don't mention those slots and should be applicable regardless of those slots' values).Unfortunately, the intended pattern with
omit_unset_slots
needs further work (and testing). What is going wrong is:omit_unset_slots
is switched off.RulePolicy
trains – creates its rule lookup, withomit_unset_slots
switched on. In doing this, trackers need to be turned into states. And, since we have the states cached from the previous step, we re-use them. And this is where things break – the previously created states incorrectly contain initial values of featurised slots because they were created withomit_unset_slots=False
.I see a few options for possible fixes:
omit_unset_slots=True
also during tracker deduplicationomit_unset_slots
Example setup to reproduce the issue Command:
The default config. Training data:
Test stories:
Domain:
Definition of done
The text was updated successfully, but these errors were encountered: