Tag Archives: #machinelearning

What’s Cooking in the AI Test Kitchen – RAG

Cooking is one of my favorite hobbies, so I took the opportunity to combine my interest in technology and cooking to discuss this innovative chapter on Generative AI, RAG. First, let’s get the basics out of the way.

What is Generative AI? How is it different from the AI?

Artificial Intelligence (AI)

AI refers to computer systems performing tasks that typically require intelligence. It includes machine learning (ML) and deep learning (DL) methods. AI systems learn from data, identify patterns, and make decisions autonomously. Examples of AI applications include speech recognition and self-driving cars. While AI can simulate thinking processes, it does not have human consciousness.

Generative AI

Generative AI is a subset of AI that focuses on generating content. In contrast to AI, which leads by rules, generative AI employs self-learning models to produce innovative outputs. Examples of AI encompass text generation models like GPT 4 and image creation models like DALL E. This branch of AI merges creativity with innovation, empowering machines to create art, music, and literature. Nonetheless, it encounters challenges related to considerations, bias mitigation, and control over the generated content.

Generally speaking, AI techniques encompass applications, while generative AI stands out for its emphasis on creativity and original content creation. 

Now, back to our test kitchen. Let’s put on our virtual aprons to travel on a flavor-filled journey to understand how RAG (Retrieval-Augmented Generation) works in the realm of Generative AI. Imagine we’re in a busy kitchen, aprons on, ready to cook some insights. Let’s use a basic roasted chicken recipe for this analogy.

The Recipe

Ingredients:

  • Chicken is our base ingredient, representing the raw text or prompt. I recommend cleaned chicken (unbiased).
  • Seasonings: These are the retrieval documents, like a well-stocked spice rack. Each seasoning (document) adds depth and context to our chicken (prompt).

Preparation:

  • Marinating the Chicken: We start by marinating our chicken with the prompt. This is where RAG comes into play. It retrieves relevant documents (seasonings) from its vast knowledge base (like a library pantry).
  • Selecting the Right Spices: RAG carefully selects the most relevant documents (spices) based on the prompt. These could be scientific papers, blog posts, or historical texts. This is my favorite part.

Cooking Process:

  • Simmering and flavor injecting: Just as we simmer our chicken with spices, RAG injects the prompt with context from the retrieved documents. It absorbs the flavors of knowledge, understanding nuances, and connections.
  • Balancing Flavors: RAG balances the richness of retrieved information. Too much spice (document) overwhelms the dish (response), while too little leaves it bland.

Generative Magic:

  • The Cooking Alchemy: Now, the magic happens. RAG combines the marinated prompt with the seasoned context. It’s like a chef creating a new recipe, drawing inspiration from old cookbooks of classic dishes.
  • Creating the Dish: RAG generates an informed and creative response. It’s not just recycling facts; it’s crafting a unique flavor profile.

Serving the Dish:

  • Plating and Garnishing: Our dish is ready! RAG delivers a rich, layered, and tailored response to the prompt—like presenting a beautifully plated meal.
  • Bon Appétit!: The user enjoys the response, savoring the blend of retrieval and generation. Just as a well-seasoned chicken satisfies the palate, RAG satisfies the hunger for knowledge and creativity.

RAG reminds me of a beautiful meal that can satisfy the desires of the most discerning taste. A traveled chef who searches for the best ingredients from around the globe and retrieves them to generate tasteful dishes. So, next time you encounter RAG, think of yourself as a chef creating delightful technology-based feasts.

A curated list of retrieval-augmented generation (RAG) in large language models.

Roasted Garlic Chicken

Rest and Repeat AI for 2024

The winter season brings a sense of slowing down, if only for a moment. However, this doesn’t apply to AI. AI continues to captivate us with its capabilities and the potential for collaboration. With each innovation, I’ve contemplated the challenges and opportunities it presents to humans. After researching, I’ve gathered a few highlights from 2023 that are still relevant today.

Open-source AI development reshaped the landscape of AI frameworks and models. The introduction of PyTorch 2.0 did not establish an industry standard. Also equipped researchers and developers with powerful tools. Ongoing enhancements to Nvidias Modulus and Colossal AIs’ PyTorch-based framework have further enriched the open-source ecosystem, fostering innovation.

AI models have revolutionized content generation. Redefined natural language processing as we know it. OpenAIs GPT 4 a language model at the forefront of this transformation has pushed the boundaries of AI capabilities. GPT 4 showcases its proficiency in text-based writing, coding, and complex problem-solving applications. Additionally, Jina AI’s 8K Text Embedding Model and Mistral AI’s Mistral 7B exemplify the growing expertise within the AI community regarding handling amounts of data.

There is a trend towards increased collaboration between AI systems and humans to achieve desired outcomes. This highlights the importance of utilizing AI to enhance capabilities and improve efficiency and effectiveness.

AI has made progress by introducing code-based and no-code solutions. These advancements have made AI more accessible to individuals without expertise, promoting inclusivity and diversity within the AI community. There is still work to be done in this space.

Cybersecurity solutions leveraging AI technology have been developed to address the growing threat of cyberattacks. These solutions provide defense mechanisms against evolving cyber threats, bolstering security measures. This topic is on my shortlist. Stay tuned.

Digital twinning has become a tool for simulating real-world situations and improving processes. It allows businesses and industries to create replicas that assist decision-making and boost efficiency. This technology leverages machine learning algorithms to analyze sensor data and identify patterns. Through artificial intelligence and machine learning (AI/ML), organizations gain insights to enhance performance, streamline maintenance operations, measure emissions, and improve efficiency.

AI-driven personalization has gained traction across domains. Systems can now tailor products and services to users, offering a customized experience that aligns with their preferences. Customizations are always a plus in my book. This personalized approach has significantly improved user experiences in e-commerce and entertainment domains.
The use of AI in voice technology has constantly changed, leading to the development of voice assistants. This advancement has improved voice recognition, language comprehension, and interaction between users and AI-driven voice systems. I have taken advantage of this by scripting my presentation when I lost my voice and had it delivered through AI.

AI has also made progress within the healthcare industry. It is now utilized for disease diagnosis and treatment development. Integrating AI into healthcare showcases its potential to transform care and medical research. The bias in medical data is a real concern, so how this data is used may put certain communities at risk. This is a space I am following very closely.

AI continues to challenge the boundaries of creatives, but the community is strong. It will be interesting to see how AI will begin acknowledging and accepting that creatives are here to stay. Creatives are also acknowledging the same for AI.

In the coming years, expect a rise in similar services and products. Instead of viewing this repetition as a drawback, it should be embraced as an advantage. The increasing array of AI options indicates a dynamic ecosystem that provides opportunities and choices for developers, businesses, and users. This wealth of options fosters competition fuel innovation and empowers individuals to customize AI solutions according to their requirements. As the AI landscape continues to evolve, the presence of repeated services and products validates the growth of this field. It offers us endless possibilities that contribute significantly to the evolution and accessibility of artificial intelligence.

I appreciate you reading my blog and look forward to sharing more in this space.

PyGraft – A Python-Based AI Tool for Generating Knowledge Graphs

Visualization

Telling a story with data is an effective way to share information. I’ve spent years developing data stories with standard reporting tools as the only option. Visualizing information has become incredibly important today, especially when representing and analyzing relationships between entities and concepts. Knowledge graphs (KGs) capture these relationships through triples (s, p, o) where s represents the subject, ‘o’ represents the object, and ‘p’ defines their relationship. KGs are often accompanied by schemas or ontologies defining the data’s structure and meaning. They have proven valuable in recommendation systems and natural language understanding.

Challenges Associated with Mainstream KGs

While knowledge graphs are tools, there are limitations when relying solely on mainstream knowledge graphs for evaluating AI models. These mainstream KGs often share properties that can lead to evaluations, particularly in tasks like node categorization. Additionally, some datasets used for link prediction may contain biases and inference patterns that can result in assessments of models.

Furthermore, in fields like education, law enforcement, and healthcare, where data privacy is a concern, publicly accessible knowledge graphs are not always readily available. Researchers and practitioners in these domains often have requirements for their knowledge graphs. It is crucial to create graphs replicating real-world graphs’ characteristics.
To tackle these challenges, a group of researchers from Université de Lorraine and Université Côte d’Azur has developed PyGraft, a Python-based AI tool that’s the source. PyGraft aims to generate customized schemas and knowledge graphs that apply to domains.

Contributions to this space:

  • Pipeline for Knowledge Graph Generation;
    PyGraft introduces a pipeline for generating schemas and knowledge graphs, allowing researchers and practitioners to customize the generated resources according to their requirements. This ensures flexibility and adaptability.
  • Domain Neutral Resources;
    One remarkable feature of PyGraft is its ability to create domain schemas and knowledge graphs. This means the generated resources can be used for benchmarking and experimentation across fields and applications. It eliminates the necessity for domain KGs, making it an invaluable tool for domain research.
  • Expanded Range of RDFS and OWL Elements;
    PyGraft uses RDF Schema (RDFS) and Web Ontology Language (OWL) elements to construct knowledge graphs with semantics. This technology allows resource descriptions while adhering to accepted standards of the Semantic Web.
  • Ensuring Logical Coherence through DL Reasoning;
  • The tool uses a reasoning system based on Description Logic (DL) to ensure that the resulting schemas and knowledge graphs are coherent. This process guarantees that the generated knowledge graphs follow the principles of ontology.

Accessibility in a Tool

PyGraft is an open-source project with available code and documentation. It also includes examples to make it user-friendly for beginners and experienced users.

PyGraft is a Python library that researchers and practitioners can use to generate schemas and knowledge graphs (KGs) according to their requirements. It enables the creation of schemas and KGs, on demand with knowledge of the desired specifications. The resources generated are not tied to any application field, making PyGraft a valuable tool for data-limited research domains.

Features:

  • It can generate schemas, knowledge graphs, or both.
  • The generation process is highly customizable through user-defined parameters.
  • Schemas and KGs are constructed using a range of RDFS and OWL constructs.
  • Logical consistency is guaranteed by employing a DL reasoner called HermiT.
  • A generator of synthesizing both schemas and knowledge graphs using a single pipeline.
  • Creates generated schemas and KGs(Knowledge Graphs) with a set of RDFS(Resource Description Framework Schema) and OWL (W3C Web Ontology Language) constructs, ensuring compliance with used Semantic Web standards.


PyGraft is an advancement in the field of knowledge graph generation. It overcomes the limitations of mainstream KGs by offering a customizable solution for researchers, practitioners, and engineers.

PyGraft enables users to create KGs that accurately reflect real-world data by adopting a domain approach and adhering to Semantic Web standards.

Pygraft bridges the gap between data privacy and the need for high-quality knowledge graphs.

The beauty of this open-source tool, is that it encourages collaboration and innovation within the AI and Semantic Web communities, opening up possibilities for knowledge representation and reasoning. This type of technical collaboration is priceless.

Resources:

https://pygraft.readthedocs.io/en/latest/

https://github.com/nicolas-hbt/pygraft

The Engineering Mechanics of AI

A new hobby I discovered last year is traditional tabletop puzzles. Building puzzles is a form of Engineering. To illustrate, prompting could be like looking for a puzzle piece. The LLM is trained to search the box for the right puzzle and piece. Let’s shake the box to see what pieces make up an LLM.

What’s in the Box

LLMs, or Large Language Models, are advanced machine learning constructs proficient in handling massive volumes of textual data and producing precise outcomes. Constructed through intricate algorithms, they dissect and comprehend data patterns at the granular level of individual words. This empowers LLMs to grasp the subtleties inherent to human language and its contextual usage. Their virtually boundless capacity to process and create text has fueled their rising prominence across diverse applications, ranging from language translation and chatbots to text categorization.

At their core, Large Language Models (LLMs) serve as fundamental frameworks leveraging deep learning for tasks in natural language processing (NLP) and natural language generation (NLG). These models are engineered to master the intricacies and interconnections of language by undergoing pre-training on extensive datasets. This preliminary training phase facilitates subsequent fine-tuning of models for specific tasks and applications.

LLM Edge Pieces

In a puzzle, the edge pieces are the ones that frame the entire puzzle and give it its shape. Plainly stated, the edges are the most essential pieces of the puzzle. Let’s consider these vital pieces that give LLM its shape and meaning:

Automation and Productivity

Armed with the ability to process large volumes of data, LLMs have become instrumental in automating tasks that once demanded extensive human intervention. Sentiment analysis, customer service interactions, content generation, and even fraud detection are some of the processes that AI has transformed. By assuming these responsibilities, LLMs save time and free up valuable human resources to focus on more strategic and creative endeavors.

Personalization and Customer Satisfaction

The integration of LLMs into chatbots and virtual assistants has resulted in round-the-clock service availability, catering to customers’ needs and preferences at any time. These language models decode intricate patterns in customer behavior by analyzing vast amounts of data. Consequently, businesses can tailor their services and offerings to match individual preferences, increasing customer satisfaction and loyalty.

Enhancing Accuracy and Insights

Meaningful data through insights is an essential attribute of AI. Their capacity to extract patterns and relationships from extensive datasets refines the quality of outputs. These models have demonstrated their abilities to enhance accuracy across various applications, including sentiment analysis, data grouping, and predictive modeling. Their adeptness at extracting intricate patterns and relationships from extensive datasets directly influences the quality of outputs, leading to more informed decision-making.

Language Models Architecture

Autoregressive Language Models

These models predict the next word in a sequence based on preceding words. They have been instrumental in various natural language processing tasks, particularly those requiring sequential context.

Autoencoding Language Models

Autoencoders, conversely, reconstruct input text from corrupted versions, resulting in valuable vector representations. These representations capture semantic meanings and can be used in various downstream tasks.

Hybrid Models

The hybrid models combine the strengths of both autoregressive and autoencoding models. By fusing their capabilities, these models tackle tasks like text classification, summarization, and translation with remarkable precision.

Text Processing

Tokenization

Tokenization fragments text into meaningful tokens, aiding processing. It boosts efficiency, widens vocabulary coverage, and enhances model understanding. This technique increases efficiency and widens the vocabulary coverage, allowing models to understand complex languages better.

Embedding

Embeddings map words to vectors, capturing their semantic essence. These vector representations form the foundation for various downstream tasks, including sentiment analysis and machine translation.

Attention Mechanisms

Attention mechanisms allow models to focus on pertinent information. The mechanisms enable models to focus on relevant information, mimicking human attention processes and significantly enhancing their ability to extract context from sequences.

Pre-training and Transfer Learning

In the pre-training phase, models are exposed to vast amounts of text data, acquiring fundamental language understanding. This foundation is then transferred to the second phase, where transfer learning adapts the pre-trained model to specialized tasks, leveraging the wealth of prior knowledge amassed during pre-training.

The Untraditional Puzzle

Large Language Models (LLM) have demonstrated their effectiveness in enhancing accuracy across various applications, including sentiment analysis, data grouping, and predictive modeling. Their adeptness at extracting intricate patterns and relationships from extensive datasets directly influences the quality of outputs, leading to more informed decision-making.

LLMs are like a giant puzzle with all the pieces coming together to build the model. The difference between LLMs and the traditional puzzle is that a traditional puzzle stops growing once all the pieces are in place. Unlike a traditional puzzle, technological innovations and data gathering will enable the LLM model to continue learning and growing.

Reasoning via Planning (RAP) the LLM Reasoners

In my research, I have discovered a variety of LLMs. I am always fascinated by the complexity and capabilities of these models. I follow several startups, founders, researchers, and data scientists in this growing space.

The role of research in AI is critical as they drive the progress and understanding of intelligence technologies. Researchers have a role in exploring state-of-the-art techniques creating algorithms, and discovering new applications for AI. Their work contributes to natural language processing, computer vision, robotics, and more advancements.

They investigate AI systems’ potentials and limitations to ensure their responsible use. Moreover, researchers share their findings through publications promoting collaboration and propelling the field forward. Their commitment to pushing AI’s boundaries improves capabilities and shapes its impact on society. Therefore researchers play a role in shaping the future of AI-driven innovations.

Let’s consider some of the advancements in LLM and how researchers use it to advance their work with Reasoning via Planning(RAP).

Large Language Models (LLMs) are witnessing progress leading to groundbreaking advancements and tools. LLMs have displayed capabilities in tasks such as generating text-classifying sentiment and performing zero-shot classification. These abilities have revolutionized content creation, customer service, and data analysis by boosting productivity and efficiency.

In addition to their existing strengths, researchers are now exploring the potential of LLMs in reasoning. Transformer architecture could accurately respond to reasoning problems in the training space but struggled to generalize to examples drawn from other distributions within the same problem space. They discovered that the models had learned to use statistical features to make predictions rather than understanding the underlying reasoning function.

  • These models can comprehend information and make logical deductions, making them valuable for question-answering, problem-solving, and decision-making. However, despite their skills, LLMs still need help with tasks requiring an internal world model like humans. This limitation hampers their ability to generate action plans and perform reasoning effectively.
  • Researchers have developed a reasoning framework called Reasoning via Planning (RAP) to address these challenges. This framework equips LLMs with algorithms for reasoning, enabling them to tackle tasks more efficiently.

The central concept behind RAP is to approach multi-reasoning as a process of planning, where we search for the most optimal sequence of reasoning steps while considering the balance between exploration and exploitation. To achieve this, RAP introduces the idea of a “World Model” and a “Reward” function.

  • In the RAP framework, the concept of a “World Model” is introduced that treats solutions as states. It then adds actions or thoughts to these states as transitions. The “Reward” function plays a role in evaluating the effectiveness of each reasoning step giving rewards to reasoning chains that are more likely to be correct.
  • Apart from the RAP paper, researchers have proposed LLM Reasoners, an AI library designed to enhance LLMs (language models) with reasoning capabilities. LLM Reasoners perceive step reasoning as a planning process and utilize sophisticated algorithms to search for the most efficient reasoning steps. They strike a balance between exploring options and exploiting information. With LLM Reasoners, you can define reward functions. Optionally include a world model streamlining aspects of the reasoning process such as Reasoning Algorithms, Visualization tools, LLM invocation, etc.
  • Extensive experiments on challenging reasoning problems have demonstrated that RAP outperforms CoT-based (Commonsense Transformers) approaches. In scenarios, it even surpasses models like GPT 4.
  • Through evaluation of the steps in reasoning, the LLM utilizes its world model to create a reasoning tree. RAP allows it to simulate outcomes estimate rewards, and improve its decision-making process.

The versatility of RAP in designing reward states and actions showcases its potential as a framework for addressing reasoning tasks. Its innovative approach that combines planning and reasoning brings forth opportunities for AI systems to achieve thinking and planning at a human level. The advanced reasoning algorithms, user visualization, and compatibility with LLM libraries contribute to its potential to revolutionize the field of LLM reasoning.

Reasoning via Planning (RAP) represents an advancement in enhancing the capabilities of Language Models (LLMs) by providing a robust framework for handling complex reasoning tasks. As AI systems progress, the RAPs approach could be instrumental in unlocking level thinking and planning to propel the field of AI toward an era of intelligent decision-making and problem-solving. The future holds possibilities, with RAP leading the way on this journey. I will continue to share these discoveries with the community.

Resources

Source code Paper for Reasoning via Planning (RAP)

GitHub for RAP

Data with Document AI and Snowflake

The star behind AI is the data, an excellent incentive for me to take a closer look. Snowflake recently shared an announcement at a recent Annual Summit Conference. So when I come across anything or any company in this space that speaks to it, I must share that discovery here. 

Data management is at the heart of every organization’s success. Document processing is a core aspect of many business operations, from finance and legal to human resources and customer service. Document AI, (based on a recent acquisition) powered by artificial intelligence brings automation and efficiency to this process, allowing organizations to extract valuable data from documents accurately and quickly. Snowflake, a cloud-based data platform, stands out as a game-changer. 

Snowflake enables businesses to store, analyze, and share massive amounts of data seamlessly and securely. Its ability to scale on demand, coupled with its high performance, makes it an ideal choice for enterprises of all.

Managing and processing vast amounts of data and documents is always a challenge. Enter Snowflake, and Document AI, offering cutting-edge solutions to revolutionize data management and document processing. In this blog, we explore the incredible capabilities of these technologies and how they can enhance productivity and drive business growth.

Document processing is a core aspect of many business operations, from finance and legal to human resources and customer service. Document AI, powered by artificial intelligence, brings automation and efficiency to this process, allowing organizations to extract valuable data from documents accurately and quickly.

Let’s consider a few of the highlights:

Security

  • Secure and compliant: Snowflake provides robust security measures and ensures compliance with industry regulations, giving you peace of mind.

Shared Data

  • Snowflake’s data-sharing capabilities enable seamless collaboration with partners, customers, and suppliers, empowering data-driven decision-making across the ecosystem.

Advanced analytics and AI integration

  • Snowflake integrates seamlessly with advanced analytics and AI tools, creating valuable insights to make data-driven decisions quickly.

Machine Learning

  • Document AI can leverage machine learning algorithms to extract critical information from various document types, saving time and reducing human error.

Accuracy

  •  Document AI ensures consistent and accurate results by automating document processing, improving operational efficiency, and reducing manual effort.

Data Validation

  • Document AI can cross-reference extracted data with existing databases, enabling businesses to validate the information and ensure data integrity.

Integration

  • Document AI integrates seamlessly with existing systems and workflows, making it easy to implement and adopt within your organization.

Integrating Snowflake and Document AI creates a powerful synergy that enables organizations to streamline their data management and document processing workflows. Snowflake’s scalability and performance facilitate the storage and retrieval of documents, while Document AI automates the extraction of valuable data from these documents, enhancing productivity and accuracy.

Leveraging advanced technologies like Snowflake and Document AI will be crucial for businesses aiming to stay competitive. By harnessing the power of Snowflake’s data management capabilities and Document AI’s intelligent document processing, organizations can unlock new levels of efficiency, accuracy, and productivity. 

The future is data-driven.

If you want to dive deep, excellent resources from Google are available for Document AI.

Currently in private preview for Snowflake customers. I am very interested in seeing this when it goes public.

Snowflake continues forward-moving with recent data-centric acquisitions and partnerships to enhance its AI efforts in deep learning.

Resources:

GitHub repositories for Document AI

Document AI Workbench Google

Google Jupyter Notebook for Document AI