Full text
Master Degree Program in Information Management Unveiling R Package Ecosystem Using Knowledge Graphs and Large Language Models for Package Exploration Dennis Aibuedefe Irorere Master Thesis presented as partial requirement for obtaining the Master Degree in Information Management NOVA Information Management School Instituto Superior de Estatística e Gestão de Informação Universidade Nova de Lisboa MGI
NOVA Information Management School Instituto Superior de Estatística e Gestão de Informação Universidade Nova de Lisboa Unveiling R Package Ecosystem Using Knowledge Graphs and Large Language Models for Package Exploration by Dennis A. Irorere Master Thesis presented as partial requirement for obtaining the master’s degree in information management, with a specialization in Knowledge Management and Business Intelligence Supervised by Flávio L. Pinheiro PhD, NOVA Information Management School (NOVA IMS) – Universidade Nova de Lisboa June, 2024
i STATEMENT OF INTEGRITY I hereby declare having conducted this academic work with integrity. I confirm that I have not used plagiarism or any form of undue use of information or falsification of results along the process leading to its elaboration. I further declare that I have fully acknowledged the Rules of Conduct and Code of Honor from the NOVA Information Management School. [JUNE, 2024]
ii DEDICATION I dedicate this thesis to Almighty God, whose guidance, wisdom, and strength have been my pillars throughout this journey. Despite the challenges and difficulties, His presence prevailed, providing me with the fortitude to persevere and succeed. I extend my heartfelt gratitude to my partner, Love Kanebi, for your unwavering support and generosity. Your encouragement has given me the freedom and flexibility to explore my creativity and passion, and I am deeply grateful for everything you do. Your steadfast belief in me has been a constant source of motivation. To my family, especially my twin brother and the Kanebi, thank you for always looking out for me. Your prayers, support, and the peace of mind you provide have been invaluable. I am truly thankful for your constant presence and unwavering faith in me, which has been my bedrock throughout this journey. To my extended family by choice—my friends: Elijah, Simi, Tosin, Shorpe, Oluwaseun, Jephthah, Oghenekevwe, Rufai, Oluwafemi, Joseph, and Kenny. Each of you has made a significant impact on my life. I feel blessed to have you all, and I am grateful for the roles you play and the continual challenges and exemplary models you provide. To my mentors, Pastor Joel, Kevin, Adeolu, Mr. and Mrs. Adeyemo, and Russell—thank you for your mentorship and guidance. Your wisdom and support have been instrumental in shaping my journey, and I am profoundly grateful for your influence. Your insights and encouragement have been invaluable to my development. Finally, to my group of friends I made during my two-year journey of pursuing this master's degree—Rebeka, Simao, Deliane, Collins and Tristao. You all have been wonderful friends, and I cherish the memories we've made. Your companionship has made this journey enjoyable and fulfilling. I hope our paths will cross again in the future, and I look forward to continuing our friendships. This thesis is a testament to the collective support and encouragement I have received from all of you. Thank you for being part of this journey.
iii ACKNOWLEDGEMENTS I would like to begin by expressing my profound gratitude to my supervisor, Dr. Flávio L. Pinheiro, for his steadfast support and guidance throughout this journey. From the outset, your engaging teaching style has inspired me, and I deeply appreciate the freedom you afforded me to explore my creative ideas in this master’s thesis. Your continuous encouragement has been a cornerstone of this endeavor. I am also immensely thankful to Thomas Thelen and Amy E. Hodler for their invaluable support and mentorship in the intriguing realm of graph analytics and technology. The knowledge and insights I have gained from both of you over the past few months have been incredibly enriching. I cherish how our professional relationship has developed into a genuine friendship, and your guidance has been pivotal. My heartfelt thanks extend to Carolina, Joseph, and Simioluwa for your willingness to participate in interviews for this thesis. Your feedback and insights have greatly enhanced the quality of my work, and I am sincerely grateful for your contributions. I also want to extend a special thank you to Yomi for his invaluable assistance in overcoming various obstacles. Your wisdom and advice were instrumental in helping me navigate challenges, and I am grateful for your support and friendship throughout this process. I also want to thank God and my family for their continuous support and encouragement throughout this journey. Your prayers and unwavering faith have been a source of strength for me, providing the resilience needed to persevere. This journey has been a collective effort, and I am deeply grateful to everyone who has been part of it. Thank you for your support, guidance, and friendship
iv ABSTRACT Open-source packages are the backbone of modern software development, providing essential building blocks for various applications. The Comprehensive R Archive Network (CRAN) plays a crucial role in the R programming ecosystem, offering a vast repository of packages for statistical computing and data analysis. However, navigating the intricate web of dependencies and relationships between these packages poses significant challenges for users. This study introduces Cran2Graph, a novel framework that integrates large language models (LLMs) and knowledge graphs (KGs) to enhance context-aware information retrieval and recommendation within the CRAN ecosystem. By leveraging the Retrieval Augmented Generation (RAG) framework, Cran2Graph combines structured knowledge from Neo4j graph databases with the advanced language capabilities of the OpenAI API. Our results demonstrate that Cran2Graph outperforms traditional LLM models in generating contextually relevant responses, especially when handling complex, context-specific queries. Expert feedback further assessed Cran2Graph's usefulness in discovering suitable packages for their specific needs. This work highlights the potential of integrating KGs and LLMs to advance open-source ecosystems, offering a robust solution for enhancing the user experience in navigating and utilizing CRAN package. KEYWORDS Knowledge Graphs; Large Language Model; Open Source; Recommendation System
v TABLE OF CONTENTS TABLE OF CONTENTS Statement of Integrity ........................................................................................................ i Dedication ......................................................................................................................... ii Acknowledgements .......................................................................................................... iii Abstract ............................................................................................................................ iv Table of Contents .............................................................................................................. v List of Figures .................................................................................................................... vi List of Tables .................................................................................................................... vii 1. Introduction .................................................................................................................. 1 2. Related Work ................................................................................................................ 3 2.1. Open-Source Ecosystem: Comprehensive R Archive Network ............................. 4 2.2. From Simple Graph to Knowledge Graphs ............................................................ 6 2.3. The Role of Knowledge Graphs in Conversational AI and Recommendation Systems 9 2.4. Large Language Models (LLMs) ........................................................................... 11 2.5. Retrieval Augmented Generation (RAG) ............................................................. 13 2.6. Implications ......................................................................................................... 15 3. Data & Methodology ................................................................................................... 16 3.1. Data ...................................................................................................................... 16 3.2. Methodology ....................................................................................................... 19 3.2.1 Implementation of a Knowledge Graph-Based Context-Aware System using RAG Model. 19 3.2.2 Implementation of a KG-RAG Model with LangChain .................................. 22 4. Results and Discussion ................................................................................................ 23 4.1 One-hop prompt Question Comparison ............................................................... 23 4.2 User Interview in Model Comparison ................................................................... 26 5. Conclusions and Future Works ................................................................................... 28 6. Bibliographical References ......................................................................................... 29
vi LIST OF FIGURES Figure 1 – Growth of R packages published on CRAN over time. ............................................. 4 Figure 1 – RDF Graph Model of Package. .................................................................................. 7 Figure 3 – LPG Graph Model of Package. .................................................................................. 7 Figure 4 – Knowledge Graph Modeling. .................................................................................. 18 Figure 5 – Framework for Implementing CRAN Context-Aware System using KG-RAG. ........ 19 Figure 6 – Visualization of Package to Author Relationships. ................................................. 20 Figure 7 – Visualization of Company to Package and Package to Person Relationships. ....... 21 Figure 8 – Example of User Questions and Response comparison with LLMs and KG-RAG. .. 25
vii LIST OF TABLES Table 1 - Tabular Comparison of LPG and RDF ................................................................ 8 Table 2 - Showing the number of the various nodes present in the KG ……………………… 17 Table 3 - Relationship types and its total count present in the KG …………………………….. 17 Table 4 - System Specifications …………………………………………………………………………………. 23 Table 5 - Benchmark between cran2graph and gpt-based model ……………………………... 24 Table 6 - Expert Perception Survey of Cran2Graph ……………………………………………………. 26 Table 7 - Expert Satisfaction Questionnaire for Cran2Graph ……………………………………… 26
7 • The adoption of the labelled property graph (LPG) strategy and the Cypher query language by graph technology suppliers, such as Neo4j, has been observed. Figure 2: Displays the RDF Graphs schema of an R Package The Resource Description Framework (RDF) is a data paradigm emphasizing knowledge representation by encoding the graph as a set of statements. The goal is to establish a standard for publishing and exchanging data on the internet, guaranteeing that it can be understood and used across different systems (Negro et al., 2023). RDF utilizes triplets to represent each statement, consisting of three components: subject, predicate, and object as shown in Figure 2. Where “1.0.0” and “dplyr” are subject and object, which refer to as vertices, while the predicate denotes a relationship or edge between the two vertices (i.e., subject and object) in this case “IS VERSION”. This mean that dplyr is of the version 1.0.0. RDF is well-suited for constructing ontologies that define a particular knowledge domain, with a focus on the fundamental ideas and their interrelationships (Negro et al., 2023). RDF and SPARQL query language are both established by the World Wide Web Consortium (W3C). Figure 3 — Displays the LPG Graphs schema of an R Package However, the Labeled Property Graph (LPG) serves a distinct purpose. The strategy offers a rapid method of traversing graph data and doing path analysis, emphasizing the effectiveness of data storage and retrieval. The organized information in the form of key-value pairs associated with nodes and relationships in the graph ensures high efficiency as shown in Figure 3. The LPG representation primarily emphasizes the graph's structure, features, and
8 relationships. You can see in figure 3 that unlike RDF the package has its properties in a more structure way. This highlights the characteristics of graph data, which opens up new possibilities for data analysis, visualization, and the creation of machine learning algorithms that utilize graphs to derive additional insights. The LPG methodology seeks to thoroughly capture annotation details by integrating key-value pairs into the relationship structure. Below, we present an example of this approach and a corresponding Cypher query. Graph technology suppliers, such as Neo4j, have been observed adopting the LPG strategy and the Cypher query language. Table 1 — Tabular comparison of LPG and RDF Aspect LPG RDF Primary Focus Efficient storage and traversal of connections Standardized data exchange across systems Data Model Nodes, Edges, and Properties; Flexible schema without strict enforcement Subject-Predicate-Object triples, Flexible schema using RDF schema or OWL Schema Definition Schema-less or schema-flexible, No formal schema enforcement RDF Schema and OWL allow formal schema definition and reason Interoperability May lack standardized serialization formats; custom serialization Standard data serialization formats (e.g schema definition and reasoning) Query Language Cypher or Gremlin SPARQL Analytics Ease to perform analytics Difficult to perform analytics used for data exchange. Familiarity Low – academic heritage and terminology Most like the tabular nature of the developer mindset The varying viewpoints on knowledge graphs have a direct influence on the user's experience. When it comes to RDF, developers and data analysts engage with data that is serialised as statements. Thus, any activity involves modifying these statements using the SPARQL query language. The Cypher query language in LPG seamlessly interacts with the network structure by manipulating nodes, edges, and their associated characteristics. In the framework of my inquiry and the specific requirements presented by the CRAN ecosystem use case, it is crucial to choose the most suitable technology. The LPG is considered the best choice for representing data since it specifically emphasizes the information related to the connection between a package and an individual. The LPG methodology seeks to thoroughly capture annotation details by integrating key-value pairs into the relationship structure. Furthermore, the use of key-value pairs in data administration is widely acknowledged and adopted by business professionals. Also, Neo4j works well with large language models and the LangChain framework, which makes it simple
9 to perform vector similarity searches based on the embeddings created as properties in the package node. 2.3. THE ROLE OF KNOWLEDGE GRAPHS IN CONVERSATIONAL AI AND RECOMMENDATION SYSTEMS Knowledge graphs (KGs) have emerged as pivotal tools across various domains, revolutionizing recommendation systems and dialogue systems alike. They excel in capturing intricate connections between entities, thereby enhancing precision and personalization in recommendations. For instance, in e-commerce, KGs empower platforms to deliver tailored product suggestions by comprehensively understanding user preferences and item attributes (Wang et al., 2019). Similarly, in dialogue systems such as chatbots and virtual assistants, KGs play a vital role in crafting contextually appropriate responses, thereby elevating user interaction and experience (Jin et al., 2018; Lei et al., 2018; Ai et al., 2018). Moreover, KGs serve as efficient instruments for organizing unstructured data into a structured framework, enabling seamless information extraction activities (Zhang et al., 2020). By visually representing entities and their relationships in a graph structure, KGs facilitate tasks like entity recognition and relationship extraction, thus enhancing the overall efficiency of natural language processing (Zhang et al., 2020). Additionally, the integration of external knowledge into KGs has proven effective in enhancing various natural language processing tasks, including question-answering, by delivering contextually appropriate information tailored to individual needs (Ai et al., 2018). Despite limited research on the use of KGs in open-source packages for conversational AI and recommendation systems, there is potential to adapt existing frameworks and use cases to suit specific domains (Zhang et al., 2020). KGs play a pivotal role in conversations by establishing connections between essential concepts and facilitating meaningful exchanges (Zhang et al., 2020). Furthermore, KGs enhance discussions by integrating data and developing responses using natural language processing techniques, thereby effectively guiding conversations, and meeting users' information needs (Negro et al., 2023). Integrating KGs with AI systems can lead to contextual AI, enhancing an AI system's ability to learn and adapt across various applications (Barrasa et al., 2021). In personalized recommendation systems, KGs have shown immense potential across diverse sectors, including the medical field, where they aid in advancing medical research and applications by analyzing patient data from various sources (Celebi et al., 2019; Hettige et al., 2020; Gong et al., 2021). Moreover, recent studies highlight the successful integration of KGs into recommendation systems, providing structured representations that capture entities and their interconnected relationships (Guo et al., 2022; Cao et al., 2019). Furthermore, KGs are utilized in personalized food selection and question-answering applications, showcasing their adaptability and versatility in recommendation systems (Chen
10 et al., 2021; Haussmann et al., 2019). Systematic surveys of knowledge graph-based recommender systems aim to provide a comprehensive overview of recent advancements in this field, focusing on developing accurate and easy-to-understand recommendations supported by KGs (Zhang et al., 2020). Innovative methods, such as adaptive rating estimation, significantly enhance recommendation quality by incorporating heterogeneous information sources through graph-based knowledge bases (Grad-Gyenge et al., 2015). In summary, knowledge graphs serve as indispensable tools in recommendation systems and dialogue systems, facilitating personalized and contextually relevant interactions across various domains. Their ability to capture complex connections and integrate external knowledge enhances the efficacy and adaptability of AI systems, paving the way for more sophisticated and accurate recommendations tailored to individual preferences and requirements. Hence, their inclusion in this study holds paramount importance for enhancing the CRAN ecosystem’s question-answer and recommendation capabilities, promising more informed and optimized outcomes for developers and users alike.
11 2.4. LARGE LANGUAGE MODELS (LLMS) Large Language models (LLMs) utilize the Transformer architecture, as described by Vaswani et al. (2017), (Shanahan, 2022) and employ multi-head attention processes in deep neural networks, resulting in significant growth in model size and processing demands (Zhao et al., 2023). Zhao et al. (2023) have developed scaling laws to explain the effects of increasing model capacity, demonstrating substantial improvements in performance in LLMs through scaling. These models are first trained on large amounts of text data using self-supervised learning techniques, such as masked Language Modelling (e.g., BERT) or Auto-Regressive frameworks (e.g., GPT) (Brown et al., 2020) (Soman et al., 2023). The initial training step provides the models with underlying linguistic information, which may be further refined for specific tasks via supervised training (Soman et al., 2023). In modern literature, pre-training entails incorporating linguistic knowledge into a model's parameters, preparing it for further refinement through supervised learning for certain tasks. This approach emulates the transfer learning paradigm commonly used in deep neural networks, where models acquire universal characteristics from one domain and enhance them for another. LLMs architectures have been prominent in natural language comprehension. They are highly effective in generating coherent and contextually appropriate text using input prompts as a basis (Wei et al., 2021). Some other applications including integrating LLMs into recommendation systems which offers several advantages, including the extraction of high-quality textual representations and the utilization of extensive external knowledge repositories (Liu et al., 2023b). This integration enhances the interpretability and practicality of recommendation systems, as demonstrated by Gao et al. (2023), who emphasized the potential for LLM-based systems to provide explanations based on their language generation capabilities. By offering insights into the factors influencing recommendations, these systems empower users to make informed decisions and comprehend the underlying rationale behind the suggestions. Nevertheless, despite their remarkable capabilities, LLMs are competent to limitations. A major issue stems from the inherent "implicit representation" of knowledge, which can occasionally produce inaccurate information. This phenomenon, referred to as "hallucination," manifests as the production of seemingly reasonable yet incorrect responses that align with the linguistic context provided by the input prompt (Ji et al., 2022; Maynez et al., 2020; Raunak et al., 2021). Researchers have documented hallucinations in several LLMs, which has sparked worries over their dependability in applications that require utmost accuracy, such as the open-source ecosystem. Studies demonstrating the propensity of LLMs to generate inaccurate or erroneous information despite receiving properly structured input questions underscore
12 these concerns. Therefore, it is essential to tackle the problem of hallucination to improve the reliability and usefulness of LLMs in real-life situations. Various methods are being employed to reduce hallucinations and enhance the precision of LLMs. These methods encompass fine-tuning procedures, improvements to the model architecture, and techniques for augmenting the data. Researchers aim to enhance the robustness and reliability of LLMs to enable their efficient utilization across many contexts and scenarios (Soman et al., 2023) by thoroughly investigating the root causes of hallucinations and devising specific remedies. The combination of LLMs and KGs creates a mutually beneficial relationship, where each technology enhances the capabilities of the other. Pan et al. (2024) highlights the natural synergy between LLMs and KGs, proposing for their integration into a unified framework. LLMs demonstrate exceptional performance in comprehending natural language, whereas knowledge graphs (KGs) serve as organized databases of factual information, enabling logical reasoning and deduction. This integration facilitates improved performance in several downstream applications, spanning from question answering to recommender systems (Wang et al., 2021; Ke et al., 2021; Noy et al., 2019). Prior research has utilized these pre-trained Language and Logic Models (LLMs) as virtual Knowledge Graphs (KGs), showcasing their effectiveness in tasks such as Question Answering (QA) and language modelling (Dhingra et al., 2020; Guu et al., 2020). In addition, Language Models (LMs) have been enhanced using Knowledge Graphs (KGs) in order to improve knowledge-driven tasks (Zhang et al., 2019; Peters et al., 2019). Furthermore, the progress made in multi-modal LLMs, and KGs broadens the scope of this framework to handle many types of data, such as text, images, audio, and video (Zhu et al., 2023; Warren et al., 2021). The proposed synergized model involves the collaboration between LLMs and KGs to strengthen their individual capabilities. This collaboration utilizes methodologies from both domains to boost overall performance (Pan et al., 2024). This collaborative approach holds promise for addressing real-world challenges across various domains, including information retrieval, recommendation systems, and conversational AI assistants. While the integration of LLMs and KGs presents numerous opportunities, it also poses challenges that warrant attention. Soman et al. (2023) highlight the limitations of existing approaches, particularly in knowledge-intensive tasks that require up-to-date information. Prompt tuning methods, although effective, are constrained by task specificity and limited contextual awareness. To address these challenges, innovative approaches such as retrievalaugmented generation (RAG) have been proposed (Lewis et al., 2020). RAG improves the contextual understanding of LLMs by supplementing them with a non-parametric memory that includes up-to-date information about the world, such as Wikipedia (Lewis et al., 2020). This method signifies notable progress in dealing with the ever-
13 changing nature of real-world knowledge and enhancing the capabilities of LLMs beyond their existing linguistic contexts. RAG combines methodologies from both LLMs (Large Language Models) and KGs (Knowledge Graphs) to create a comprehensive approach to representing and reasoning with knowledge. In summary, the integration of LLMs and KGs holds tremendous potential to reshape the landscape of artificial intelligence and natural language processing. By leveraging the complementary strengths of these two technologies, researchers have demonstrated significant advancements in various applications, from question answering to multimodal data processing. Nevertheless, there are still obstacles to overcome when it comes to tackling jobs that need a high level of expertise and improving the understanding of the surrounding context. Novel methodologies such as RAG present encouraging resolutions to these difficulties, thereby opening avenues for future research endeavors. In the following section, we will explore the RAG framework in more detail and its significance in further enhancing the integration of LLMs and KGs to tackle intricate real-world problems. 2.5. RETRIEVAL AUGMENTED GENERATION (RAG) Retrieval-Augmented Generation (RAG) has emerged as a promising approach to addressing the challenges associated with enhancing the knowledge and accuracy of Large Language Models (LLMs) in natural language processing tasks (Jeong, 2023). With the exponential growth of information available online, ensuring that LLMs have access to relevant and up-to-date knowledge is crucial for their performance. However, strategies such as fine-tuning LLMs with new data or embedding all information into prompts are either costprohibitive or impractical (Jeong, 2023). RAG offers an alternative solution by combining pre-trained parametric and nonparametric memory to augment the generation process of LLMs (Izacard et al., 2022; Lewis et al., 2020). By integrating a retrieval mechanism with a generator, RAG enables LLMs to access external documents and retrieve relevant information based on user queries (Huang et al., 2023). This approach significantly enhances the contextual awareness and knowledge retrieval capabilities of LLMs, leading to more accurate and reliable responses in knowledgeintensive NLP tasks. The RAG model comprises two main components: the retrieval mechanism and the generator (Izacard et al., 2022). The retrieval mechanism is responsible for locating relevant information from a collection of documents based on the user's query. It leverages preexisting databases or knowledge repositories to retrieve contextually relevant reference materials. On the other hand, the generator component utilizes the retrieved information to enhance the generation process of LLMs, enabling them to produce more informed and accurate responses. In the context of open-source package recommendation systems, the integration of Retrieval-Augmented Generation (RAG) with knowledge graphs (KGs) offers numerous
14 advantages. Knowledge graphs serve as structured repositories of factual knowledge, providing a comprehensive representation of entities, relationships, and concepts (Huang et al., 2023). By incorporating KGs into the RAG framework, the retrieval mechanism gains access to additional contextual information, thereby enriching the pool of reference materials available to Large Language Models (LLMs) (Huang et al., 2023). Moreover, the structural relationships encoded in KGs play a pivotal role in enhancing the quality of information retrieved by the RAG model (Huang et al., 2023). For instance, KG- FiD exemplifies how leveraging knowledge graphs improves retrieval quality by establishing relationships among retrieved passages (Yu et al., 2022). This integration enhances the relevance and accuracy of the information retrieved by the RAG model, consequently bolstering the performance of LLMs in knowledge-intensive tasks. Several studies have explored the synergistic relationship between RAG and knowledge graphs, demonstrating its effectiveness across various applications. RAG surpasses traditional retrieval methods like DPR by jointly training the generator and retriever, thereby improving the overall performance (Huang et al., 2023). Furthermore, techniques like FiD and KG-FiD enhance the retrieval process by encoding retrieved passages and leveraging knowledge graphs to improve retrieval quality (Huang et al., 2023). Additionally, RAG has been widely applied in knowledge-intensive Natural Language Processing (NLP) tasks, including question answering, information retrieval, and document summarization (Jeong, 2023). By leveraging external knowledge sources and seamlessly integrating them into the generation process, RAG enables LLMs to produce more accurate and contextually relevant responses. The study conducted by Soman et al. (2023) introduced a KG-RAG framework, which combines a knowledge graph with a pre-trained LLM within the RAG framework. The methodology employed the Scalable Precision Medicine Open Knowledge Engine (SPOKE) (Morris et al., 2023), a biomedical knowledge graph, to construct precise and reliable biomedical prompts for Language and Learning Models (LLMs). This methodology encompassed the identification of entities from user prompts, extraction of biological concepts from the knowledge graph, production of context that takes into account the user prompt, conversion of natural language, assembly of the prompt, and retrieval of the answer. Thorough testing has proven the efficacy of this strategy in various settings. In addition, Jeong (2023) conducted a study to examine the efficacy of employing finetuning procedures and directly incorporating documents into the RAG framework as a solution to the issue of insufficient data. The study elucidated the fundamental phases of the information storage and retrieval process using the RAG model, emphasising their significance in addressing the data deficiency. The RAG model operates by employing search capabilities to get information and improve the provided results, hence providing more accurate and pertinent information.
15 Finally, Gao et al. (2023) emphasized the favorable prospects of Retrieval-Augmented Generation (RAG) in integrating information from external databases to improve the precision and reliability of models. RAG efficiently combines the inherent knowledge of LLMs with extensive external databases, facilitating ongoing updates of knowledge and incorporation of domain-specific information. In summary, the RAG framework represents a significant advancement in enhancing the knowledge retrieval capabilities of LLMs, particularly in knowledge-intensive NLP tasks. By integrating a retrieval mechanism with a generator, RAG enables LLMs to access external knowledge sources and retrieve contextually relevant information. Furthermore, integrating RAG with knowledge graphs enhances the quality of information retrieval and enriches LLMs to retrieve more accurate, relevant, and credible information, ultimately advancing the state- of-the-art in natural language understanding and generation. 2.6. IMPLICATIONS The literature review has provided valuable insights into the concepts and techniques surrounding Knowledge Graphs (KGs), Large Language Models (LLMs), and Retrieval- Augmented Generation (RAG). While existing studies have shed light on these technologies' individual capabilities and applications, there remains a notable gap in comprehensive guidance on effectively combining and managing them, particularly in domain-specific scenarios within the open-source ecosystem. This gap not only signifies a challenge but also presents a significant opportunity for novel contributions to knowledge, leveraging insights from diverse domains to address specific needs within the open-source community. Furthermore, the literature review underscores the growing prominence of the RAG framework in recent years, highlighting its role in providing context-aware information to LLMs and recommendation systems. This trend emphasizes the relevance and timeliness of our study, positioning it within an active area of research that holds promise for practical applications. Considering these insights, our research endeavors to bridge the identified gap by proposing and implementing a Knowledge Graph-RAG framework tailored to the open-source package ecosystem, with a particular emphasis on CRAN. By augmenting KGs with RAG, our study aims to showcase how these technologies can synergize to overcome the limitations faced by LLM systems within the open-source domain. Through empirical investigations and practical demonstrations, we seek to provide actionable insights and solutions for effectively leveraging internal business information to enhance the performance and applicability of LLMs within specific domains. By building upon the foundations laid by existing literature and leveraging state-of-the-art technologies, we aim to chart a path towards more efficient and effective utilization of LLMs in domain-specific contexts, ultimately enriching the user experience and driving innovation within the open-source ecosystem.
16 3. DATA & METHODOLOGY 3.1. DATA The data extraction process was facilitated using R and the CRANtools package, an essential utility package integrated into base R. Specifically, the CRAN_package_db() function from the CRANtools package was utilized to extract comprehensive package information from the DESCRIPTION files, which serve as a metadata repository inherent to every R package (Gu & Hübschmann, 2022). According to Gu and Hübschmann (2022), the DESCRIPTION file contains crucial information regarding package dependencies, delineated within fields such as "Depends," "Imports," "LinkingTo," "Suggests," and "Enhances." These key elements include the package name, title, authors, package description, and various dependency specifications: • Package name • Title of the package • Authors • Description of a package • Imports: dependencies required for the package to work • Suggests: packages that are not required but can be used • Depends: packages or version of R that are required by the package installation process. • Date/publication: The date of publication of the package’s latest version. For the purposes of our research, we focused on dependencies crucial for the installation process, specifically examining the fields 'Imports' and 'Depends.' In this context, 'Imports' denotes dependencies necessary for proper package functionality, while 'Depends' historically indicated the version of R required by the package but has evolved to encompass dependencies on other packages, effectively making it equivalent to 'Imports' (Gu & Hübschmann, 2022). Additionally, our investigation considered other pertinent fields such as Authors, Maintainer, authors@R (contributors), Date/Publication. To ensure a thorough analysis of R package dependencies and metadata, the selection of fields was based on their significance and relevance to the current research questions. We went on to model the data into their respective nodes and relationships as defined below.
23 4. RESULTS AND DISCUSSION In this section, we discuss the evaluation methods used to validate and compare Cran2Graph against existing LLM models. The system specifications for the personal computer used in this study are detailed in Table 4. Table 4: System Specifications for Cran2graph Framework Implementation Specs Requirement Operating System Windows 11 Pro Processor Intel i7 2.60 GHz RAM 48GB Python 3.11 Neo4j Desktop Edition 15.1 4.1 ONE-HOP PROMPT QUESTION COMPARISON The primary objective of this evaluation was to assess the cran2graph framework's effectiveness in recommending packages, discovering relevant packages, and providing comprehensive context within the R package ecosystem compared to other LLM models. Our research focused on answering three specific research questions: 1. RQ1.1: How effective is cran2graph in providing accurate and contextually relevant information? 2. RQ1.2: How well does cran2graph perform in delivering high-quality package recommendations? 3. RQ1.3: What is the difference between cran2graph and other LLM models in providing up-to-date package information and recommendations? Experimental Setup. To address these questions, we developed a series of one-hop prompt questions with the assistance of R experts. These questions were then posed to both the cran2graph framework and the LLM-based model (specifically GPT, the most widely used at the time). Table 5 summarizes the benchmarking results between cran2graph and the GPT- based model.
24 Table 5: Benchmarking the performance between cran2graph and gpt-based model Result and Insight: The findings indicate that cran2graph consistently outperformed the GPT-based model in providing detailed and contextually relevant package recommendations. For instance, in recommending packages for biologist users, cran2graph listed packages such as BiodiversityR, BiocManager, Corbi, bionetdata, and fossil, which were highly relevant. In contrast, the GPT model's recommendations, while useful, lacked the same level of specificity and contextual accuracy. Figure 8 demonstrates an example where various LLMs, including ChatGPT, Gemini, and GPT-3.5, were given a user question about the number of packages maintained by Kirill Müller. While ChatGPT and Gemini struggled to provide precise responses, cran2graph delivered accurate and contextually relevant information, showcasing its strength in leveraging a knowledge graph to enhance response quality. Question Cran2Graph Model GPT-based Model Top 5 packages for biologist users Packages listed are BiodiversityR, BiocManager, Corbi, bionetdata, and fossil Listed Bioconductor, dplyr, ggplot2, edgeR, and phyloseq Packages to implement difference in difference estimator method Packages listed are estimatr, DiDforBigData, multid,gaussDiff and their maintainers Some of the packages listed are Did, fixest, panelView, plm, AER, car, bife Packages for credit analysis and modelling Packages listed are creditmodel, AFR, GCPM and their maintainers. Packages listed include creditmodel, scorecard, woeBinning, rpart, randomForest Packages for financial modelling Packages listed are Fincal, portfolio.optimization, FRAPO, FinAna, FinancialMath alongside their contributors and maintainer Packages listed include quantmod, performanceAnalytics, TTR, zoo, timeSeries What are some packages for geospatial analysis Packages listed are GEOmap, geodata, geoR, gecko, geoAr their contributors and maintainers Packages listed include sf, sp, raster, terra, rgdal, maptools, leaflet, tmap What packages are like sf Some of the packages listed include mapsf, geospark Packages listed include sp, raster, terra, rgdal, maptools, leaflet, tmap What package has the most contributions The package with the most contribution is mlpack "React" has one of the most contributions in the open source package ecosystem. Who is contributing to the most to packages? Hadley Wickham is contributing the most to packages. Various developers and organizations contribute to the open-source package ecosystem.
25 Figure 8: Example: User questions and response from various LLM Discussion: The comparative analysis highlights cran2graph's superiority in delivering precise and contextually relevant information. This advantage is attributed to the integration of a knowledge graph, which enriches the model's ability to understand and provide more accurate recommendations within the R ecosystem. The results support the potential of combining LLMs with knowledge graphs to create more effective and reliable tools for the R programming community. However, the performance of cran2graph is inherently dependent on the completeness and accuracy of the underlying knowledge graph. Any gaps or inaccuracies in the data can affect the quality of recommendations and responses. As the number of packages and contributors in the R ecosystem grows, maintaining and updating the knowledge graph to ensure it remains current can be challenging and resource intensive. While cran2graph performed well in specific scenarios, its ability to understand and generate contextually relevant responses may still be limited by the scope and detail of the knowledge graph compared to more general LLMs that leverage vast and diverse datasets. Additionally, the comparison with the GPT-based model was limited to a specific set of questions and may not fully capture the broader capabilities or limitations of either model in diverse real-world applications.
26 4.2 USER INTERVIEW IN MODEL COMPARISON To evaluate the cran2graph framework's usability and effectiveness from the perspective of expert users, we conducted interviews with three R experts. Our focus was on understanding the tool's perception, usability, and practical relevance in aiding users to discover relevant packages and information. Research Questions: 1. RQ2.1: Does the cran2graph model provide better visibility about contributors to R packages? 2. RQ2.2: Does cran2graph recommend necessary packages based on specific topics of interest? 3. RQ2.3: Does cran2graph provide information on both trending and lesser-known packages, allowing users to explore a broader range of tools? Experimental Setup: The experts were introduced to the cran2graph tool and were then asked to pose questions they wanted the model to answer. After observing the tool in action, they provided feedback on its usability and relevance. Tables 6 and 7 summarize the experts' perceptions and satisfaction levels. Table 6: Perception about cran2graph asked to the expert Table 7: List of Satisfactory Questions asked to the experts Group Question Scale Usefulness Using this tool will enable me discover packages that I didn’t know exist. 1 – strongly disagree, 7 – strongly agree Using this tool will reduce the time I spent on searching for packages. 1 – strongly disagree, 7 – strongly agree Group Question Scale Research Question Perception How easy was it to discover package a topic? 1 – very difficult, 7- very easy RQ2.2 How much effort was required to answer question about package authors and contributors? 1 – almost no effort, 7 - extreme effort RQ2.1 Was it easy to discover latest package 1 – Yes, 2 - No RQ2.3
27 Results and Insights: Following the completion of interviews with R experts, presented below is a summary of their responses, enriching our comprehension of the tool's usefulness and their perceptions, across various groups of questions. • Person A, an R expert, praised the tool's ability to stay updated with the latest trends and releases, noting its practicality in searching for topics and methods. She found the tool's responses to her queries about packages for the difference-in-difference estimator method and recommendations for biologist users highly relevant and informative. • Person B found the tool straightforward and effective for understanding the R community. He highlighted its clarity and utility, particularly in identifying suitable packages for financial modeling, which underscores the tool's accessibility and potential for broader adoption. • Person C appreciated the tool's potential to significantly reduce the time spent searching for packages. He noted its capability to streamline the package discovery process, making it easier to find packages for specific use cases and domains. His feedback aligns with our observation that cran2graph effectively saves users time and effort. Discussion: The user interviews reveal that cran2graph is highly effective in providing relevant and timely information to expert users. The positive feedback from the experts indicates that the integration of a knowledge graph with LLMs significantly enhances the tool's usability and practical utility. The framework's ability to provide comprehensive and contextually relevant information not only improves the user experience but also has the potential to foster wider adoption among R programming community members. This study reinforces the value of combining LLMs with knowledge graphs to create robust and userfriendly tools for data scientists and researchers. However, the user interviews were conducted with a limited number of experts, which may not provide a comprehensive representation of the broader R programming community's perspectives and experiences. The experts selected for the interviews might have inherent biases based on their specific expertise and familiarity with R, which could influence their feedback and the perceived effectiveness of the tool. The study focused primarily on expert users, and the usability and effectiveness of cran2graph for novice or intermediate users in the R community remain unexplored and could vary significantly. Additionally, the study provides a snapshot of user experiences and satisfaction but does not account for long-term usage patterns and evolving user needs. Continuous evaluation and iterative improvements are necessary to ensure sustained effectiveness and user satisfaction.
28 5. CONCLUSIONS AND FUTURE WORKS This study presents the development and implementation of the Cran2Graph framework, a system that integrates large language models (LLMs) and knowledge graphs (KGs) to enhance the Comprehensive R Archive Network (CRAN) ecosystem. The primary objective was to create a system capable of accurately answering user questions about R packages and providing context-aware recommendations, thereby facilitating better decisionmaking for developers and users within the CRAN ecosystem. Through extensive theoretical and practical exploration, this research demonstrated the successful integration of LLMs and KGs. We leveraged graph data modeling to establish relationships between authors, packages, and other contributory elements, offering novel insights into the CRAN community. This approach provided a detailed understanding of who contributes to and maintains packages, as well as the intricate dependencies between them. The knowledge graph architecture enabled effective semantic retrieval and context-aware response generation, allowing for more accurate and meaningful interactions within the CRAN ecosystem. The evaluation of Cran2Graph highlighted its performance over generic GPT-based models, particularly in providing contextually relevant responses about the CRAN ecosystem. Interviews with R experts confirmed the practical value of this framework, indicating its potential to keep users informed about the latest package developments and assist in identifying suitable packages for specific tasks. Our findings underscore the importance of combining explicit knowledge from KGs with the implicit understanding of LLMs. This synergy not only improves the accuracy and relevance of responses but also enhances the overall user experience within the CRAN ecosystem. The success of Cran2Graph in addressing the complexities of open-source package management and providing context-aware recommendations demonstrates the potential for similar applications in other open-source ecosystems. Future research could extend the Cran2Graph framework to other package management systems such as PyPI, npm, and Cargo. Applying the same principles could improve context-aware information retrieval and recommendation systems across various ecosystems. Additionally, further network analyses, including connectedness and Software Bill of Materials (SBOM) analysis, could provide deeper insights into these ecosystems' relationships and dependencies, enhancing the overall understanding and management of open-source projects. Expanding the user base to include novice and intermediate R users could provide a more comprehensive understanding of the tool’s usability and effectiveness across different expertise levels.
29 6. BIBLIOGRAPHICAL REFERENCES Barrasa, J., Hodler, E., & Webber, J. (2021, July 26). Knowledge Graphs. O'Reilly Media, Inc. https://www.oreilly.com/library/view/knowledge-graphs/9781098104863/ Barrasa, J., & Webber, J. (2023, June 22). Building Knowledge Graphs. O'Reilly Media, Inc. http://books.google.ie/books?id=6sTGEAAAQBAJ&printsec=frontcover&dq=Knowledge+gra phs+applied&hl=&cd=6&source=gbs_api Bommarito, E., & Bommarito, M. J., II. (2021). An empirical analysis of the R package ecosystem. arXiv e-prints. https://doi.org/10.48550/arXiv.2102.09904 Brown, T. B., Mann, B., Ryder, N., Subbiah, M., Kaplan, J., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., Askell, A., Agarwal, S., Herbert-Voss, A., Krueger, G., Henighan, T., Child, R., Ramesh, A., Ziegler, D. M., Wu, J., Winter, C., Hesse, C., Chen, M., Sigler, E., Litwin, M., Gray, S., Chess, B., Clark, J., Berner, C., McCandlish, S., Radford, A., Sutskever, I., & Amodei, D. (2020). Language models are few-shot learners. arXiv e-prints. https://doi.org/10.48550/arXiv.2005.14165 Celebi, R., Uyar, H., Yasar, E., Gumus, O., Dikenelli, O., & Dumontier, M. (2019). Evaluation of knowledge graph embedding approaches for drug-drug interaction prediction in realistic settings. BMC bioinformatics, 20(1), 726. https://doi.org/10.1186/s12859-019-3284-5 Chen, Y., Subburathinam, A., Chen, C.-H., & Zaki, M. J. (2021). Personalized food recommendation as constrained question answering over a large-scale food knowledge graph. In Proceedings of the 14th ACM International Conference on Web Search and Data Mining (WSDM '21) (pp. 544–552). Association for Computing Machinery. https://doi.org/10.1145/3437963.3441816 Decan, A., Mens, T., & Grosjean, P. (2017). An empirical comparison of dependency network evolution in seven software packaging ecosystems. arXiv e-prints. https://doi.org/10.48550/arXiv.1710.04936 Eghbal, N. (2020, July 14). Working in Public. http://books.google.ie/books?id=EKeUzQEACAAJ&dq=working+in+public&hl=&cd=1&source =gbs_api Fang, Y., Deng, J., Zhang, F., & Wang, H. (2023, January 7). An Intelligent Question-Answering Model over Educational Knowledge Graph for Sustainable Urban Living. Sustainability, 15(2), 1139. https://doi.org/10.3390/su15021139 Feng, S., Balachandran, V., Bai, Y., & Tsvetkov, Y. (2023). FactKB: Generalizable factuality evaluation using language models enhanced with factual knowledge. arXiv e-prints. https://doi.org/10.48550/arXiv.2305.08281 Feng, Y., Chen, X., Lin, B. Y., Wang, P., Yan, J., & Ren, X. (2020). Scalable multi-hop relational reasoning for knowledge-aware question answering. In B. Webber, T. Cohn, Y. He, & Y. Liu
30 (Eds.), Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP) (pp. 1295–1309). Association for Computational Linguistics. https://doi.org/10.18653/v1/2020.emnlp-main.99 Gao, Y., Xiong, Y., Gao, X., Jia, K., Pan, J., Bi, Y., Dai, Y., Sun, J., Wang, M., & Wang, H. (2023). Retrieval-Augmented Generation for Large Language Models: A Survey. arXiv e-prints. https://doi.org/10.48550/arXiv.2312.10997 Goel, A. (2015, May 28). Neo4j Cookbook. Packt Publishing Ltd. http://books.google.ie/books?id=WSmzCQAAQBAJ&printsec=frontcover&dq=neo4j&hl=&cd =8&source=gbs_api Gosnell, D., & Broecheler, M. (2020, March 20). The Practitioner’s Guide to Graph Data. O'Reilly Media, Inc. http://books.google.ie/books?id=n6nYDwAAQBAJ&printsec=frontcover&dq=The+Practitione r%E2%80%99s+Guide+to+Graph+Data&hl=&cd=1&source=gbs_api Gong, F., Wang, M., Wang, H., Wang, S., & Liu, M. (2021, February). SMR: Medical Knowledge Graph Embedding for Safe Medicine Recommendation. Big Data Research, 23, 100174. https://doi.org/10.1016/j.bdr.2020.100174 Gu, Z., & Hübschmann, D. (2022). Pkgndep: A tool for analyzing dependency heaviness of R packages. Bioinformatics, 38(17), 4248–4251. https://doi.org/10.1093/bioinformatics/btac449 Gu, Z. (2023). On the dependency heaviness of CRAN/Bioconductor ecosystem. Journal of Systems and Software, 198, 111610. https://doi.org/10.1016/j.jss.2023.111610 Grad-Gyenge, L., Filzmoser, P., & Werthner, H. (2015, May). Recommendations on a knowledge graph. In 1st International Workshop on Machine Learning Methods for Recommender Systems, MLRec (pp. 13-20). http://hdl.handle.net/20.500.12708/56430 Haussmann, S., Seneviratne, O. W., Chen, Y., Ne'eman, Y., Codella, J., Chen, C.-H., McGuinness, D. L., & Zaki, M. J. (2019). FoodKG: A semantics-driven knowledge graph for food recommendation. In Proceedings of the International Workshop on the Semantic Web. https://api.semanticscholar.org/CorpusID:203635815 Hettige, B., Li, Y.-F., Wang, W., Le, S., & Buntine, W. (2019). MedGraph: Structural and temporal representation learning of electronic medical records. arXiv e-prints. https://doi.org/10.48550/arXiv.1912.03703 Huang, W., Lapata, M., Vougiouklis, P., Papasarantopoulos, N., & Pan, J. (2023). Retrieval augmented generation with rich answer encoding. In J. C. Park, Y. Arase, B. Hu, W. Lu, D. Wijaya, A. A. Purwarianti, & A. A. Krisnadhi (Eds.), Proceedings of the 13th International Joint Conference on Natural Language Processing and the 3rd Conference of the Asia-Pacific Chapter of the Association for Computational Linguistics (Volume 1: Long Papers) (pp. 1012-
31 1025). Association for Computational Linguistics. https://aclanthology.org/2023.ijcnlpmain.65 Izacard, G., Lewis, P., Lomeli, M., Hosseini, L., Petroni, F., Schick, T., Dwivedi-Yu, J., Joulin, A., Riedel, S., & Grave, E. (2022). Atlas: Few-shot learning with retrieval augmented language models. arXiv e-prints. https://doi.org/10.48550/arXiv.2208.03299 Jeong, C. (2023). A Study on the Implementation of Generative AI Services Using an Enterprise Data-Based LLM Application Architecture. Advances in Artificial Intelligence and Machine Learning, 03(04), 1588–1618. https://doi.org/10.54364/aaiml.2023.1191 Ji, Z., Lee, N., Frieske, R., Yu, T., Su, D., Xu, Y., Ishii, E., Bang, Y., Chen, D., Dai, W., Shu Chan, H., Madotto, A., & Fung, P. (2022). Survey of hallucination in natural language generation. arXiv e-prints. https://doi.org/10.48550/arXiv.2202.03629 Jin, Y., Bai, Y., Zhu, Y., Sun, Y., & Wang, W. (2022). Code Recommendation for Open Source Software Developers. arXiv e-prints. https://doi.org/10.48550/arXiv.2210.08332 Ke, P., Ji, H., Ran, Y., Cui, X., Wang, L., Song, L., Zhu, X., & Huang, M. (2021). JointGT: Graphtext joint representation learning for text generation from knowledge graphs. arXiv e-prints. https://doi.org/10.48550/arXiv.2106.10502 Kejriwal, M. (2019, March 4). Domain-Specific Knowledge Graph Construction. Springer. http://books.google.ie/books?id=lKOLDwAAQBAJ&printsec=frontcover&dq=Knowledge+gra ph+applied&hl=&cd=10&source=gbs_api Kumar, A., Pandey, A., Gadia, R., & Mishra, M. (2020, October 2). Building Knowledge Graph using Pre-trained Language Model for Learning Entity-aware Relationships. 2020 IEEE International Conference on Computing, Power and Communication Technologies (GUCON). https://doi.org/10.1109/gucon48875.2020.9231227 Lewis, P., Perez, E., Piktus, A., Petroni, F., Karpukhin, V., Goyal, N., Küttler, H., Lewis, M., Yih, W.-t., Rocktäschel, T., Riedel, S., & Kiela, D. (2020). Retrieval-augmented generation for knowledge-intensive NLP tasks. In Proceedings of the 34th International Conference on Neural Information Processing Systems (NeurIPS 2020) (Art. 793). Curran Associates, Inc. https://doi.org/10.5555/3495724.3496517 Liu, J., Liu, C., Zhou, P., Lv, R., Zhou, K., & Zhang, Y. (2023). Is ChatGPT a good recommender? A preliminary study. arXiv e-prints. https://doi.org/10.48550/arXiv.2304.10149 Lv, S., Guo, D., Xu, J., Tang, D., Duan, N., Gong, M., & Zhang, H. (2019). Graph-based reasoning over heterogeneous external knowledge for commonsense question answering. arXiv. http://arxiv.org/abs/1909.05311 Maynez, J., Narayan, S., Bohnet, B., & McDonald, R. (2020). On faithfulness and factuality in abstractive summarization. arXiv e-prints. https://doi.org/10.48550/arXiv.2005.00661
32 Morris, J. H., Soman, K., Akbas, R. E., Zhou, X., Smith, B., Meng, E. C., Huang, C. C., Cerono, G., Schenk, G., Rizk-Jackson, A., Harroud, A., Sanders, L., Costes, S. V., Bharat, K., Chakraborty, A., Pico, A. R., Mardirossian, T., Keiser, M., Tang, A., Hardi, J., … Baranzini, S. E. (2023). The scalable precision medicine open knowledge engine (SPOKE): A massive knowledge graph of biomedical information. Bioinformatics (Oxford, England), 39(2), btad080. https://doi.org/10.1093/bioinformatics/btad080 Negro, G., Kus, M., Futia, G., & Montagna, S. (2022, June). Knowledge Graphs Applied (2nd ed.). Manning Publications Co. https://www.manning.com/books/knowledge-graphs-applied Pan, S., Luo, L., Wang, Y., Chen, C., Wang, J., & Wu, X. (2024). Unifying Large Language Models and Knowledge Graphs: A Roadmap. IEEE Transactions on Knowledge and Data Engineering, 1–20. https://doi.org/10.1109/tkde.2024.3352100 Raunak, V., Menezes, A., & Junczys-Dowmunt, M. (2021). The curious case of hallucinations in neural machine translation. arXiv e-prints. https://doi.org/10.48550/arXiv.2104.06683 Scifo, E. (2023, January 31). Graph Data Science with Neo4j. Packt Publishing Ltd. http://books.google.ie/books?id=bBOrEAAAQBAJ&printsec=frontcover&dq=graph+data+scie nce+with+neo4j&hl=&cd=2&source=gbs_api Shanahan, M. (2022). Talking about large language models. arXiv e-prints. https://doi.org/10.48550/arXiv.2212.03551 Soman, K., Rose, P. W., Morris, J. H., E Akbas, R., Smith, B., Peetoom, B., Villouta-Reyes, C., Cerono, G., Shi, Y., Rizk-Jackson, A., Israni, S., Nelson, C. A., Huang, S., & E Baranzini, S. (2023). Biomedical knowledge graph-optimized prompt generation for large language models. arXiv e-prints. https://doi.org/10.48550/arXiv.2311.17330 Sun, Y., Wang, S., Feng, S., Ding, S., Pang, C., Shang, J., Liu, J., Chen, X., Zhao, Y., Lu, Y., Liu, W., Wu, Z., Gong, W., Liang, J., Shang, Z., Sun, P., Liu, W., Ouyang, X., Yu, D., Tian, H., Wu, H., & Wang, H. (2021). ERNIE 3.0: Large-scale knowledge enhanced pre-training for language understanding and generation. arXiv e-prints. https://doi.org/10.48550/arXiv.2107.02137 Tao, L., Cazan, A.-P., Ibraimoski, S., & Moran, S. J. (2022). Code Librarian: A Software Package Recommendation System. 2023 IEEE/ACM 45th International Conference on Software Engineering: Software Engineering in Practice (ICSE-SEIP), 196-198. https://api.semanticscholar.org/CorpusID:252815407 Thoppilan, R., De Freitas, D., Hall, J., Shazeer, N., Kulshreshtha, A., Cheng, H.-T., Jin, A., Bos, T., Baker, L., Du, Y., Li, Y., Lee, H., Zheng, H. S., Ghafouri, A., Menegali, M., Huang, Y., Krikun, M., Lepikhin, D., Qin, J., Chen, D., Xu, Y., Chen, Z., Roberts, A., Bosma, M., Zhao, V., Zhou, Y., Chang, C.-C., Krivokon, I., Rusch, W., Pickett, M., Srinivasan, P., Man, L., Meier-Hellstern, K., Ringel Morris, M., Doshi, T., Delos Santos, R., Duke, T., Soraker, J., Zevenbergen, B., Prabhakaran, V., Diaz, M., Hutchinson, B., Olson, K., Molina, A., Hoffman-John, E., Lee, J., Aroyo, L., Rajakumar, R., Butryna, A., Lamm, M., Kuzmina, V., Fenton, J., Cohen, A., Bernstein, R., Kurzweil, R.,
39 ● Recommendations obtained through vector similarity search, identify packages with similar functionalities or dependencies. Response Generation: ● The LLM synthesises the provided context and recommendations to generate a response. ● Example Response: "Based on your query, the 'ggplot2' package is widely regarded as a robust solution for data visualisation in R. Its intuitive syntax and versatile plotting capabilities make it a popular choice among data scientists and analysts Fig: Response generated by LLM 4.2.6 Summary of the Implementation cases and expected effects Chapter 4.2.6 provides a comprehensive overview of the implementation process of integrating the LLM into the CRAN ecosystem. Through the utilisation of various tools and technologies, including R, Python, LangChain, the OpenAI API, and the Neo4j graph database, the chapter illustrates the seamless integration of LLM into the KG-RAG framework. Concrete examples are provided at each stage of the procedure to highlight the integration process effectively. The selection of the knowledge graph, particularly Neo4j, is emphasised as a critical aspect of the implementation process. Neo4j was chosen based on its suitability for the scenarios presented in the chapter. However, it is noted that different graph databases offer
40 distinct features, performance attributes, and scalability, necessitating thorough evaluation to ensure compatibility with specific scenarios. Factors such as ease of specifying desired information and the LLM's capability to generate efficient Cypher queries also influence the selection of a graph database. Furthermore, the chapter underscores the importance of conducting rigorous testing to validate LLM responses against predetermined limits and business requirements. This testing process may involve refining input source data, adjusting model parameters, or enhancing system prompts to improve response accuracy. Continuous evaluation and refinement are crucial for maintaining the efficiency, reliability, and user satisfaction of the integrated system Qualitative Interview Carolina (Person A) The main utility of our tool is to search for specific topics and provide a comprehensive list of relevant information. • Carolina was impressed with our ability to stay updated with the latest trends and releases, given the constant influx of new packages. Impressions: • Carolina found the tool to be practical and prompt, especially for searching topics and methods efficiently. Questions Asked: • Which package can be used to implement the difference-in-difference estimator method? • What are the top 10 packages recommended for biologist users? Simioluwa (Person B) The main utility of our tool is to search for specific topics and provide a comprehensive list of relevant information. Impressions: • Simioluwa: found the tool to be straightforward and very impressive, especially for understanding the R community better.
41 Questions Asked: • What package is suitable for financial modeling? Joseph (Person C) The main utility of our tool is to search for specific topics and provide a comprehensive list of relevant information. Impressions: • Folajimi: Thinks this tool can reduce one time spent on googling and searching for packages. Questions asked: • Package use for database connectivity and fetching data?