Next Article in Journal
Loop Modeling of the Reciprocal Inhibition Between HPA and HPG Endocrine Axes Reveals Transitions to Bistability and Critical Bifurcation Parameters
Previous Article in Journal
Agent-Based Models of Sexual Selection in Bird Vocalizations Using Generative Approaches
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

RecGen: No-Coding Shell of Rule-Based Expert System with Digital Twin and Capability-Driven Approach Elements for Building Recommendation Systems

1
Engineering Centre, Rezekne Academy of Riga Technical University, LV-4601 Rezekne, Latvia
2
Centre for Economics and Governance, Rezekne Academy of Riga Technical University, LV-4601 Rezekne, Latvia
*
Authors to whom correspondence should be addressed.
Appl. Sci. 2025, 15(19), 10482; https://doi.org/10.3390/app151910482
Submission received: 31 August 2025 / Revised: 21 September 2025 / Accepted: 25 September 2025 / Published: 27 September 2025
(This article belongs to the Section Computing and Artificial Intelligence)

Abstract

Translating knowledge into formal representation for the purpose of building an expert system is a daunting task for domain experts and requires information technology (IT) competence and software developer support. The availability of open and robust expert system shells is a way to solve this task. A new architecture of a rule-based expert system combining the digital twin paradigm and a capability-driven approach is presented in this study. The aim of the architecture is to provide a user-friendly framework for domain experts to build upon without the need to delve into technical aspects. To support this architecture, an open-source no-coding shell RecGen has been developed (Python and Django framework). RecGen was validated on a use case of an expert system for providing recommendations to reduce plate waste in schools. In addition, the article presents experiments with large language models (LLMs) by implementing a question-answering functionality in an attempt to improve the user experience while working with large expert system knowledge bases. A mean classification accuracy of 74.1% was achieved experimentally using the injection method with language prefixes. The ablation test was applied in order to investigate the effect of augmentation, injection, a linear layer size, and lowercase text on LLM accuracy. However, the analysis of the results showed that clustering algorithms would be a more suitable solution for future improvements of the expert system shell RecGen.

1. Introduction

An expert system is a type of artificial intelligence specifically designed to assist in decision-making. Expert systems serve as knowledge mediators, thus contributing to the qualification of personnel and reducing the shortage of skilled workers [1]. There are three types of expert systems: (1) rule-based expert systems; (2) case-based expert systems; and (3) neural-network-based expert systems [2]. This study focuses on the rule-based expert systems. The rule-based expert systems consist of a knowledge base and an inference engine, which processes “if–then” rules, thus simulating the decision-making of human experts [2,3,4].
Prolog is one of the popular solutions for implementing rule-based expert systems. Prolog was developed in the early 1970s. “Prolog” is an abbreviation for “PROgrammation en LOGique” to refer to the software tool designed to implement a man–machine communication system in natural language [5]. However, it is still used nowadays despite being developed more than 50 years ago.
The declarative programming language Prolog is a time-tested solution for building expert systems as it is based on first-order predicate logic providing a framework for representing and manipulating knowledge in expert systems [6]. Prolog’s architecture is based on a knowledge base of facts and rules, an inference engine consisting of backward chaining and unification, and a query system that allows users to retrieve logical consequences from the knowledge base [7]. Its ability to perform symbolic reasoning makes Prolog particularly suitable for domains that require pattern matching and rule-based logic [8].
Prolog has been applied in expert system development in domains such as medical diagnostics, industrial automation, and intelligent tutoring systems. For example, an expert system using Prolog was developed for diagnosing heart diseases using rule-based reasoning combined with fuzzy logic [9]. A veterinary expert system for diagnosing cattle diseases relied on Prolog’s pattern-matching capabilities to represent complex diagnostic rules [10]. Another example is a plant disease diagnosis system that used Prolog for knowledge representation and inference in precision agriculture applications [11].
PyKE is another solution for expert system development. It is more recent compared to Prolog. PyKE is a knowledge-based inference engine written in Python. It was introduced in 2008 by Bruce Frederiksen. The author explored the new approach to code reuse using a backward-chaining rule-based system, similar to Prolog.
PyKE allows connecting different types of knowledge bases depending on the needs of users. It supports three types of knowledge bases: fact, rule, and question. Each type requires a different data structure to describe expert knowledge. Another advantage of PyKE is fast data retrieval. However, the structure of the knowledge base complicates its usage for people without experience with Python. Moreover, PyKE is only an inference engine of an expert system. Therefore, software developers should be involved in order to create a user interface.
PyKE was used to implement a knowledge-based, data-driven decision support system, which supports the planning and control of construction projects [12]. Another example is game development. PyKE was applied in a Spyke3D framework to create intelligent agents, which simulate human-like reasoning and decision-making processes [13].
While Prolog remains a very relevant solution for designing and building modern expert systems due to its excellent knowledge representation, inference, and decision-making capabilities, it was not adopted for the task at hand due to its limited interoperability with modern software ecosystems, deployment environments, and community support. In contrast, PyKE, a more modern inference engine built on Python, is better suited to current software ecosystems. However, both solutions still require developer involvement to program expert knowledge. Therefore, there is a significant demand for a no-coding shell of rule-based expert systems, which can be used by experts without developer involvement or special training. Experts should have an opportunity to define and manage knowledge without learning a special language.
The goal of this study is to introduce a new architecture for a rule-based expert system that incorporates digital twin and capability-driven approach elements. This architecture is supported by the open-source no-coding shell called “RecGen”, which enables experts to define and manage “if–then” rules. The system is specialized in generating recommendations. However, the architecture is designed with future extensibility and enhancement in mind. The architecture mainly considers the application of artificial intelligence, as well as the fact that the expert system can integrate sensors in the future. This capability is predefined by the digital twin paradigm. Additionally, the open-source shell is developed in Python 3 using a Django 4.2 framework, ensuring compatibility with modern software ecosystems.

2. Materials and Methods

2.1. Traditional Architecture of Rule-Based Expert System

The long-established architecture of rule-based expert systems is based on three components (see Figure 1) [2,3,4,14]:
  • A knowledge base—a database of expert knowledge, which is described by facts and rules. The rules are conditional statements to trigger conclusions.
  • An inference engine—an artificial intelligence, which mimics an expert decision-making using rules predefined in the knowledge base. The inference engine analyzes a working memory, which describes a problem or a situation explained by a user.
  • A user interface—an input–output terminal for the users of an expert system, which includes an interpreter to transform a user input to a format compatible with an inference engine and an explanator to translate an output of an expert system to a readable form for a user.
A rule-based system consists of facts and “if–then” rules [2,3,4], which, as nodes and edges, establish a knowledge graph represented by AND–OR trees. “If–then” rules are presented in the form “If A and B then C” [3,4,15], where “A and B” is a premise (condition) and C is a conclusion [4]. There are two inference models: (1) forward chaining (FC); (2) and backward chaining (BC) [4]. If the FC model starts an analysis from simple facts in a knowledge base and it inferences all possible conclusions, then the BC model is launched from a conclusion to find all relevant facts to support it.

2.2. Rule-Based Expert System with Digital Twin Elements for Building Recommendation Systems

This study presents the new architecture of a rule-based expert system. The concept of the new architecture is based on the paradigm “digital twin”. Meanwhile, the working mechanisms of the new architecture are based on the concept of Capability-Driven Development (CDD) methodology. At this moment, there are many different branch methods like LightCDD or ARTSS, which propose the core idea—a capability-driven approach for an organization management. The new architecture is specifically designed for monitoring tasks and providing recommendations.
The main idea behind the CDD methodology is the organization’s capability. The capability refers to the organization’s ability to deliver a certain business value in dynamically changing circumstances [16]. The concept of CDD methodology shares the common idea of risk-based management [17]; it focuses on the control of risks, which arise in the external environment or within the internal ecosystem, through the development of mitigation mechanisms to reduce their negative impact on a business. Additionally, the key feature of CDD methodology lies in its focus on software development. It makes designs of information systems more accessible to business stakeholders to articulate their business needs more efficiently [16].
If risks are identified, the CDD-based system provides adjustments to achieve and optimize key performance indicators (KPIs) of an organization. The capability is an ability to monitor internal and external impact factors to timely action on changes to optimize KPIs. Another positive feature of CDD methodology is a data-driven approach. The contexts (states) of an environment or an internal ecosystem must be expressed by measurable parameters, which can be collected using sensors and brokers or be manually input. This data-driven approach with the measurable properties and the KPIs is an excellent precondition for the development of digital twins. Meanwhile, the paradigm of the digital twin became a cornerstone of intelligent systems, because the artificial intelligence (AI) must somehow “feel” and “see” a physical world to analyze it, and the digital twin provides this sensory ability to AI.
If a digital system only mirrors a physical object, it is called a digital shadow. The digital shadow is restricted to monitoring. Meanwhile, a digital twin is characterized by a module, which can impact a physical object. There are different types of digital twins depending on the impact form on a physical object. Considering taxonomy of Ref. [18], prescriptive digital twins provide intelligence for recommending corrective and preventive actions on the real-life objects usually based on optimization algorithms and expert heuristics. However, a decision still is taken by humans, who also trigger the remote or on-site execution of interventions.
The proposed architecture is illustrated in Figure 2. The concept of the prescriptive digital twin consists of two components: (1) a working memory, which provides the functions of a digital shadow and describes the actual situation; and (2) an inference engine, which generates recommendations to managers of an organization. Meanwhile, the inference engine operates based on the capability-driven approach paradigm. It analyzes the current situation (the measurable context) and provides adjustments through recommendations aimed at optimizing KPIs of the organization.
At the same time, the new architecture (see Figure 2) contains all components of a rule-based expert system, a user interface, an inference engine, and a knowledge base, where the conclusions are replaced by the recommendations (adjustments) and the working memory is described by the KPIs and a measurable context. Moreover, the knowledge base contains “if–then” rules, which are defined using the structure depicted in Equation (1):
if x is not y, then q,
where x is a fact, which does not satisfy an expected result y, and then a recommendation q is provided to a user.
The synergy among three concepts—an expert system, a digital twin, and CDD—is established through the following approach: the expert system acts as the heuristic engine for the prescriptive digital twin, while the heuristic of the expert system is grounded in the capability metamodel of the CDD methodology.
Considering the CDD methodology and the paradigm of a digital twin, a fact should be a measurable property (data-based feature). Therefore, the Likert Scale is used to code qualitative data and to satisfy the requirements of the measurable properties. The collection of rules is completed through a spreadsheet (see Figure 3), which can be imported into the system. Our experience showed that the simpler method to obtain knowledge from experts is to ask them to fill a spreadsheet with a set of logical conditions than to train experts to use computer-compatible notations like web ontologies or to teach them Prolog. Additionally, a spreadsheet can be shared with a team using existing web tools commonly known to people like Google Drive or One Drive.
Each question is a measurable property, which belongs to a category, which is a context considering CDD terminology. Each context/category can be connected to a recommendation as well. If the context (group of questions) does not satisfy the minimal quality level, it activates these recommendations (see Equation (2)):
if β(X) does not satisfy γ, then Q
where β is a context, which is calculated based on connected set of measurable properties (X). Meanwhile, the requirement γ is a summary value, for example, the percentage of satisfied measurable properties. If a context β does not satisfy the minimal requirements γ, it can recommend the more global and ambitious tasks (Q), which must be carried out to improve the current situation instead of multiple small recommendations.
To support the proposed architecture, the no-coding shell called “RecGen” was developed. It is available under license Apache 2.0 in GitHub repository [19]. RecGen does not support all functions depicted in the architecture (Figure 2), but it is an open-source project, which can be freely extended by scientific community. At this moment, RecGen supports the generation of a user interface from a spreadsheet and an inference engine, which activates the recommendations using “if–then” rules (see Equations (1) and (2)). In our study, the shell was validated on the use-case focused on reducing plate waste in schools (see Section 2.3).
Additionally, the concept of architecture contains two elements, “LLM support” and “AI support”. The developed no-coding shell does not support these functions. However, the experimental study of LLM support is presented in this article (see Section 2.4). In this study, we discuss LLM filter to scope expert system recommendations, considering user interest. Meanwhile, the example of AI support can be found in the article “Plate Waste Forecasting Using the Monte Carlo Method for Effective Decision Making in Latvian Schools” [20]. It describes forecasting method, which can predict the KPI “plate waste (kg/week)” based on the measurable properties: number of students, lunch duration, the number of unsatisfied children with school menu, and the number of children who eat external food. LLM and AI support were integrated into the validation project in the separate version due to their specialized use cases. The shell is built using the Django framework, which allows seamless integration of LLM and AI capabilities through Django applications (modules/extensions). Since Django is based on a programming language Python with a large developer community and extensive AI libraries, the enhancing of the open-source shell with AI features is both practical and efficient.
The last undiscussed component of the architecture is a “system input terminal”, which collects data automatically from sensors or brokers. It is a common concept for prescriptive digital twins, which has large potential and cannot be ignored. At this moment, this component is not integrated into the shell. However, how can this component assist an expert system? For example, the authors of Ref. [21] presented the concept of a prescriptive digital twin to predict a remaining useful life of physical engines. Sensors are placed on a physical engine and monitoring data is acquired in real time, and then they are transferred to the digital twin to predict a remaining useful life. Meanwhile, an operator receives recommendations about the most suitable maintenance solutions [21]. In general, the expert system can be connected to sensors, which transfer facts to an inference engine for a periodic analysis. This concept can be suitable for short-term recommendations, which are actualized within hours or days.
In conclusion, it is useful to mention that the proposed architecture is classified as a rule-based expert system with digital twin elements, not the other way around (digital twin with expert system elements), because the core functionality is based on logical conditions and expert knowledge.

2.3. Validation Use-Case of RecGen Shell: Reduction in Plate Waste in Latvian Schools

The no-coding shell RecGen of the rule-based expert system was developed under the project lzp-2022/1-0492, focused on reducing plate waste in Latvian schools.
Nowadays, food waste (FW) is considered one of the global sustainability challenges, negatively affecting ecology by increasing environmental costs, causing economic resource depletion in the global economy and leading to food insecurity and social inequality [22,23,24,25]). Approximately one-third of all food intended for human consumption worldwide is wasted, amounting to more than 1.3 billion tonnes per year, which translates into economic losses of around USD 1 trillion [26,27,28,29,30].
The largest amount of FW occurs at the consumption stage, where FW accounts for up to 60% of total global FW [31]. Institutional catering (schools, hospitals, nursing homes, etc.) is a relatively significant contributor to FW at the consumption level. However, school catering and students as food consumers are considered a unique setting where changes in food consumption behavior can be achieved, leading to a significant reduction in FW [32]. Students represent a new generation of consumers who can be flexibly influenced through education, awareness-raising, and nudging interventions to foster responsible food consumption behavior [32,33,34,35,36,37,38,39,40,41,42,43].
Research on FW in school catering in Latvia predominantly focuses on plate waste (PW), which can reach up to 23.6% of the served food volume [33]. This high level of PW stems from a partly pre-served and unsustainable school catering model, where students are not given the opportunity to choose the type and portion size of the main course. To reduce PW levels in Latvian schools operating under a similar catering model and to make the catering service more sustainable, an expert system was developed. This system supports school administrators in decision-making by helping to adapt the school ecosystem and catering service in line with expert recommendations aimed at reducing PW, primarily by influencing students’ behavior as food consumers, and promoting adjustments to canteen spaces, kitchen infrastructure, and kitchen workflow organization following best-practice standards that contribute to the reduction in both FW and PW. It should be noted that this system is more suitable for schools where catering services are provided on-site and meals are prepared in the school canteen.
At the beginning, the experts filled a spreadsheet with the measurable properties and the recommendations, which can impact plate waste (see Figure 3). The spreadsheet is available in GitHub [19]. After that, the spreadsheet was imported to the expert system to state its functionality, which consists of two main views: (1) a dashboard (see Figure 4); and (2) a user input terminal called “Audit” (see Figure 5).
Meanwhile, Table 1 outlines potential improvements for the future development of expert systems designed to reduce plate waste in schools. The improvements are grouped by the components of the architecture depicted in Figure 2.

2.4. LLM Support to Filter Measurable Properties and Recommendations

This section provides an example of how the shell can be extended with LLM considering the described architecture (see Figure 2). The task of LLM is to improve the usability of an expert system. A knowledge base of an expert system may include from several hundreds to many thousands of rules [51]. Meanwhile, the recommended length of advice list should be between 25 and 30 units (measurable properties, KPIs, or recommendations), which can be reviewed within 30 min [52]. At the same time, LLM can be applied to filter and personalize the content of expert systems based on input keywords or a short description provided by a user. The alternative is searching algorithms like TF-IDF, BM25, and Word2vec. However, the key advantage of LLMs is their ability to extract high-quality representations of textual features [53], as well as the fact that the models pretrained on large corpora can be fine-tuned to overcome data deficiency [54].
Ref. [53] provides a comprehensive review of LLMs and their application in recommendation systems. All solutions are grouped into three categories—(1) “LLM Embeddings + RS”; (2) “LLM Tokens + RS”; and (3) “LLM as RS”—where RS is a recommendation system. LLM Embeddings + RS is a solution, when a language model is used as a feature extractor. LLM Tokens + RS is like the previous solution; however, it generates tokens and does not return a vector of features. LLM as RS is a solution, when LLM is directly used to generate recommendations. However, the review of methods and architectures (in Ref. [53]) is separated into two sections: (1) “discriminative LLMs”, which include only the first category (LLM Embeddings + RS); and (2) “generative LLMs”, which groups the last two categories together. The discriminative LLMs are based on BERT architecture [55], which contain only encoder and are applied for NLU (Natural Language Understanding) tasks. BERT architecture consists of a multi-layer bidirectional encoder based on the implementation described in the article “Attention is all you need” (see Ref. [56]). An important feature of BERT model is MLM (masked language model) pre-training, when the model is trained to predict the masked word based only on the input context. There are two steps in BERT [55]: pre-training and fine-tuning. During pre-training, the model is trained on unlabeled data over different pre-training tasks. For fine-tuning, the BERT model is first initialized with the pre-trained parameters, and all of the parameters are fine-tuned using labeled data from the downstream tasks, because the key idea of authors was to develop models, which will be fine-tunable. As a result, two pretrained BERT models were developed: BERTBASE (L = 12, H = 768, A = 12, Total Parameters = 110 M) and BERTLARGE (L = 24, H = 1024, A = 16, Total Parameters = 340 M), where L is the number of layers, H is the hidden size, and A is self-attention heads [55].
To show the potential for improving the shell with LLM support, a small language model was trained to classify user requests and filter measurement properties and recommendations. The solution belongs to the following categories: “LLM Embeddings + RS” and “discriminative LLMs”. The architecture consists of the feature extractor (encoder) as depicted in Figure 6. The total number of parameters was 31 M (3.5 times smaller than BERTBASE and 11 times smaller than BERTLARGE). The tokenizer “Tiktoken” with the vocabulary “cl100k_base” was applied to support multiple languages (Latvian and English). Latvian is an extensively inflected language in contrast to English. Therefore, a BPE (byte-pair encoding) tokenizer was preferable to a word-based tokenizer. The PyTorch 2.3.1 environment was applied to develop and train LLM filter. The optimization of the model was carried out using CrossEntropyLoss algorithm, which is LogSoftmax and NLLLoss combination in PyTorch. The training was completed using GPU MSI RTX 4070 Ti (Micro-Star International, New Taipei City, Taiwan) with 7680 CUDA (NVDIA, Santa Clara, CA, USA) cores and 12 GB GDDR6X.
Two solutions were compared using the ablation experiment: (1) two models were trained separately on each language; and (2) one model was trained on both languages simultaneously, enhanced with an injection to identify the language. The injection is based on the regional settings of a user’s profile.
The language models were trained from scratch on a private dataset designed to the specific requirements of the validation expert system related to plate waste. The MLM pre-training was not completed within the language model training. However, the MLM pre-training is a critical component of BERT model as noted in Ref. [55]. Therefore, the term “LLM filter” is used in the article instead of referring to it as a BERT model. The training length was 120 epochs using Adam optimization algorithm. The batch size was 16 and the learning rate was 0.00001. The LLM training was repeated five times to collect statistics and construct the bounding-boxes to compare two solutions.
The training dataset contained 1768 samples (884 in Latvian and 884 in English) grouped by 7 categories, where one category “No Answer” was prepared for irrelevant questions (see Figure 7).
Each category was linked to relevant measurable properties and corresponding recommendations. Additional samples were generated for the category “No Answer” using each other category. These samples contained keywords relevant to the source category being semantically different, for example, “Is it allowed to play chess tournaments with robots during lunch break?”. The question can be associated with “Lunch Break Timing and Duration” due to the keywords “lunch break”; however, it is irrelevant question. The examples of other questions are provided in Table A1, in Appendix A. Meanwhile, the examples of the recommendations are available in Table A2.
The validation split was set to 10%. Testing dataset contained 140 samples (70 in Latvian and 70 in English). The augmentation Python library “NLPaug” was used to develop robust LLMs. Next, augmenters of NLPaug 1.1.11 were applied: keyboard type errors, random char {insert, substitute, swap, delete}, and random word {swap, delete, split}.
The experiment is supported with open dataset and Jupyter Notebook 7.1.2, which are attached to the article as the Supplementary Materials.

3. Results

3.1. Expert System for Plate Waste Reduction

The developed no-coding shell of rule-based expert systems was successfully applied to construct a recommendation system for school administration with the goal of reducing plate waste. Two schools participated in the test of the system. The expert system showed that school A considers 60.26% and school B 60.94% of all good practices, which identified the experts. This study is limited to software testing, so drawing definitive conclusions about the results from the schools is difficult without comprehensive statistics. More detailed information on food waste reduction in Latvian schools can be found in Ref. [33]. The study emphasizes that reducing food waste (FW) requires tailored and multi-faceted approaches. The developed recommendation system serves as a knowledge transfer tool, facilitating the communication between school managers and scientists/experts to optimize food waste reduction efforts.
For the scientific community and scholars, the open-source project RecGen was shared in GitHub under the Apache 2.0 license [19]. RecGen was developed using Python 3 and the Django 4.2 framework. The GitHub project contains the spreadsheet in the folder “Example”, for those interested in reusing the recommendations for plate waste reduction in schools. It is important to mention that Latvian schools have a specific organization of catering (see details in Ref. [33]), which was considered by the experts. In general, the developed recommendations are more suitable for schools where catering services are provided on-site and meals are prepared in the school canteen.
In comparison to Prolog and PyKE, RecGen is more user-friendly, because RecGen already has a user interface with security measures already implemented, as well as the fact that data that are needed for decision-making are imported from an already pre-formatted spreadsheet. The system reads data from a spreadsheet, parses data into a database, and shows the parsed data in the system. Meanwhile, the spreadsheet is more comfortable for experts, who can directly document their knowledge and make modifications. The experts do not need to learn logic programming. Moreover, a developer of an expert system is not required to code expert knowledge.

3.2. LLM Filter to Enhance User Experience

The second part of the study was the development of an LLM filter to enhance user experience. The LLM filter depicts the possibility to extend and improve the open-source project with AI support considering the new architecture described in Figure 2. The list of possible improvements was summarized in Section 2.3.
The developed LLM filter was integrated into the validation system as a separate Django app (see Figure 8).
Considering the precision of the LLM filter, two solutions were compared using the ablation experiment: (1) two models trained on each language separately; and (2) an injection-based model trained on both languages. Figure 9 provides the precision results for the two solutions in comparative form (the statistics are presented in Table A3, Appendix A).
The injection showed better results than the separate training on each language. The comparison was carried out with six categories without “No Answer”. Meanwhile, the experiment with seven categories showed that the category “No Answer” decreases the total accuracy of the LLM filters, but they were relatively equal to the filters without the injection. Considering augmentation, the trained filters work worse with noised samples. However, they show a more robust accuracy and depict a similar trend: the model with injection is better than the simple one; meanwhile, the category “No Answer” decreases the accuracy.

4. Discussion

If the injection provides additional accuracy within training, then there is an opposite question: “How is the accuracy affected by incorrect injection after training?”. Incorrect injections can occur in the situation where a user knows both languages and does not change regional settings using a search engine. The ablation test with inverted injections shows that LLMs are sufficiently robust (see Figure 10). It means that the injection increases the accuracy of LLMs; however, it is not a weak point after LLM training.
The investigation of trained models and the factors which impact their accuracy showed that the conversion to lowercase was forgotten in the case of the test dataset. Therefore, the ablation test was completed, and it showed that the conversion to lowercase provides the accuracy increase (see Figure 11). The samples contained capital letters mainly in the start of sentences (the first character). It means that LLM filters are trained to classify using multiple tokens and they are robust to changes. Meanwhile, it shows that LLMs are sensitive to one character/one token. In other words, the trained LLMs process discrete tokens and not the context of the whole sentence. Partially, the context loss can be explained by the uncompleted MLM pre-training, which considers the training with masking to assign a bidirectional feature, where the model can analyze the left and right context of a word [55].
The previous experiments were conducted using the default number of perceptrons (2048) in the linear layer of the PyTorch TransformerEncoderLayer (see Figure 6). The number of perceptrons influences the size of the LLM filter. To investigate this, an ablation study was performed on the parameter “dim_feedforward” (see Figure 12). The size of the LLM filters is provided in Table 2. The ablation test shows that reducing the linear layer size from 2048 to 256 perceptrons yields only a 12% decrease in memory usage and LLM filter size. However, reducing the linear layer size within a fixed training duration reduces LLM accuracy, but increasing the number of epochs allows the augmented LLM filters to achieve a comparable accuracy between the 2048 and 512/256 sizes.
Considering the model size, it is primarily influenced by the embedding layer and vocabulary size, meaning optimization can be achieved through improvements in the tokenizer and embedding. BPE tokenization was selected because Latvian is an extensively inflected language. Subword segmentation is a common approach for dealing with the open vocabulary issue. BPE encodes a sentence into a unique subword sequence. However, a sentence can be represented in multiple subword sequences even with the same vocabulary and LLM handles them as completely different inputs. These variants can be viewed as a spurious ambiguity, which might not always be resolved [57]. One of the solutions is to tune a pre-trained multilingual BERT model called mBERT, which follows the same structure of BERT, but is trained on 104 languages [58]. mBERT shows sufficiently good results for the Latvian language (see Table 3). It was compared with LVBERT, developed specially for the Latvian language. Two models were compared on three NLP tasks: Part-of-Speech (POS) tagging, Named Entity Recognition (NER), and Universal Dependency (UD) parsing [59].
The disadvantage of mBERT is its size. However, the transformer distillation method can be applied to obtain a smaller language model with comparable accuracy [60]. The method is based on knowledge distillation, proposed by Hinton et al. (2015) [61]. The method was developed to create LLMs, which can be deployed on edge devices such as mobile phones. The distillation method provided a possibility to create a TinyBERT model with 14.5 M parameters and accuracy comparable to BERTBASE. The comparison was completed on multiple datasets, where BERTBASE showed an average accuracy 79.5%, but TinyBERT showed an average accuracy of 77.0% [60]. The transformer distillation can be applied to mBERT to obtain multilingual support or to find the already distillated multilingual TinyBERT. Future studies could focus on multilingual TinyBERT to enhance the LLM filter for the expert system. An alternative approach would be to train a BERT model specifically on Latvian and English language corpora. However, multilingual TinyBERT is preferable, because it offers broader application—it can be adopted by the wider research and development community.
There are ways to enhance the proposed LLM filter. However, the filter is not sufficiently universal to be integrated into the RecGen shell. The LLM filter is based on supervised machine learning, which requires several steps: (1) a training dataset must be developed, and (2) the measurable properties and recommendations need to be organized into categories. This approach contradicts with the main principle of the no-coding shell RecGen. Therefore, the LLM filter was not included in the GitHub project. Additionally, if the expert system is meant to incorporate more measurable properties and recommendations, the dataset will need to support an increasing number of categories. Meanwhile, multiclass classification is unfeasible due to the large number of possible outputs. At the same time, the concept of categorizing information is not suitable for the no-coding shell, because users may become dissatisfied if they search for information on a potential category that is not supported. Furthermore, users may also be frustrated if they are directed to an existing category when they want an intersection of multiple categories. Moreover, LLM categories contradict and duplicate the concept of contexts, which already group the measurable properties. Therefore, LLM filters are suitable for individual projects with a finite number of recommendations like the validation system. However, the no-coding shell should be supported with a search engine based on unsupervised methods, which can perform clustering without the need for a predefined number of clusters. A potential candidate for the search engine is the DBSCAN clustering algorithm [62]. Clustering algorithms work with vectors, so text should be transformed into a vector using TF-IDF algorithm [63].

5. Conclusions

This article described the new architecture of a rule-based expert system. Each architecture must be supported by a tool to encourage its development. RecGen is an open-source no-coding shell for constructing expert systems (see Data Availability Statement). The main advantages of the proposed solution are as follows: (1) experts can develop their own expert systems without programming skills; (2) RecGen is written in Python, which is a popular programming language supported by multiple artificial intelligence packages; (3) the architecture considers the digital twin paradigm and capability-driven approach; (4) it contains a dashboard with KPIs; (5) the capability-driven approach overcomes environment risks; and (6) the digital twin paradigm provides many unique options for expert system development: the integration of sensors, and simulation and prediction using artificial intelligence. The RecGen shell was validated by the development of an expert system to reduce plate waste in Latvian schools. Domain experts were involved in defining the measurable properties and recommendations. The knowledge was collected through a spreadsheet, which was imported to the RecGen shell. The expert system was tested in two schools. The system identified that school A considers 60.26% and school B 60.94% of all good practices and there are options to reduce the plate waste.
The experiment with LLM training was added to the article to demonstrate the possibility to extend the system with AI support. The idea of AI support was considered in order to filter the measurable properties and recommendations of an expert system considering a user request, because the list of data can be very long and uncomfortable for users. However, the experiments with LLM filter training indicated that these filters are suitable for individual projects with a finite and static knowledge base like in our validation system. In contrast, LLM filters are less appropriate for expert systems with large and evolving knowledge bases, because LLM filters require continual retraining on training datasets. The preparation and retraining process is a time-consuming and complex process for regular users. This complexity conflicts with the core principle of the RecGen shell, which aims to be a user-friendly no-coding tool. Therefore, alternative filtering methods should be explored in the future. For example, text-clustering algorithms show promise as a more universal and effective approach for enhancing the RecGen shell.

Supplementary Materials

The following supporting information can be downloaded at: https://www.mdpi.com/article/10.3390/app151910482/s1.

Author Contributions

Conceptualization, S.K.; methodology, S.K. and I.Z.; software, I.A.; validation, S.K. and I.Z.; formal analysis, S.K.; investigation, S.K. and I.A.; writing—original draft preparation, S.K., I.Z., I.A., and J.L. writing—review and editing, I.Z.; visualization, S.K. and I.A.; supervision, I.Z.; project administration, J.L.; funding acquisition, J.L. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by the Latvian Council of Science, project “Testing Interventions and Developing a Knowledge-based Recommendation System to Reduce Plate Waste in School Catering in Latvia”, project No. lzp-2022/1-0492.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The open-source project RecGen is available at https://github.com/flpp20191/RecGen (accessed on 21 September 2025). The dataset and Jupyter Notebook are added to the Supplementary Materials of the article.

Conflicts of Interest

The authors declare no conflicts of interest.

Appendix A

Table A1. Examples of search questions.
Table A1. Examples of search questions.
CategoryExamples of Questions (ENG)
Dining Hall Capacity and Comfort1. Dining table space per student, cm;
2. Do students eat less if the dining hall is too noisy or crowded?
Lunch Break Timing and Duration1. Duration of the lunch break;
2. What is the minimum duration required for a lunch break in schools?
Staff Involvement and Communication1. Motivate students to eat at lunch;
2. What strategies do schools use to involve staff in reducing food waste?
Food Serving and Presentation1. Average temperature of the soup served;
2. What’s the ideal plate size for a visually appealing dinner presentation?
Menu Design and Participation1. Catering system in the form of a buffet;
2. How does student feedback influence the school menu?
Education and Healthy Habits1. Students’ awareness of healthy nutrition is sufficient;
2. How can schools help students learn the importance of not wasting food?
No Answer1. Feed stray cats with leftovers from the plate;
2. Reading a book during lunch?
Table A2. Examples of recommendations.
Table A2. Examples of recommendations.
CategoryExamples of Recommendations (ENG)
Dining Hall Capacity and Comfort1. Ensure the permissible number of students in the dining hall;
2. Provide enough table space per student in the dining hall.
Lunch Break Timing and Duration1. Ensure that the lunch break begins no earlier than 10:30;
2. For students to finish their meal without rushing, no sports class must be before/after the lunch break.
Staff Involvement and Communication1. Involve a school personnel member (teacher or canteen employee) during the lunch break, thereby motivating students to eat or taste the food, explaining matters related to the food served and helping the students to replenish their lunch plates;
2. Improve communication and the information flow between school personnel and canteen personnel by introducing a digital system or tool that provides timely and accurate information on the number of students per meal.
Food Serving and Presentation1. Ensure that the temperature of the dishes served meets the requirements;
2. Serve the dishes upon the arrival of students at the canteen.
Menu Design and Participation1. Design a school menu in a creative way (e.g., involve students in coming up with funny or attention-grabbing names for “complex” dishes);
2. Provide an opportunity for student parents/guardians to familiarize themselves with the recipes of the dishes served at schools, thus encouraging the preparation of the same dishes in the families and the acceptance and recognition of the dishes by the students at the school.
Education and Healthy Habits1. Students need to be educated about a zero-waste lifestyle, thereby increasing their awareness of the ecological role of food waste and the negative environmental impact;
2. Design a training plan for school kitchen personnel to acquire, improve, or expand their skills and knowledge necessary for this profession (position).
No AnswerThere are no recommendations that match your question.
Table A3. The experiment results with LLM filter training.
Table A3. The experiment results with LLM filter training.
SolutionMinMeanMedianMax
LLMs without injection (6 categories)0.7250.7530.7660.767
Augmented LLMs without injection
(6 categories)
0.6290.6470.6420.670
LLM with injection (6 categories)0.7200.7660.7600.820
Augmented LLM with injection (6 categories)0.6350.6520.6450.677
LLM with injection (7 categories)0.7210.7410.7290.771
Augmented LLM with injection (7 categories)0.6240.6430.6360.662

References

  1. Ioshchikhes, B.; Frank, M.; Weigold, M. A Systematic Review of Expert Systems for Improving Energy Efficiency in the Manufacturing Industry. Energies 2024, 17, 4780. [Google Scholar] [CrossRef]
  2. Yang, X.; Zhu, C. Industrial Expert Systems Review: A Comprehensive Analysis of Typical Applications. IEEE Access 2024, 12, 88558–88584. [Google Scholar] [CrossRef]
  3. Hayes-Roth, F. Rule-Based Systems. Commun. ACM 1985, 28, 921–932. [Google Scholar] [CrossRef]
  4. Abraham, A. Rule-Based Expert Systems. In Handbook of Measuring System Design; Sydenham, P.H., Thorn, R., Eds.; John Wiley & Sons, Ltd.: Chichester, UK, 2005; ISBN 0-470-02143-8. [Google Scholar]
  5. Colmerauer, A.; Roussel, P. The Birth of Prolog. In History of Programming Languages—II; ACM: New York, NY, USA, 1996; pp. 331–367. ISBN 0-201-89502-1. [Google Scholar] [CrossRef]
  6. Hudgick, J.A.T. A Comparative Study of Four Major Knowledge Representation Techniques Used in Expert Systems with an Implementation Prolog. Master’s Thesis, Rochester Institute of Technology, Rochester, NY, USA, 1987. Available online: https://repository.rit.edu/cgi/viewcontent.cgi?article=1581&context=theses (accessed on 27 August 2025).
  7. Merritt, D. Using Prolog’s Inference Engine. In Springer Compass International; Springer: New York, USA, 1989; pp. 15–31. [Google Scholar] [CrossRef]
  8. Bratko, I. Prolog Programming for Artificial Intelligence; International Computer Science Series; Addison-Wesley Publishing Company: Wokingham, UK, 1986; ISBN 0-20R-14224-4. [Google Scholar]
  9. Kahtan, H.; Zamli, K.Z.; Wan Ahmad Fatthi, W.N.A.; Abdullah, A.; Abdulleteef, M.; Kamarulzaman, N.S. Heart Disease Diagnosis System Using Fuzzy Logic. In Proceedings of the 2018 7th International Conference on Software and Computer Applications (ICSCA ’18), Kuantan, Malaysia, 8–10 February 2018; Association for Computing Machinery: New York, NY, USA, 2018; pp. 297–301. [Google Scholar] [CrossRef]
  10. Fantahun, Z. Application of Data Mining with Knowledge Based System for Diagnosis and Treatment of Cattle Diseases: The Case of International Livestock Research Institute (ILRI) Animal Health Center Addis Ababa. Available online: http://repository.smuc.edu.et/handle/123456789/6429 (accessed on 30 August 2025).
  11. Barbedo, J.G.A. Expert Systems Applied to Plant Disease Diagnosis: Survey and Critical View. IEEE Lat. Am. Trans. 2016, 14, 1910–1922. [Google Scholar] [CrossRef]
  12. Sheikhkhoshkar, M.; El-Haouzi, H.B.; Aubry, A.; Hamzeh, F.; Rahimian, F. A Data-Driven and Knowledge-Based Decision Support System for Optimized Construction Planning and Control. Autom. Constr. 2025, 173, 106066. [Google Scholar] [CrossRef]
  13. Palazzo, L.; Dolcini, G.; Claudi, A.; Biancucci, G.; Sernani, P.; Ippoliti, L.; Salladini, L.; Dragoni, A.F. Spyke3D: A New Computer Games Oriented BDI Agent Framework. In Proceedings of the CGAMES’2013 USA, Louisville, KY, USA, 30 July–1 August 2013; pp. 49–53. [Google Scholar] [CrossRef]
  14. Ghany, H.A.; Sabry, I.; El-Assal, A. Applications and Analysis of Expert Systems: Literature Review. Benha J. Appl. Sci. 2023, 8, 285–292. [Google Scholar] [CrossRef]
  15. Kovas, K.; Hatzilygeroudis, I. ACRES: A Framework for (Semi)Automatic Generation of Rule-based Expert Systems with Uncertainty from Datasets. Expert Syst. 2024, 41, e13723. [Google Scholar] [CrossRef]
  16. Stirna, J.; Grabis, J.; Henkel, M.; Zdravkovic, J. Capability Driven Development—An Approach to Support Evolving Organizations. In Lecture Notes in Business Information Processing; Springer: Berlin/Heidelberg, Germany, 2012; pp. 117–131. [Google Scholar] [CrossRef]
  17. Adib, M.; Zhang, X.Z. The Risk-Based Management Control System: A Stakeholders’ Perspective to Design Management Control Systems. Int. J. Manag. Enterp. Dev. 2019, 18, 20. [Google Scholar] [CrossRef]
  18. Verdouw, C.; Tekinerdogan, B.; Beulens, A.; Wolfert, S. Digital Twins in Smart Farming. Agric. Syst. 2021, 189, 103046. [Google Scholar] [CrossRef]
  19. Flpp GitHub—Flpp20191/RecGen. Available online: https://github.com/flpp20191/RecGen (accessed on 21 September 2025).
  20. Kodors, S.; Zvaigzne, A.; Litavniece, L.; Lonska, J.; Silicka, I.; Kotane, I.; Deksne, J. Plate Waste Forecasting Using the Monte Carlo Method for Effective Decision Making in Latvian Schools. Nutrients 2022, 14, 587. [Google Scholar] [CrossRef]
  21. Mao, H.; Liu, Z.; Qiu, C.; Huang, Y.; Tan, J. Prescriptive Maintenance for Complex Products with Digital Twin Considering Production Planning and Resource Constraints. Meas. Sci. Technol. 2023, 34, 125903. [Google Scholar] [CrossRef]
  22. Caron, P.; Daguet, E.; Dury, S. The Global Food System Is Not Broken but Its Resilience Is Threatened. In Resilience and Food Security in a Food Systems Context; Béné, C., Devereux, S., Eds.; Palgrave Macmillan: Cham, Switzerland, 2023; pp. 53–79. [Google Scholar] [CrossRef]
  23. Dury, S.; Bendjebbar, P.; Hainzelin, E.; Giordano, T.; Bricas, N. (Eds.) Food Systems at Risk: New Trends and Challenges; FAO: Rome, Italy; CIRAD: Montpellier, France; European Commission: Brussels, Belgium, 2019; 128p. [CrossRef]
  24. HLPE. Food Losses and Waste in the Context of Sustainable Food Systems. A Report by the High Level Panel of Experts on Food Security and Nutrition of the Committee on World Food Security and Nutrition; Rome, Italy, 2014; 116p, Available online: https://www.fao.org/cfs/cfs-hlpe/publications/hlpe-8/en (accessed on 9 January 2025).
  25. LIFE FOSTER Home Page. Available online: https://www.lifefoster.eu/major-challenges-of-the-world-food-system/ (accessed on 9 January 2025).
  26. FAO. Global Food Losses and Food Waste—Extent, Causes and Prevention; Food and Agriculture Organization of the United Nations: Rome, Italy, 2011; ISBN 978-92-5-107205-9. [Google Scholar]
  27. García-Herrero, L.; De Menna, F.; Vittuari, M. Food Waste at School. The Environmental and Cost Impact of a Canteen Meal. Waste Manag. 2019, 100, 249–258. [Google Scholar] [CrossRef]
  28. Kasavan, S.; Ali, N.I.B.M.; Ali, S.S.B.S.; Masarudin, N.A.B.; Yusoff, S.B. Quantification of Food Waste in School Canteens: A Mass Flow Analysis. Resour. Conserv. Recycl. 2021, 164, 105176. [Google Scholar] [CrossRef]
  29. Wunderlich, S.M.; Martinez, N.M. Conserving Natural Resources through Food Loss Reduction: Production and Consumption Stages of the Food Supply Chain. Int. Soil Water Conserv. Res. 2018, 6, 331–339. [Google Scholar] [CrossRef]
  30. Yahia, E.M.; Mourad, M. Food Waste at the Consumer Level. In Preventing Food Losses and Waste to Achieve Food Security and Sustainability; Burleigh Dodds Science Publishing: Cambridge, UK, 2019; ISBN 978-0-429-26662-1. [Google Scholar]
  31. Eurostat. Food Waste and Food Waste Prevention—Estimates. In Statistics Explained; Eurostat: Luxembourg, 2024; Available online: https://ec.europa.eu/eurostat/statistics-explained/index.php?title=Food_waste_and_food_waste_prevention_-_estimates (accessed on 19 July 2025).
  32. Derqui, B.; Fernandez, V.; Fayos, T. Towards More Sustainable Food Systems. Addressing Food Waste at School Canteens. Appetite 2018, 129, 1–11. [Google Scholar] [CrossRef]
  33. Lonska, J.; Kodors, S.; Deksne, J.; Litavniece, L.; Zvaigzne, A.; Silicka, I.; Kotane, I. Reducing Plate Waste in Latvian Schools: Evaluating Interventions to Promote Sustainable Food Consumption Practices. Foods 2025, 14, 126. [Google Scholar] [CrossRef] [PubMed]
  34. Prescott, M.P.; Burg, X.; Metcalfe, J.J.; Lipka, A.E.; Herritt, C.; Cunningham-Sabo, L. Healthy Planet, Healthy Youth: A Food Systems Education and Promotion Intervention to Improve Adolescent Diet Quality and Reduce Food Waste. Nutrients 2019, 11, 1869. [Google Scholar] [CrossRef]
  35. Sutinen, U.M. Assumptions About Consumers in Food Waste Campaigns: A Visual Analysis. In Food Waste Management: Solving the Wicked Problem; Närvänen, E., Mesiranta, N., Mattila, M., Heikkinen, A., Eds.; Springer International Publishing: Cham, Switzerland, 2020; pp. 225–256. ISBN 978-3-030-20561-4. [Google Scholar] [CrossRef]
  36. Malefors, C.; Sundin, N.; Tromp, M.; Eriksson, M. Testing Interventions to Reduce Food Waste in School Catering. Resour. Conserv. Recycl. 2021, 177, 105997. [Google Scholar] [CrossRef]
  37. Wyse, R.; Jackson, J.; Stacey, F.; Delaney, T.; Ivers, A.; Lecathelinais, C.; Sutherland, R. The Effectiveness of Canteen Manager Audit and Feedback Reports and Online Menu-Labels in Encouraging Healthier Food Choices within Students’ Online Lunch Orders: A Pilot Cluster Randomised Controlled Trial in Primary School Canteens in New South Wales, Australia. Appetite 2021, 169, 105856. [Google Scholar] [CrossRef]
  38. Serebrennikov, D.; Katare, B.; Kirkham, L.; Schmitt, S. Effect of Classroom Intervention on Student Food Selection and Plate Waste: Evidence from a Randomized Control Trial. PLoS ONE 2020, 15, e0226181. [Google Scholar] [CrossRef]
  39. Chu, C.-M.; Chih, C.; Teng, C.-C. Food Waste Management: A Case of Taiwanese High School Food Catering Service. Sustainability 2023, 15, 5947. [Google Scholar] [CrossRef]
  40. St Pierre, C.; Sokalsky, A.; Sacheck, J.M. Participant Perspectives on the Impact of a School-Based, Experiential Food Education Program across Childhood, Adolescence, and Young Adulthood. J. Nutr. Educ. Behav. 2024, 56, 4–15. [Google Scholar] [CrossRef]
  41. Elnakib, S.A.; Quick, V.; Mendez, M.; Downs, S.; Wackowski, O.A.; Robson, M.G. Food Waste in Schools: A Pre-/Post-Test Study Design Examining the Impact of a Food Service Training Intervention to Reduce Food Waste. Int. J. Environ. Res. Public Health 2021, 18, 6389. [Google Scholar] [CrossRef] [PubMed]
  42. Gardner, G.; Burton, W.; Sinclair, M.; Bryant, M. Interventions to Strengthen Environmental Sustainability of School Food Systems: Narrative Scoping Review. Int. J. Environ. Res. Public Health 2023, 20, 5916. [Google Scholar] [CrossRef] [PubMed]
  43. Anderson, S.M.; Olds, D.A.; Wolfe, K.L. The Impact of a Portion Plate on Plate Waste in a University Dining Hall. J. Foodserv. Manag. Educ. 2021, 15, 1–7. [Google Scholar]
  44. Malefors, C.; Secondi, L.; Marchetti, S.; Eriksson, M. Food Waste Reduction and Economic Savings in Times of Crisis: The Potential of Machine Learning Methods to Plan Guest Attendance in Swedish Public Catering during the Covid-19 Pandemic. Socio-Econ. Plan. Sci. 2021, 82, 101041. [Google Scholar] [CrossRef]
  45. Voysey, I.; Thuruthel, T.G.; Iida, F. Autonomous Dishwasher Loading from Cluttered Trays Using Pre-trained Deep Neural Networks. Eng. Rep. 2020, 3, e12321. [Google Scholar] [CrossRef]
  46. Malefors, C.; Svensson, E.; Eriksson, M. Automated Quantification Tool to Monitor Plate Waste in School Canteens. Resour. Conserv. Recycl. 2023, 200, 107288. [Google Scholar] [CrossRef]
  47. SzereMeta Spak, M.D.; ColMenero, J.C. University Restaurants Menu Planning Using Mathematical Modelling. J. Food Nutr. Res. 2021, 60, 38–48. [Google Scholar]
  48. Sigala, E.G.; Gerwin, P.; Chroni, C.; Abeliotis, K.; Strotmann, C.; Lasaridi, K. Reducing Food Waste in the HORECA Sector Using AI-Based Waste-Tracking Devices. Waste Manag. 2025, 198, 77–86. [Google Scholar] [CrossRef]
  49. Zhang, Y.; Jin, H.; Meng, D.; Wang, J.; Tan, J. A Comprehensive Survey on Process-Oriented Automatic Text Summarization with Exploration of LLM-Based Methods. arXiv 2025, arXiv:2403.02901v2. [Google Scholar]
  50. Gao, Y.; Xiong, Y.; Gao, X.; Jia, K.; Pan, J.; Bi, Y.; Dai, Y.; Sun, J.; Wang, M.; Wang, H. Retrieval-Augmented Generation for Large Language Models: A Survey. arXiv 2024, arXiv:2312.10997v5. [Google Scholar] [CrossRef]
  51. Laudon, K.C.; Laudon, J.P. Management Information Systems: Managing the Digital Firm, 11th ed.; Pearson Education: Upper Saddle River, NJ, USA, 2010; Chapter 11.4. [Google Scholar]
  52. Sharma, H. How Short or Long Should Be a Questionnaire for Any Research? Researchers’ Dilemma in Deciding the Appropriate Questionnaire Length. Saudi J. Anaesth. 2022, 16, 65–68. [Google Scholar] [CrossRef] [PubMed]
  53. Wu, L.; Zheng, Z.; Qiu, Z.; Wang, H.; Gu, H.; Shen, T.; Qin, C.; Zhu, C.; Zhu, H.; Liu, Q.; et al. A Survey on Large Language Models for Recommendation. arXiv 2023, arXiv:2305.19860v5. [Google Scholar] [CrossRef]
  54. Liu, P.; Zhang, L.; Gulla, J.A. Pre-train, Prompt and Recommendation: A Comprehensive Survey of Language Modelling Paradigm Adaptations in Recommender Systems. arXiv 2023, arXiv:2302.03735v3. [Google Scholar] [CrossRef]
  55. Devlin, J.; Chang, M.-W.; Lee, K.; Toutanova, K. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. arXiv 2019, arXiv:1810.04805v2. [Google Scholar] [CrossRef]
  56. Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A.N.; Kaiser, Ł.; Polosukhin, I. Attention Is All You Need. In Advances in Neural Information Processing Systems 30 (NeurIPS 2017); Curran Associates, Inc.: Red Hook, NY, USA, 2017; pp. 6000–6010. [Google Scholar]
  57. Kudo, T. Subword Regularization: Improving Neural Network Translation Models with Multiple Subword Candidates. arXiv 2018, arXiv:1804.10959v1. [Google Scholar] [CrossRef]
  58. Pires, T.; Schlinger, E.; Garrette, D. How Multilingual Is Multilingual BERT? arXiv 2019, arXiv:1906.01502v1. [Google Scholar] [CrossRef]
  59. Znotiņš, A.; Barzdiņš, G. LVBERT: Transformer-Based Model for Latvian Language Understanding. In Frontiers in Artificial Intelligence and Applications; IOS Press: Amsterdam, The Netherlands, 2020. [Google Scholar]
  60. Jiao, X.; Yin, Y.; Shang, L.; Jiang, X.; Chen, X.; Li, L.; Wang, F.; Liu, Q. TinyBERT: Distilling BERT for Natural Language Understanding. arXiv 2020, arXiv:1909.10351v5. [Google Scholar] [CrossRef]
  61. Hinton, G.; Vinyals, O.; Dean, J. Distilling the Knowledge in a Neural Network. arXiv 2015, arXiv:1503.02531v1. [Google Scholar] [CrossRef]
  62. Ester, M.; Kriegel, H.-P.; Sander, J.; Xu, X. A Density-Based Algorithm for Discovering Clusters in Large Spatial Databases with Noise. In Proceedings of the 2nd International Conference on Knowledge Discovery and Data Mining (KDD-96), Portland, Oregon, 2–4 August 1996; AAAI Press: Menlo Park, CA, USA, 1996; pp. 226–231. [Google Scholar]
  63. Allahyari, M.; Pouriyeh, S.; Assefi, M.; Safaei, S.; Trippe, E.D.; Gutierrez, J.B.; Kochut, K. A Brief Survey of Text Mining: Classification, Clustering and Extraction Techniques. arXiv 2017, arXiv:1707.02919v2. [Google Scholar] [CrossRef]
Figure 1. The architecture of a rule-based expert system.
Figure 1. The architecture of a rule-based expert system.
Applsci 15 10482 g001
Figure 2. The architecture of a rule-based expert system with digital twin and capability-driven approach elements.
Figure 2. The architecture of a rule-based expert system with digital twin and capability-driven approach elements.
Applsci 15 10482 g002
Figure 3. The example of expert knowledge collected using a spreadsheet.
Figure 3. The example of expert knowledge collected using a spreadsheet.
Applsci 15 10482 g003
Figure 4. The dashboard of rule-based expert system focused on reducing plate waste in schools.
Figure 4. The dashboard of rule-based expert system focused on reducing plate waste in schools.
Applsci 15 10482 g004
Figure 5. The user input terminal (audit): (a) the list of the contexts/categories; and (b) the measurable properties and their values.
Figure 5. The user input terminal (audit): (a) the list of the contexts/categories; and (b) the measurable properties and their values.
Applsci 15 10482 g005
Figure 6. The architecture of a small language model trained for user request classification.
Figure 6. The architecture of a small language model trained for user request classification.
Applsci 15 10482 g006
Figure 7. The training dataset.
Figure 7. The training dataset.
Applsci 15 10482 g007
Figure 8. LLM-based module to filter recommendations and measurable properties.
Figure 8. LLM-based module to filter recommendations and measurable properties.
Applsci 15 10482 g008
Figure 9. Ablation test: the effect of augmentation and injection.
Figure 9. Ablation test: the effect of augmentation and injection.
Applsci 15 10482 g009
Figure 10. Ablation test: the effect of inverted injections.
Figure 10. Ablation test: the effect of inverted injections.
Applsci 15 10482 g010
Figure 11. Ablation test: the effect of lowercase text.
Figure 11. Ablation test: the effect of lowercase text.
Applsci 15 10482 g011
Figure 12. Ablation test: the effect of (linear layer size, and epochs).
Figure 12. Ablation test: the effect of (linear layer size, and epochs).
Applsci 15 10482 g012
Table 1. The potential improvements of an expert system designed to reduce plate waste in schools.
Table 1. The potential improvements of an expert system designed to reduce plate waste in schools.
Architecture ModuleDescriptionRelated Sources
System input terminal and AI supportGuest attendance forecasting for school kitchens in COVID or flu seasons to optimize food production. Prediction data can be derived from dishwashing systems, with plate counting by computer vision.Refs. [44,45]
System input terminalThe expert system can be connected to food waste trackers to collect feedback from students on the reasons of plate waste, enabling it to generate recommendations for reducing waste.Ref. [46]
System input terminal and AI supportThe expert system can be integrated with mobile applications or web surveys to gather data on students’ dietary preferences. This data can be used to generate school menus or recommend specific dishes for inclusion/exclusion in the menu.Ref. [47]
System input terminal and AI supportWaste-tracking devices can transfer data to improve school menu based on food waste classification and monitor KPI “Daily per-meal food waste”.Refs. [47,48]
LLM supportText summarization is a valuable feature when multiple recommendations are provided to users. Depending on their level of details, some recommendations may overlap and can be effectively summarized.Ref. [49]
AI and LLM supportClustering algorithms and LLMs can filter questions and recommendations according to specific requests of users. Another approach is the application of the technology “Retrieval-Augmented Generation” (RAG). RAG can search appropriate recommendations using distance algorithms and summarize answers using LLM with a possibility to review source texts.Section 2.4, [50]
Table 2. The size of the LLM filters.
Table 2. The size of the LLM filters.
The Number of Perceptrons
(Dim_Feedforward)
Training ParametersMB Allocated
204830,927,366 (100%)118 (100%)
102428,826,375 (93%)110 (93%)
51227,775,751 (90%)106 (90%)
25627,250,439 (88%)104 (88%)
Table 3. mBERT and LVBERT experimental comparison [59].
Table 3. mBERT and LVBERT experimental comparison [59].
TaskmBERTLVBERT
POS (Accuracy)96.698.1
NER (F1-score)79.282.6
UD (LAS)85.789.9
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.

Share and Cite

MDPI and ACS Style

Kodors, S.; Apeinans, I.; Zarembo, I.; Lonska, J. RecGen: No-Coding Shell of Rule-Based Expert System with Digital Twin and Capability-Driven Approach Elements for Building Recommendation Systems. Appl. Sci. 2025, 15, 10482. https://doi.org/10.3390/app151910482

AMA Style

Kodors S, Apeinans I, Zarembo I, Lonska J. RecGen: No-Coding Shell of Rule-Based Expert System with Digital Twin and Capability-Driven Approach Elements for Building Recommendation Systems. Applied Sciences. 2025; 15(19):10482. https://doi.org/10.3390/app151910482

Chicago/Turabian Style

Kodors, Sergejs, Ilmars Apeinans, Imants Zarembo, and Jelena Lonska. 2025. "RecGen: No-Coding Shell of Rule-Based Expert System with Digital Twin and Capability-Driven Approach Elements for Building Recommendation Systems" Applied Sciences 15, no. 19: 10482. https://doi.org/10.3390/app151910482

APA Style

Kodors, S., Apeinans, I., Zarembo, I., & Lonska, J. (2025). RecGen: No-Coding Shell of Rule-Based Expert System with Digital Twin and Capability-Driven Approach Elements for Building Recommendation Systems. Applied Sciences, 15(19), 10482. https://doi.org/10.3390/app151910482

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop