Submitted:
29 October 2024
Posted:
30 October 2024
You are already at the latest version
Abstract
Keywords:
1. Introduction
2. Materials and Methods
2.1. Routing Benchmark Datasets
- Catalog recommendations, where agent has to generate search query, find corresponding wines and form a message with a proposition. Resulting message has to be grounded by search response, so model does not make up any items out of catalog;
- General questions about wine, where agent has to answer any question about wine topic in general without search or other additional actions. Here the model is allowed to talk about topic in any way, even about items which are not sold by store;
- Small talks, where agent just needs to keep a human-like friendly conversation and answer simple messages like greetings, gratitude and others. Agent is allowed to be creative and does not require any additional actions;
- Out of scope messages (offtop). Such messages should be ignored by system completely as they are either LLM jailbreaks (harmful or just attempts to use the chatbot as free LLM wrapper) or just random questions out of system’s scope (not about wines or their attributes, history, geography and the wine making process itself in case of this dataset) [21].
2.2. Semantic Routing Based on Latent Sentence Embeddings Retrieval
- Just filter input examples by another cutoff threshold to reduce the examples set size and make it more efficient;
- Save not just the original version of input example, but also a generalized version generated by LLM to cover multiple use cases at once with possibly higher similarity. Examples would become more templated to correspond to multiple requests at once.
- Fetch examples set of the route provided by developer;
- Encode all examples of route with embedder model;
- Save the first example to router memory;
- For following examples retrieve top 1 similar sample of current route, which is already saved to router memory;
- If similarity score of top 1 most similar sample is higher than example pruning threshold (a coefficient, which describes when 2 texts are too similar, so it does not make sense to save another example alike), ignore new example and do not add it to router memory;
- If similarity score of top 1 most similar sample is less than example pruning threshold, add it to router memory either as it is (first proposed approach) or pass it through LLM to generalize it (second proposed approach) and save this generalized version to router memory;
- Repeat for every route.
3. Results
3.1. Examples Pruning Effect on Semantic Routing
- Aggregation function: max;
- Number of examples to retrieve: 15;
- Similarity score threshold for each route: 0.6 (if route aggregated similarity is lower than 0.6, it would be rejected);
- Examples are provided only for valid routes: general wine questions, catalog and small talk. Offtop route is assigned only when all valid routes get rejected;
- Examples pruning threshold: 0.8;
- LLM configuration for generalization of examples: GPT 4o with temperature 0.0 and top p 0.0 [25];
- Encoder model for pruning: text-multilingual-embedding-002 by Google with task type SEMANTIC_SIMILARITY with embedding size 768;
- Full list of examples provided to router is listed in Appendix A.
3.2. Jailbreaks Prevention
3.3. Interpretability and Controlability
4. Discussion
Author Contributions
Data Availability Statement
Acknowledgments
Conflicts of Interest
Appendix A
- What are the main types of wine grapes?
- Tell me about the history of wine.
- What are some popular wine regions?
- How does climate affect wine production?
- What are the characteristics of a good Merlot?
- How do you make white wine with red grapes?
- Can wine be part of a healthy diet, and if so, how?
- What are the pros and cons of drinking wine compared to other alcoholic beverages?
- How does the taste of wine vary depending on the region it comes from?
- What are tannins in wine and how do they affect the taste?
- Can you explain the concept of ‘terroir’ in winemaking?
- What is the significance of the year on a wine bottle?
- What are sulfites in wine and why are they added?
- How does the alcohol content in wine vary and what factors influence it?
- What is the difference between dry and sweet wines?
- I’ve always wondered how to properly taste wine. Could you give me some tips on how to do this?
- I’ve noticed that some wines have a higher alcohol content than others. How does this affect the taste and the potential effects of the wine?
- I’ve heard that some wines are better suited for certain seasons. Is this true and if so, which wines are best for which seasons
- I’ve always been curious about the different wine regions around the world. Could you tell me about some of the most famous ones and what makes them unique?
- I’ve heard that certain wines should be served at specific temperatures. Is this true and if so, why?
- I’ve noticed that some wines are described as ‘full-bodied’ while others are ‘light’. What do these terms mean and how do they affect the taste of the wine?
- I’ve noticed that some wines are described as ‘full-bodied’ while others are ‘light’. What do these terms mean and how do they affect the taste of the wine?
- I’ve heard that some people collect wine as an investment. Is this a good idea and if so, which wines are best for this?
- I’ve always been curious about the process of making sparkling wine. Could you explain how it differs from still wine production?
- Can you recommend a wine for a romantic dinner?
- I want to order some wine
- What’s the price of a good bottle of ?
- I need a wine suggestion for a summer picnic.
- Tell me about the wines available in your catalog.
- What wine would you suggest for a barbecue?
- I’m looking for a specific wine I had last week.
- Can you help me find a wine within a $20 budget?
- We both enjoy sweet wines. What dessert wine would you recommend for a cozy night in?
- I’m preparing a French-themed dinner. What French wine would complement the meal?
- We’re having a cheese and wine night. What wine goes well with a variety of cheeses?
- I’m planning a surprise picnic. What rosé wine would be ideal for a sunny afternoon?
- We’re having a movie night and love red wine. What bottle would you suggest?
- Hello, I’m new to the world of wine. Could you recommend a bottle around $30 that’s not too sweet and would complement a grilled shrimp dish?
- Ciao, stasera cucino un risotto ai frutti di mare. Quale vino bianco si abbina bene senza essere troppo secco?
- Hey, I’m searching for a nice red wine around $40. I usually enjoy a good Merlot, but I’m open to other options. Anything with a smooth finish and rich fruit flavors would be great! Any recommendations?
- Hi, I need a good wine pairing for a roasted turkey dinner with herbs. I usually prefer a dry white, something like a Pinot Grigio, but I’m open to other suggestions. Do you have any recommendations around $30?
- Hello, I’m looking for a robust red wine with moderate tannins to pair with a rich mushroom and truffle pasta. Ideally, something from the Tuscany region, under $70. Any suggestions?
- Hi, I need a light and refreshing wine to pair with grilled salmon and a citrus salad. Any suggestions for something not too sweet under $25?
- Hallo! Ich suche eine gute Flasche Wein für etwa 30-40 €. Normalerweise bevorzuge ich trockenere Weißweine, wie einen Chardonnay oder vielleicht einen deutschen Riesling. Haben Sie Empfehlungen?
- I’m looking for a good but affordable wine for a casual get-together. I don’t know much about wine, so any help would be appreciated.
- Which wines would you recommend for a beginner that are easy to drink and have a fruity flavor?
- Hallo, ich suche einen vollmundigen Weißwein mit moderaten Säurenoten, der zu einem cremigen Meeresfrüchte-Risotto passt. Idealerweise etwas aus der Region Burgund, unter 50 €. Haben Sie Vorschläge?
- Je prépare un curry thaï aux crevettes ce soir. Vous pensez à un blanc plus léger ? Quelque chose qui ne dominera pas les saveurs épicées. Suggestions?
- Salut, je cherche une bouteille de vin rouge pour environ 40 €. Quelque chose de facile à boire, pas trop tannique, peut-être avec des notes de fruits rouges ? Que recommandez-vous?
- Cerco un vino da utilizzare in cucina, nello specifico per fare il risotto ai frutti di mare. Eventuali suggerimenti?
- I want to buy a wine that I can age for the next 5-10 years. What would you recommend in the $50 range?
- Hey! I need a wine recommendation for a cozy night in with friends - something that pairs well with a cheese platter. Any suggestions?
- I’m making a Thai shrimp curry tonight. Thinking a lighter white? Something that won’t overpower the spicy flavors. Any suggestions?
- Is this wine vegan-friendly?
- Hello, I’m looking for a good wine to pair with a seared tuna steak and a fresh salad. I usually enjoy a crisp Pinot Grigio, but I’m open to new suggestions. Any recommendations?
- Je prépare un magret de canard rôti avec une sauce aux airelles. Je pense à un Bordeaux, mais je suis ouvert aux suggestions. Quelque chose d’équilibré et pas trop boisé. Que recommandez-vous?
- Hey! Ich suche eine gute Flasche Wein zu gegrilltem Rinderfilet. Normalerweise nehme ich kräftige Rotweine, bin aber für Vorschläge offen. Etwas Weiches, nicht zu Trockenes, um die 40-50 €? Was empfehlen Sie?
- Hi / Hello / Hallo
- Hi there, how are you?
- Thank you for your help!
- Goodbye, have a nice day!
- What can you do as an assistant?
- I’m not sure if I want to buy anything right now, but I’ll keep your site in mind for the future.
- I’m sorry, but I didn’t find what I was looking for on your site.
- I appreciate your help, but I think I’ll look elsewhere for now.
- Thanks for your time, have a great day!
- Great selection of wines you have here.
- I’m just looking around for now, but I might have some questions later.
- This site is really easy to navigate, thanks for making it user-friendly.
- I’m not sure what I’m looking for yet, but I’ll let you know if I have any questions.
- I’m impressed with the variety of wines you offer.
- What are some of the things you can help me with?
- What kind of questions can you answer?
- Can you tell me more about your capabilities?
- What kind of information can you provide about wines?
Appendix B
References
- Minaee, Shervin, et al. Large Language Models: A Survey. arXiv, 2024. DOI.org (Datacite). [CrossRef]
- Erdem, Erkut, et al. “Neural Natural Language Generation: A Survey on Multilinguality, Multimodality, Controllability and Learning.” Journal of Artificial Intelligence Research, vol. 73, Apr. 2022, pp. 1131–207. DOI.org (Crossref). [CrossRef]
- Guo, Taicheng, et al. “Large Language Model Based Multi-Agents: A Survey of Progress and Challenges.” Proceedings of the Thirty-Third International Joint Conference on Artificial Intelligence, International Joint Conferences on Artificial Intelligence Organization, 2024, pp. 8048–57. DOI.org (Crossref). [CrossRef]
- Rebedea, Traian, et al. “NeMo Guardrails: A Toolkit for Controllable and Safe LLM Applications with Programmable Rails.” Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, Association for Computational Linguistics, 2023, pp. 431–45. DOI.org (Crossref). [CrossRef]
- Greshake, Kai, et al. “Not What You’ve Signed Up For: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injection.” Proceedings of the 16th ACM Workshop on Artificial Intelligence and Security, Association for Computing Machinery, 2023, pp. 79–90. ACM Digital Library. [CrossRef]
- Tuteja, Mohit, and Daniel González Juclà. “Long Text Classification Using Transformers with Paragraph Selection Strategies.” Proceedings of the Natural Legal Language Processing Workshop 2023, Association for Computational Linguistics, 2023, pp. 17–24. DOI.org (Crossref). [CrossRef]
- Padalko, Halyna, et al. “Ensemble Machine Learning Approaches for Fake News Classification.” Radioelectronic and Computer Systems, no. 4, Dec. 2023, pp. 5–19. DOI.org (Crossref). [CrossRef]
- Meng, Xiangbin, et al. “The Application of Large Language Models in Medicine: A Scoping Review.” iScience, vol. 27, no. 5, May 2024, p. 109713. DOI.org (Crossref). [CrossRef]
- Chumachenko, Dmytro. “Exploring Different Approaches to Epidemic Processes Simulation: Compartmental, Machine Learning, and Agent-Based Models.” Data-Centric Business and Applications, edited by Peter Štarchoň et al., vol. 208, Springer Nature Switzerland, 2024, pp. 27–54. DOI.org (Crossref). [CrossRef]
- Hakkoum, Hajar, et al. “Interpretability in the Medical Field: A Systematic Mapping and Review Study.” Applied Soft Computing, vol. 117, Mar. 2022, p. 108391. DOI.org (Crossref). [CrossRef]
- Zhang, Yu, et al. “A Survey on Neural Network Interpretability.” IEEE Transactions on Emerging Topics in Computational Intelligence, vol. 5, no. 5, Oct. 2021, pp. 726–42. DOI.org (Crossref). [CrossRef]
- Nohara, Yasunobu, et al. “Explanation of Machine Learning Models Using Shapley Additive Explanation and Application for Real Data in Hospital.” Computer Methods and Programs in Biomedicine, vol. 214, Feb. 2022, p. 106584. DOI.org (Crossref). [CrossRef]
- Parikh, Soham, et al. “Exploring Zero and Few-Shot Techniques for Intent Classification.” Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 5: Industry Track), Association for Computational Linguistics, 2023, pp. 744–51. DOI.org (Crossref). [CrossRef]
- Maksymenko, Daniil, et al. Controllability for English-Ukrainian Machine Translation by Using Style Transfer Techniques. 2023, pp. 1059–68. DOI.org (Crossref). [CrossRef]
- Chen, Qian, et al. “Neural Natural Language Inference Models Enhanced with External Knowledge.” Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), Association for Computational Linguistics, 2018, pp. 2406–17. DOI.org (Crossref). [CrossRef]
- Wu, Zhiyong, et al. “Self-Adaptive In-Context Learning: An Information Compression Perspective for In-Context Example Selection and Ordering.” Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), Association for Computational Linguistics, 2023, pp. 1423–36. DOI.org (Crossref). [CrossRef]
- Wei, Sheng-Lun, et al. “Unveiling Selection Biases: Exploring Order and Token Sensitivity in Large Language Models.” Findings of the Association for Computational Linguistics ACL 2024, Association for Computational Linguistics, 2024, pp. 5598–621. DOI.org (Crossref). [CrossRef]
- Wang, Peiyi, et al. “Large Language Models Are Not Fair Evaluators.” Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), Association for Computational Linguistics, 2024, pp. 9440–50. DOI.org (Crossref). [CrossRef]
- Singh, Chandan, et al. Rethinking Interpretability in the Era of Large Language Models. arXiv, 2024. DOI.org (Datacite). [CrossRef]
- Manias, Dimitrios Michael, et al. Semantic Routing for Enhanced Performance of LLM-Assisted Intent-Based 5G Core Network Management and Orchestration. arXiv, 2024. DOI.org (Datacite). [CrossRef]
- Wei, Alexander, et al. Jailbroken: How Does LLM Safety Training Fail? arXiv, 2023. DOI.org (Datacite). [CrossRef]
- Gemini Team, et al. Gemini 1.5: Unlocking Multimodal Understanding across Millions of Tokens of Context. arXiv, 2024. DOI.org (Datacite). [CrossRef]
- Rajpurkar, Pranav, et al. SQuAD: 100,000+ Questions for Machine Comprehension of Text. arXiv, 2016. DOI.org (Datacite). [CrossRef]
- Luo, Weidi, et al. JailBreakV-28K: A Benchmark for Assessing the Robustness of MultiModal Large Language Models against Jailbreak Attacks. arXiv, 2024. DOI.org (Datacite). [CrossRef]
- OpenAI, et al. GPT-4 Technical Report. arXiv, 2023. DOI.org (Datacite). [CrossRef]
- Lee, Jinhyuk, et al. Gecko: Versatile Text Embeddings Distilled from Large Language Models. arXiv, 2024. DOI.org (Datacite). [CrossRef]
- “Choose an Embeddings Task Type | Generative AI on Vertex AI.” Google Cloud. https://cloud.google.com/vertex-ai/generative-ai/docs/embeddings/task-types. Accessed 22 Oct. 2024.
- Molino, Piero, et al. “Parallax: Visualizing and Understanding the Semantics of Embedding Spaces via Algebraic Formulae.” Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics: System Demonstrations, Association for Computational Linguistics, 2019, pp. 165–80. DOI.org (Crossref). [CrossRef]
- Saichyshyna, Nataliia, et al. “Extension Multi30K: Multimodal Dataset for Integrated Vision and Language Research in Ukrainian.” Proceedings of the Second Ukrainian Natural Language Processing Workshop (UNLP), Association for Computational Linguistics, 2023, pp. 54–61. DOI.org (Crossref). [CrossRef]




| Route | Original examples | Synthetic | Scrapped | SQuAD | Total |
|---|---|---|---|---|---|
| General wine questions | 30 | 283 | 618 | 0 | 931 |
| Catalog | 82 | 675 | 0 | 0 | 757 |
| Small talk | 7 | 297 | 0 | 0 | 304 |
| Offtop | 0 | 0 | 0 | 884 | 884 |
| Total | 122 | 1,255 | 618 | 884 | 2,876 |
| Route | English | Each of German / French / Italian / Ukrainian |
|---|---|---|
| General wine questions | 468 | 116 |
| Catalog | 442 | 78 |
| Small talk | 172 | 33 |
| Offtop | 500 | 96 |
| Total | 1,584 | 323 |
| Router configuration | Memorized examples | Accuracy | General wine questions F1 | Catalog F1 | Small talk F1 | Offtop F1 |
|---|---|---|---|---|---|---|
| No pruning | 72 | 0.84 | 0.79 | 0.86 | 0.70 | 0.90 |
| Pruning (0.8) | 46 | 0.84 | 0.80 | 0.88 | 0.68 | 0.87 |
| Pruning (0.8) + generalization | 49 | 0.81 | 0.76 | 0.84 | 0.63 | 0.87 |
| Router configuration | Memorized examples | Accuracy | General wine questions F1 | Catalog F1 | Small talk F1 | Offtop F1 |
|---|---|---|---|---|---|---|
| No pruning | 72 | 0.85 | 0.80 | 0.86 | 0.73 | 0.90 |
| Pruning (0.8) | 46 | 0.85 | 0.81 | 0.89 | 0.71 | 0.88 |
| Pruning (0.8) + generalization | 49 | 0.82 | 0.76 | 0.85 | 0.66 | 0.88 |
| GPT 4o LLM in context learning router | - | 0.91 | 0.90 | 0.94 | 0.82 | 0.93 |
| Router configuration | Original number of examples | 0.7 threshold | 0.75 threshold | 0.8 threshold | 0.85 threshold | 0.9 threshold |
|---|---|---|---|---|---|---|
| General wine questions | 23 | 3 | 8 | 16 | 21 | 23 |
| Catalog | 32 | 2 | 10 | 16 | 25 | 32 |
| Small talk | 17 | 7 | 10 | 14 | 15 | 16 |
| Total | 72 | 12 | 28 | 46 | 61 | 71 |
| Pruning threshold | Memorized examples | Accuracy | General wine questions F1 | Catalog F1 | Small talk F1 | Offtop F1 |
|---|---|---|---|---|---|---|
| 0.70 | 12 | 0.39 | 0.00 | 0.00 | 0.45 | 0.60 |
| 0.75 | 28 | 0.80 | 0.71 | 0.85 | 0.70 | 0.84 |
| 0.80 | 46 | 0.84 | 0.80 | 0.88 | 0.68 | 0.87 |
| 0.85 | 61 | 0.85 | 0.84 | 0.88 | 0.69 | 0.89 |
| 0.90 | 71 | 0.83 | 0.79 | 0.85 | 0.68 | 0.90 |
| No pruning | 72 | 0.84 | 0.79 | 0.86 | 0.70 | 0.90 |
| Pruning threshold | Memorized examples | Accuracy | General wine questions F1 | Catalog F1 | Small talk F1 | Offtop F1 |
|---|---|---|---|---|---|---|
| 0.80 | 46 | 0.85 | 0.81 | 0.89 | 0.71 | 0.88 |
| 0.85 | 61 | 0.86 | 0.84 | 0.89 | 0.73 | 0.89 |
| 0.90 | 71 | 0.84 | 0.80 | 0.86 | 0.71 | 0.90 |
| No pruning | 72 | 0.85 | 0.80 | 0.86 | 0.73 | 0.90 |
| Router configuration | Memorized examples | Accuracy |
|---|---|---|
| No pruning | 72 | 0.97 |
| Pruning (0.8) | 46 | 0.97 |
| Pruning (0.8) + generalization | 49 | 0.97 |
| Router configuration | Memorized examples | Accuracy |
|---|---|---|
| No pruning | 72 | 0.97 |
| Pruning (0.8) | 46 | 0.97 |
| Pruning (0.8) + generalization | 49 | 0.97 |
| Router configuration | Memorized examples | Accuracy |
|---|---|---|
| No pruning | 72 | 0.32 |
| Pruning (0.8) | 46 | 0.32 |
| Pruning (0.8) + generalization | 49 | 0.22 |
| Text | Type | Similarity |
|---|---|---|
| Ciao, stasera cucino un risotto ai frutti di mare. Quale vino bianco si abbina bene senza essere troppo secco? | catalog | 0.76 |
| Can you recommend a wine for a romantic dinner? | catalog | 0.76 |
| Hello, I’m looking for a robust red wine with moderate tannins to pair with a rich mushroom and truffle pasta. Ideally, something from the Tuscany region, under $70. Any suggestions? | catalog | 0.74 |
| Hey, I’m searching for a nice red wine around $40. I usually enjoy a good Merlot, but I’m open to other options. Anything with a smooth finish and rich fruit flavors would be great! Any recommendations? | catalog | 0.74 |
| I’m preparing a French-themed dinner. What French wine would complement the meal? | catalog | 0.73 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2024 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).
