Learn to build large language model applications: vector databases, langchain, fine tuning and prompt engineering. Learn more

Natural language processing

Language models are a recent advanced technology that is blooming more and more as the days go by. These complex algorithms are the backbone upon which our modern technological advancements rest and are doing wonders for natural language communication.

From virtual assistants like Siri and Alexa to personalized recommendations on streaming platforms, chatbots, and language translation services, language models are surely the engines that power it all. 

The world we live in relies increasingly on natural language processing (NLP in short) for communication, information retrieval, and decision-making, making the evolution of language models not just a technological advancement but a necessity.

PaLM 2 vs. Llama 2
PaLM 2 vs. Llama 2


In this blog, we will embark on a journey through the fascinating world of language models and begin by understanding the significance of these models.  





But the real stars of this narrative will be PaLM 2 and Llama 2. These are more than just names; they are the cutting edge of NLP. PaLM 2 stands for “Progressive and Adaptive Language Model 2” and Llama 2 is short for “Language Learning and Mastery Algorithm 2”.

In the later sections, we will take a closer look at both these astonishing models by exploring their features and capabilities, and we will also do a comparison of these models by evaluating their performance, strengths, and weaknesses.

By the end of this exploration, we aim to shed light on which models might hold an edge or where they complement each other in the grand landscape of language models. 


Large language model bootcamp

Before getting into the details of the PaLM 2 and Llama 2 models, we should have an idea of what language models are and what they have achieved for us.  

Language Models and their role in NLP 

Natural language processing (NLP) is a field of artificial intelligence which is solely dedicated to enabling machines and computers to understand, interpret, generate, and mimic human language.

And language models as we talk about, lie at the center of NLP, they are the heart of NLP and are designed to predict the likelihood of a word or a phrase given the context of a sentence or a series of words. There are two main things or concepts when we talk about language models, they are: 

  • Predictive Power: Language models excel in predicting what comes next in a sequence of words, making them incredibly useful in autocomplete features, language translation, and chatbots.
  • Statistical Foundation: Most language models are built on statistical principles, analyzing large corpora of text to learn the patterns, syntax, and semantics of human language.

Evolution of language models: From inception to the present day

These models have come a very long way since their birth, and their journey can be roughly divided into several generations, where some significant advancements were made in each generation. 

  • First Generation: Early language models used simple statistical techniques like n-grams to predict words based on the previous ones.
  • Second Generation: The advent of deep learning and neural networks revolutionized language models, giving rise to models like Word2Vec and GloVe, which had the ability to capture semantic relationships between words. 
  • Third Generation: The introduction of recurrent neural networks (RNNs) and Long Short-Term Memory (LSTM) networks allowed models to better handle sequences of text, enabling applications like text generation and sentiment analysis. 
  • Fourth Generation: Transformer models, such as GPT (Generative Pre-trained Transformer), marked a significant and crucial leap forward in technology. These models introduced attention mechanisms, giving them the power to capture long-range dependencies in text and perform tasks ranging from translation to question-answering. 


Importance of recent advancements in language model technology

The recent advancements in language model technology have been nothing short of revolutionary, and they are transforming the way we used to interact with machines and access information from them. Here are some of the evolutions and advancements: 

  • Broader Applicability: The language models we have today can tackle a wider range of tasks, from summarizing text and generating code to composing poetry and simulating human conversation. 
  • Zero-shot Learning: Some models, like GPT-3 (by OpenAI), have demonstrated the ability to perform tasks with minimal or no task-specific training, showcasing their adaptability. 
  • Multimodal Integration: Language models are also starting to incorporate images, enabling them to understand and generate text based on visual content. 

This was all for a brief introduction into the world of language models and how they have evolved over the years, understanding these foundations of language models is essential as now we will be diving deeper into the latest innovations of PaLM 2 and Llama 2. 


Introducing PaLM 2


The term PaLM 2 as mentioned before is short for “Progressive and Adaptive Language Model 2”, and it is a groundbreaking language model which takes us to the next step in the evolution of NLP. Acquiring the knowledge of the successes from its predecessor models, PaLM model aims to push the boundaries of what’s possible in natural language generation, understanding and interpretation. 

Key Features and Capabilities of PaLM 2: 

PaLM 2 is not just another language model; it’s a groundbreaking innovation in the world of natural language processing and boasts a wide range of remarkable features and capabilities that sets it far apart from its predecessor models. Here, we’ll explore the distinctive features and attributes that make PaLM 2 stand out in the ever-competitive landscape of language models: 

Progressive Learning:

This model has the power to continually learn and adapt to changing language patterns, which in turn, ensures its relevance in a dynamic linguistic landscape. This ability of adaptability makes it well-suited for applications where language evolves rapidly, such as social media and online trends. 

Multimodal Integration:

The model can seamlessly integrate text and visual information, revealing many new possibilities in tasks that require a deep understanding of both textual and visual content. This feature is invaluable and priceless in fields like image captioning and content generation. 

Few-shot and Zero-shot Learning:

PaLM 2 demonstrates impressive few-shot and zero-shot learning abilities, which allows it to perform tasks with minimal examples or no explicit training data. This versatility makes it a valuable tool for a wide range of industries and applications. This feature reduces the time and resources needed for model adaptation. 



The model’s architecture is extremely efficient and is designed to scale efficiently, accommodating large datasets and high-performance computing environments. This scalability is essential for handling the massive volumes of text and data generated daily on the internet. 

Real-time applications:

PaLM 2’s adaptive nature makes it ideal for real-time applications, where staying aware of evolving language trends is crucial. Whether it’s providing up-to-the-minute news summaries, moderating online content, or offering personalized recommendations, PaLM 2 can excel greatly in real-time scenarios. 

Ethical considerations:

PaLM 2 also incorporates ethical guidelines and safeguards to address concerns about misinformation, bias, and inappropriate content generation. The developers have taken a proactive stance to ensure responsible AI practices are embedded in PaLM 2’s functionality.  

Real-world applications and use cases of PaLM 2: 

The features and capabilities of PaLM 2’s model extends to a myriad of real-world applications, revolutionizing and changing the way we interact with technology. You can see below some of the real-world applications for which this model has shown amazing wonders: 

  1. Content ceneration: Content creators can leverage PaLM 2 to automate content generation, from writing news articles and product descriptions to crafting creative marketing copy. 
  2. Customer support: PaLM 2 can power chatbots and virtual assistants, enhancing customer support by providing quick and accurate responses to the user inquiries.
  3. Language translation: Its multilingual proficiency makes it a valuable tool for translation services, enabling seamless communication across language barriers.
  4. Healthcare and research: In the medical field, PaLM 2 can assist in analyzing medical literature, generating reports, and even suggesting treatment options based on the latest research.
  5. Education: PaLM 2 can play a role in personalized education by creating tailored learning materials and providing explanations for complex topics. 

In conclusion, PaLM 2, is not merely a language model and is not like the predecessor models; it’s a visionary leap forward in the realm of natural language processing.

With its progressive learning, dynamic adaptability, multimodal integration, mastery of few-shot and zero-shot learning, scalability, real-time applicability, and ethical consciousness, PaLM 2 has redefined the way we used to interact with and harnessed the power of language models.

Its ability to evolve and adapt in real-time, coupled with its ethical safeguards, sets it apart as a versatile and responsible solution for a wide array of industries and applications.  


Meet Llama 2:  


Let’s talk about Llama 2 now, that is short for “Language Learning and Mastery Algorithm 2” and emerges as a pivotal player in the realm of language models. The model has been built upon the foundations laid by its predecessor model known as Llama. It is another one of the latest advanced models and introduces a host of enhancements and innovations poised to redefine the boundaries of natural language understanding and generation. 

Key features and capabilities of Llama 2: 


Beyond its impressive features, Llama 2 unveils a range of unique qualities that distinguish it as an exceptional contender in the world of language models. It distinguishes itself through its unique features and capabilities and here, we will discuss and highlight some of them briefly: 

  1. Semantic mastery: Llama 2 exhibits an exceptional grasp of semantics, allowing it to comprehend context and nuances in language with a depth that closely resembles human understanding and interpretation. This profound linguistic feature makes it a powerful tool for generating contextually relevant text. 
  2. Interdisciplinary proficiency: One of Llama 2’s standout attributes is its versatility across diverse domains, applications, and industries. Its adaptability renders it well-suited for a multitude of applications, spanning from medical research and legal documentation to creative content generation. 
  3. Multi-Language competence: The advanced model showcases an impressive multilingual proficiency, transcending language barriers to provide precise, accurate, context-aware translations and insights across a wide spectrum of languages. This feature greatly enables fostering global communication and collaboration.
  4. Conversational excellence: Llama 2 also excels in the realm of human-computer conversation. Its ability to understand conversational cues, context switches, and generate responses with a human touch makes it invaluable for applications like chatbots, virtual assistants, and customer support.
  5. Interdisciplinary collaboration: Another amazing aspect of Llama 2 is interdisciplinary collaboration as this model bridges the gap between technical and non-technical experts. This enables professionals from different fields to leverage the model’s capabilities effectively for their respective domains.
  6. Ethical focus: Like PaLM 2, Llama 2 also embeds ethical guidelines and safeguards into its functioning to ensure responsible and unbiased language processing, addressing the ethical concerns associated with AI-driven language models. 


Read more –> Boost your business with ChatGPT: 10 innovative ways to monetize using AI

Real-world applications and use cases of Llama 2: 

The adaptability and capabilities of Llama 2 extend across a plethora of real-world scenarios, ushering in transformative possibilities for our interaction with language and technology. Here are some domains in which Llama 2 excels with proficiency: 

  1. Advanced healthcare assistance: In the healthcare sector, Llama 2 lends valuable support to medical professionals by extracting insights from complex medical literature, generating detailed patient reports, and assisting in intricate diagnosis processes.
  2. Legal and compliance support: Legal practitioners also benefit from Llama 2’s capacity to analyze legal documents, generate precise contracts, and ensure compliance through its thorough understanding of legal language.
  3. Creative content generation: Content creators and marketers harness Llama 2’s semantic mastery to craft engaging content, compelling advertisements, and product descriptions that resonate with their target audience.
  4. Multilingual communication: In an increasingly interconnected and socially evolving world, Llama 2 facilitates seamless multilingual communication, offering accurate translations and promoting international cooperation and understanding. 

In summary, Llama 2, emerges as a transformative force in the realm of language models. With its profound grasp of semantics, interdisciplinary proficiency, multilingual competence, conversational excellence, and a host of unique attributes, Llama 2 sets new standards in natural language understanding and generation.

Its adaptability across diverse domains and unwavering commitment to ethical considerations make it a versatile and responsible solution for a myriad of real-world applications, from healthcare and law to creative content generation and fostering global communication. 

Comparing PaLM 2 and Llama 2

  • Performance metrics and benchmarks. 
  • Strengths and weaknesses. 
  • How both stand up against each other w.r.t accuracy, efficiency, and scalability. 
  • User experiences and feedback. 
Feature PaLM 2 Llama 2
Model size 540 billion parameters 70 billion parameters
Training data 560 billion words 560 billion words
Architecture Transformer-based Transformer-based
Training method Self-supervised learning Self-supervised learning


In conclusion, both PaLM 2 and Llama 2 stand as pioneering language models with the capacity to reshape our interaction with technology and address critical global challenges.

PaLM 2, possessing greater power and versatility, boasts an extensive array of capabilities and excels at adapting to novel scenarios and acquiring new skills. Nevertheless, it comes with the complexity and cost of training and deployment.

On the other hand, Llama 2, while smaller and simpler, still demonstrates impressive capabilities. It shines in generating imaginative and informative content, all while maintaining cost-effective training and deployment.

The choice between these models hinges on the specific application at hand. For those seeking a multifaceted, safe model for various tasks, PaLM 2 is a solid pick. If the goal is a creative and informative content generation, Llama 2 is the ideal choice. Both PaLM 2 and Llama 2 remain in active development, promising continuous enhancements in their capabilities. These models signify the future of natural language processing, holding the potential to catalyze transformative change on a global scale.


Register today

September 11, 2023

Large Language Model (LLM) Bootcamps are designed for learners to grasp the hands-on experience of working with Open AI. Popularly known as the brains behind ChatGPT, LLMs are advanced artificial intelligence (AI) systems capable of understanding and generating human language.

They utilize deep learning algorithms and extensive data to grasp language nuances and produce coherent responses. LLM power of platforms like, Google’s BERT and OpenAI’s ChatGPT, demonstrate remarkable accuracy in predicting and generating text based on input.

LLM power at the Bootcamp build your own ChatGPT
LLM Bootcamp: Build your own ChatGPT

ChatGPT, in particular, gained massive popularity within a short period due to its ability to mimic human-like responses. It leverages machine learning algorithms trained on an extensive dataset, surpassing BERT in terms of training capacity.

LLMs like ChatGPT excel in generating personalized and contextually relevant responses, making them valuable in customer service applications. Compared to intent-based chatbots, LLM-powered chatbots can handle more complex and multi-touch inquiries, including product questions, conversational commerce, and technical support.

Large language model bootcamp

The benefits of LLM-powered chatbots include their ability to provide conversational support and emulate human-like interactions. However, there are also risks associated with LLMs that need to be considered.


Practical applications of LLM power and chatbots

  • Enhancing e-Commerce: LLM chatbots allow customers to interact directly with brands, receiving tailored product recommendations and human-like assistance.
  • Brand consistency: LLM chatbots maintain a brand’s personality and tone consistently, reducing the need for extensive training and quality assurance checks.
  • Segmentation: LLM chatbots identify customer personas based on interactions and adapt responses and recommendations for a hyper-personalized experience.
  • Multilingual capabilities: LLM chatbots can respond to customers in any language, enabling global support for diverse customer bases.
  • Text-to-voice: LLM chatbots can create a digital avatar experience, simulating human-like conversations and enhancing the user experience.


Read about –> Unleash LlamaIndex: The key to uncovering deeper insights in text exploration

Other reasons why you need a LLM Bootcamp

You might want to sign up for a LLM bootcamp for many reasons. Here are a few of the most common reasons:

  • To learn about the latest LLM technologies: LLM bootcamps teach you about the latest LLM technologies, such as GPT-3, LaMDA, and Jurassic-1 Jumbo. This knowledge can help you stay ahead of the curve in the rapidly evolving field of LLMs.
  • To build your own LLM applications: LLM bootcamps teach you how to build your own LLM applications. This can be a valuable skill, as LLM applications have the potential to revolutionize many industries.
  • To get hands-on experience with LLMs: LLM bootcamps allow you to get hands-on experience with LLMs. This experience can help you develop your skills and become an expert in LLMs.
  • To network with other LLM professionals: LLM bootcamps allow you to network with other LLM professionals. This networking can help you stay up-to-date on the latest trends in LLMs and find opportunities to collaborate with other professionals.


Data Science Dojo’s Large Language Model LLM Bootcamp

The Large Language Model (LLM) Bootcamp is a focused program dedicated to building LLM-powered applications. This intensive course offers participants the opportunity to acquire the necessary skills in just 40 hours.

Centered around the practical applications of LLMs in natural language processing, the bootcamp emphasizes the utilization of libraries like Hugging Face and LangChain.

It enables participants to develop expertise in text analytics techniques, such as semantic search and Generative AI. The bootcamp also offers hands-on experience in deploying web applications on cloud services. It is designed to cater to professionals who aim to enhance their understanding of Generative AI, covering essential principles and real-world implementation, without requiring extensive coding skills.


Who is this LLM Bootcamp for?

1. Individuals with Interest in LLM Application Development:

This course is suitable for anyone interested in gaining practical experience and a headstart in building LLM (Language Model) applications.

2. Data Professionals Seeking Advanced AI Skills:

Data professionals aiming to enhance their data skills with the latest generative AI tools and techniques will find this course beneficial.

3. Product Leaders from Enterprises and Startups:

Product leaders working in enterprises or startups who wish to harness the power of LLMs to improve their products, processes, and services can benefit from this course.

What will you learn in this LLM Bootcamp?

In this Large Language Models Bootcamp, you will learn a comprehensive set of skills and techniques to build and deploy custom Large Language Model (LLM) applications. Over 5 days and 40 hours of hands-on learning, you’ll gain the following knowledge:

Generative AI and LLM Fundamentals: You will receive a thorough introduction to the foundations of generative AI, including the workings of transformers and attention mechanisms in text and image-based models.

Canonical Architectures of LLM Applications: Understand various LLM-powered application architectures and learn about their trade-offs to make informed design decisions.

Embeddings and Vector Databases: Gain practical experience in working with vector databases and embeddings, allowing efficient storage and retrieval of vector representations.


Read more –> Guide to vector embeddings and vector database pipeline


Prompt Engineering: Master the art of prompt engineering, enabling you to effectively control LLM model outputs and generate captivating content across different domains and tasks.

Orchestration Frameworks: Explore orchestration frameworks like LangChain and Llama Index, and learn how to utilize them for LLM application development.

Deployment of LLM Applications: Learn how to deploy your custom LLM applications using Azure and Hugging Face cloud services.

Customizing Large Language Models: Acquire practical experience in fine-tuning LLMs to suit specific tasks and domains, using parameter-efficient tuning and retrieval parameter-efficient + retrieval-augmented approaches.

Building An End-to-End Custom LLM Application: Put your knowledge into practice by creating a custom LLM application on your own selected datasets.


Building your own custom LLM application

After completing the Large Language Models Bootcamp, you will be well-prepared to build your own ChatGPT-like application with confidence and expertise. Throughout the comprehensive 5-day program, you will have gained a deep understanding of the underlying principles and practical skills required for LLM application development. Here’s how you’ll be able to build your own ChatGPT-like application:

Foundational Knowledge: The bootcamp will start with an introduction to generative AI, LLMs, and foundation models. You’ll learn how transformers and attention mechanisms work behind text-based models, which is crucial for understanding the core principles of LLM applications.

Customization and Fine-Tuning: You will acquire hands-on experience in customizing Large Language Models. Fine-tuning techniques will be covered in-depth, allowing you to adapt pre-trained models to your specific use case, just like how ChatGPT was built upon a pre-trained language model.

Prompt Engineering: You’ll master the art of prompt engineering, a key aspect of building ChatGPT-like applications. By effectively crafting prompts, you can control the model’s output and generate tailored responses to user inputs, making your application more dynamic and interactive.



Read more –> 10 steps to become a prompt engineer: A comprehensive guide


Orchestration Frameworks: Understanding orchestration frameworks like LangChain and Llama Index will empower you to structure and manage the components of your application, ensuring seamless execution and scalability – a crucial aspect when building applications like ChatGPT.

Deployment and Integration: The bootcamp covers the deployment of LLM applications using cloud services like Azure and Hugging Face cloud. This knowledge will enable you to deploy your own ChatGPT-like application, making it accessible to users on various platforms.

Project-Based Learning: Towards the end of the bootcamp, you will have the opportunity to apply your knowledge by building an end-to-end custom LLM application. The project will challenge you to create a functional and interactive application, similar to building your own ChatGPT from scratch.

Access to Resources: After completing the bootcamp, you’ll have access to course materials, coding labs, Jupyter notebooks, and additional learning resources for one year. These resources will serve as valuable references as you work on your ChatGPT-like application.

Furthermore, the LLM bootcamp employs advanced technology and tools such as OpenAI Cohere, Pinecone, Llama Index, Zilliz Chroma, LangChain, Hugging Face, Redis, and Streamlit.

Register today            

July 18, 2023

Before we understand LlamaIndex, let’s step back a bit. Imagine a futuristic landscape where machines possess an extraordinary ability to understand and produce human-like text effortlessly. LLMs have made this vision a reality. Armed with a vast ocean of training data, these marvels of innovation have become the crown jewels of the tech world.

There is no denying that LLMs (Large Language Models) are currently the talk of the town! From revolutionizing text generation and reasoning, LLMs are trained on massive datasets and have been making waves in the tech vicinity.

One particular LLM has emerged as a true superstar. Back in November 2022, ChatGPT, an LLM developed by OpenAI, attracted a staggering one million users within 5 days of its beta launch.

Source: Chart: ChatGPT Sprints to One Million Users | Statista  

When researchers and developers saw these stats they started thinking on how we can best feed/augment these LLMs with our own private data. They started thinking about different solutions.

Finetune your own LLM. You adapt an existing LLM by training your data. But, this is very costly and time-consuming.

Combining all the documents into a single large prompt for an LLM might be possible now with the increased token limit of 100k for models. However, this approach could result in slower processing times and higher computational costs.

Instead of inputting all the data, selectively provide relevant information to the LLM prompt. Choose the useful bits for each query instead of including everything.

Option 3 appears to be both relevant and feasible, but it requires the development of a specialized toolkit. Recognizing this need, efforts have already begun to create the necessary tools.

Introducing LlamaIndex

Recently a toolkit was launched for building applications using LLM, known as Langchain. LlamaIndex is built on top of Langchain to provide a central interface to connect your LLMs with external data.

Key Components of LlamaIndex:

The key components of LlamaIndex are as follows

  • Data Connectors: The data connector, known as the Reader, collects data from various sources and formats, converting it into a straightforward document format with textual content and basic metadata.
  • Data Index: It is a data structure facilitating efficient retrieval of pertinent information in response to user queries. At a broad level, Indices are constructed using Documents and serve as the foundation for Query Engines and Chat Engines, enabling seamless interactions and question-and-answer capabilities based on the underlying data. Internally, Indices store data within Node objects, which represent segments of the original documents.
  • Retrievers: Retrievers play a crucial role in obtaining the most pertinent information based on user queries or chat messages. They can be constructed based on Indices or as standalone components and serve as a fundamental element in Query Engines and Chat Engines for retrieving contextually relevant data.
  • Query Engines: A query engine is a versatile interface that enables users to pose questions regarding their data. By accepting natural language queries, the query engine provides comprehensive and informative responses.
  • Chat Engines: A chat engine serves as an advanced interface for engaging in interactive conversations with your data, allowing for multiple exchanges instead of a single question-and-answer format. Similar to ChatGPT but enhanced with access to a knowledge base, the chat engine maintains a contextual understanding by retaining the conversation history and can provide answers that consider the relevant past context.

Difference between query engine and chat engine:

It is important to note that there is a significant distinction between a query engine and a chat engine. Although they may appear similar at first glance, they serve different purposes:

A query engine operates as an independent system that handles individual questions over the data without maintaining a record of the conversation history.

On the other hand, a chat engine is designed to keep track of the entire conversation history, allowing users to query both the data and previous responses. This functionality resembles ChatGPT, where the chat engine leverages the context of past exchanges to provide more comprehensive and contextually relevant answers

  • Customization: LlamaIndex offers customization options where you can modify the default settings, such as the utilization of OpenAI’s text-davinci-003 model. Users have the flexibility to customize the underlying language model (LLM) and other settings used in LlamaIndex, with support for various integrations and LangChain’s LLM modules.
  • Analysis: LlamaIndex offers a diverse range of analysis tools for examining indices and queries. These tools include features for analyzing token usage and associated costs. Additionally, LlamaIndex provides a Playground module, which presents a visual interface for analyzing token usage across different index structures and evaluating performance metrics.
  • Structured Outputs: LlamaIndex offers an assortment of modules that empower language models (LLMs) to generate structured outputs. These modules are available at various levels of abstraction, providing flexibility and versatility in producing organized and formatted results.
  • Evaluation: LlamaIndex provides essential modules for assessing the quality of both document retrieval and response synthesis. These modules enable the evaluation of “hallucination,” which refers to situations where the generated response does not align with the retrieved sources. A hallucination occurs when the model generates an answer without effectively grounding it in the given contextual information from the prompt.
  • Integrations: LlamaIndex offers a wide array of integrations with various toolsets and storage providers. These integrations encompass features such as utilizing vector stores, integrating with ChatGPT plugins, compatibility with Langchain, and the capability to trace with Graphsignal. These integrations enhance the functionality and versatility of LlamaIndex by allowing seamless interaction with different tools and platforms.
  • Callbacks: LlamaIndex offers a callback feature that assists in debugging, tracking, and tracing the internal operations of the library. The callback manager allows for the addition of multiple callbacks as required. These callbacks not only log event-related data but also track the duration and frequency of each event occurrence. Moreover, a trace map of events is recorded, providing valuable information that callbacks can utilize in a manner that best suits their specific needs.
  • Storage: LlamaIndex offers a user-friendly interface that simplifies the process of ingesting, indexing, and querying external data. By abstracting away complexities, LlamaIndex allows users to query their data with just a few lines of code. Behind the scenes, LlamaIndex provides the flexibility to customize storage components for different purposes. This includes document stores for storing ingested documents (represented as Node objects), index stores for storing index metadata, and vector stores for storing embedding vectors.The document and index stores utilize a shared key-value store abstraction, providing a common framework for efficient storage and retrieval of data

Now that we have explored the key components of LlamaIndex, let’s delve into its operational mechanisms and understand how it functions.

How Llama-Index Works:

To begin, the first step is to import the documents into LlamaIndex, which provides various pre-existing readers for sources like databases, Discord, Slack, Google Sheets, Notion, and the one we will utilize today, the Simple Directory Reader, among others.[Text Wrapping Break][Text Wrapping Break]You can check for more here: Llama Hub (llama-hub-ui.vercel.app)

Once the documents are loaded, LlamaIndex proceeds to parse them into nodes, which are essentially segments of text. Subsequently, an index is constructed to enable quick retrieval of relevant data when querying the documents. The index can be stored in different formats, but we will opt for a Vector Store as it is typically the most useful when querying text documents without specific limitations.

LlamaIndex is built upon LangChain, which serves as the foundational framework for a wide range of LLM applications. While LangChain provides the fundamental building blocks, LlamaIndex is specifically designed to streamline the workflow described above.

Here is an example code showcasing the utilization of the SimpleDirectoryReader data loader in LlamaIndex, along with the integration of the OpenAI language model for natural language processing.

Installing the necessary libraries required to run the code.

Importing openai library and setting the secret API (Application Programming Interface) key.

Importing the SimpleDirectoryReader class from llama_index library and loading the data from it.

Importing SimpleNodeParser class from llama_index and parsing the documents into nodes – basically in chunks of text.

Importing VectorStoreIndex class from llama_index to create index from the chunks of text so that each time when a query is placed only relevant data is sent to OpenAI. In short, for the sake of cost effectiveness.


LlamaIndex, built on top of Langchain, offers a powerful toolkit for integrating external data with LLMs. By parsing documents into nodes, constructing an efficient index, and selectively querying relevant information, LlamaIndex enables cost-effective exploration of text data.

The provided code example demonstrates the utilization of LlamaIndex’s data loader and query engine, showcasing its potential for next-generation text exploration. For the notebook of the above code, refer to the source code available here.

July 10, 2023

This blog discusses the different tasks and techniques used in natural language processing. We will be using python code to demo what and how each task works. We will also discuss why these tasks and techniques are essential for natural language processing. 



According to a survey, only 32 percent of the business data is put to work, and 68 percent goes unleveraged. Most data are often unstructured. According to estimations, 80 to 90 percent of business data is unstructured, and so are emails, reports, social media posts, websites, and documents. Using NLP techniques, it became possible for machines to manage and analyze unstructured data accurately and quickly.  

Computers can now understand, manipulate, and interpret human language. Businesses use NLP to improve customer experience, listen to customer feedback, and find market gaps. Almost 50% of companies today use NLP applications, and 25% plan to do so in 12 months.   

The future of customer care is NLP. Customers prefer mobile messaging and chatbots over the legacy voice channel. It is four times more accurate. According to the IBM market survey, 52% of global IT professionals reported using or planning to use NLP to improve customer experience. Chatbots can resolve 80% of routine tasks and customer questions with a 90% success rate by 2022. Estimates show that using NLP in chatbots will save companies USD 8 billion annually.     

The NLP market was at 3 billion US dollars in 2017 and is predicted to rise to 43 billion US dollars in 2025, around 14 times higher. 


Natural Language Processing (NLP)  

Natural language processing is a branch of artificial intelligence that enables computers to analyze, understand, and drive meaning from a human language using machine learning and respond to it. NLP combines computational linguistics with artificial intelligence and machine learning to create an intelligent system capable of understanding and responding to text or voice data the same way humans do. 


NLP analyzes the syntax and semantics of the text to understand the meaning and structure of human language. Then it transforms this linguistic knowledge into a machine-learning algorithm to solve real-world problems and perform specific tasks.   

Natural language is challenging to comprehend, which makes NLP a challenging task. Mastering a language is easy for humans, but implementing NLP becomes difficult for machines because of the ambiguity and imprecision of natural language. 


NLP requires syntactic and semantic analysis to convert human language into a machine-readable form that can be processed and interpreted. 


Syntactic analysis  

Syntactic analysis is the process of analyzing language with its formal grammatical rules. It is also known as syntax analysis or parsing formal grammatical rules applied to a group of words but not a single word. After verifying the correct syntax, it takes text data as input and creates a structural input representation. It creates a parse tree. A syntactically correct sentence does not necessarily make sense. It needs to be semantically correct to make sense.   


Semantic analysis  

Semantic analysis is the process of figuring out the meaning of the text. It enables computers to interpret the words by analyzing sentence structure and the relationship between individual words of the sentence. Because of language’s ambiguous and polysemic nature, semantic analysis is a particularly challenging area of NLP. It analyzes the sentence structure, word interaction, and other aspects to discover the meaning and topic of the text.  


NLP tasks and techniques: 

Before proceeding further, ensure you run the below code block to install all the dependencies. 


!pip install -U spacy 

!python -m spacy download en 

!pip install nltk 

!pip install prettytable 

Here are some everyday tasks performed in syntactic and semantic analysis:  



Tokenization is a common task in NLP. It separates natural language text into smaller units called tokens. For example, in Sentence tokenization paragraph separates into sentences, and word tokenization splits the words of a sentence.  


The code below shows an example of word tokenization using spaCy.   



import spacy 

nlp = spacy.load("en_core_web_sm") 

doc = nlp("Data Science Dojo is the leading platform providing data science training.") 

for token in doc: 

















Part-of-speech tagging  

Part of speech or grammatical tagging labels each word as an appropriate part of speech based on its definition and context. POS tagging helps create a parse tree that helps understand word relationships. It also helps in Named Entity Recognition, as most named entities are nouns, making it easier to identify them. 

In the code below, we use pos_ attribute of the token to get the part of speech for the universal pos tag set.   



import spacy 

from prettytable import PrettyTable 

table = PrettyTable(['Token', 'Part of speech', 'Tag']) 

nlp = spacy.load("en_core_web_sm") 

doc = nlp("Data Science Dojo is the leading platform providing data science training.") 

for token in doc: 

  table.add_row([token.text, token.pos_, token.tag_]) 




Part of speech tag
Part of speech tag


Try it yourself with this Analyze Text Demo. 

Analyze Text
Analyze Text


Dependency and Consistency parsing  

Dependency parsing is how grammatical structure in a sentence is analyzed to find out the related word and their relationship. Each relationship has one head and one dependent. Then, a label based on the nature of dependency is assigned between the head and the dependent.  

Consistency parsing is a process by which phrase structure grammar is identified to visualize the entire syntactic structure.   

In the code below, we created a dependency tree using the displacy visualizer of spacy.  




import spacy 

nlp = spacy.load("en_core_web_sm") 

doc = nlp("Data Science Dojo is the leading platform providing data science training.")         

spacy.displacy.render(doc, style="dep") 






Try it yourself with this Analyze Text Demo. 


Lemmatization and stemming  

We use inflected forms of the word when we speak or write. These inflected forms are created by adding prefixes or suffixes to the root form. In the process of lemmatization and stemming, we are grouping similar inflected forms of a word into a single root word. In this way, we link all the words with the same meaning as a single word, which is simpler to analyze by the computer.  


The word’s root form in lemmatization is lemma, and in stemming is a stem. Lemmatization and stemming do the same task of grouping inflected forms, but they are different. Lemmatization considers the word and its context in the sentence, while stemming only considers the single word. So, we consider POS tags in lemmatization but not in stemming. That is why lemma is an actual dictionary word, but stem might not be.  

Now we are applying lemmatization using spacy.   



import spacy 

nlp = spacy.load('en_core_web_sm', disable=['parser', 'ner']) 

doc = nlp("Data Science Dojo is the leading platform providing data science training.") 

lemmatized = [token.lemma_ for token in doc] 

print("Original: \n", doc) 

print("\nAfter Lemmatization: \n", " ".join(lemmatized)) 




 Data Science Dojo is the leading platform providing data science training. 

After Lemmatization:  

 Data Science Dojo is the lead platform to provide datum science training.  


Unfortunately, spacy does not contain any function for stemming.  

Let us use Porter Stemmer from nltk to see how stemming works.  



import nltk 


from nltk.stem import PorterStemmer 

from nltk.tokenize import word_tokenize   

ps = PorterStemmer() 

sentence = "Data Science Dojo is the leading platform providing data science training." 

words = word_tokenize(sentence) 

stemmed = [ps.stem(token) for token in words]  

print("Original: \n", " ".join(words)) 

print("\nAfter Stemming: \n", " ".join(stemmed)) 




 Data Science Dojo is the leading platform providing data science training . 

After Stemming:  

 data scienc dojo is the lead platform provid data scienc train . 


Stop word removal  

Stop words are the frequent words that are used in any natural language. However, they are not particularly useful for text analysis and NLP tasks. Therefore, we remove them, as they do not play any role in defining the meaning of the text.   




import spacy 

nlp = spacy.load("en_core_web_sm") 

doc = nlp("Data Science Dojo is the leading platform providing data science training.") 

token_list = [ token.text for token in doc ] 

filtered_sentence = [ word for word in token_list if nlp.vocab[word].is_stop == False ]  


print("\nAfter stop word removal:\n", filtered_sentence)    





['Data', 'Science', 'Dojo', 'is', 'the', 'leading', 'platform', 'providing', 'data', 'science', 'training', '.'] 


After stop word removal: 

['Data', 'Science', 'Dojo', 'leading', 'platform', 'providing', 'data', 'science', 'training', '.'] 



Try it yourself with this Cleanse Stop Words Demo. 

Cleanse Stop Word Demo
Cleanse Stop Word Demo


Named entity recognition  

Named entity recognition is an NLP technique that extracts named entities from the text and categorizes them into semantic types like organization, people, quantity, percentage, location, time, etc. Identifying named entities helps identify the critical element in the text, which can help sort the unstructured data and find valuable information.   




import spacy 

from prettytable import PrettyTable 

nlp = spacy.load("en_core_web_sm") 

doc = nlp("Data Science Dojo was founded in 2013 but it was a free Meetup group long before the official launch. With the aim to bring the knowledge of data science to everyone, we started hosting short Bootcamps with the most comprehensive curriculum. In 2019, the University of New Mexico (UNM) added our Data Science Bootcamp to their continuing education department. Since then, we've launched various other trainings such as Python for Data Science, Data Science for Managers and Business Leaders. So far, we have provided our services to more than 10,000 individuals and over 2000 organizations.") 

table = PrettyTable(["Entity", "Start Position", "End Position", "Label"]) 

for ent in doc.ents: 

    table.add_row([ent.text, ent.start_char, ent.end_char, ent.label_]) 


spacy.displacy.render(doc, style="ent") 




Named Entity
Named Entity



Named Entity Visual
Named Entity Visual



Try it yourself with this Text Entity Extractor Demo. 


Text Entity Extractor Demo
Text Entity Extractor Demo


Sentiment analysis 

Sentiment analysis, also referred to as opinion mining, uses natural language processing to find and extract sentiments from the text. It determines whether the data is positive, negative, or neutral.  


Some of the real-world applications of sentiment analysis are:  

  • Customer support  
  • Customer feedback  
  • Brand monitoring  
  • Product analysis  
  • Market research  



Try it yourself with this Opinion Mining Demo. 


Opinion Mining Demo
Opinion Mining Demo


We have discussed natural language processing and what common tasks it performs in natural language processing. Then, we saw how we can perform different functions in spacy and nltk and why they are essential in natural language processing.   

Full Code Available 

 We know about the different tasks and techniques we perform in natural language processing, but we have yet to discuss the applications of natural language processing. For that, you can follow this blog. 

Read more about: 

Blog: NLP Applications


Upgrade your data science skillset with our Python for Data Science and Data Science Bootcamp training!  


November 7, 2022

This blog will discuss the different Natural Language Processing applications. We will see the applications and what problems they solve in our daily life. 


One of the essential things in the life of a human being is communication. We need to communicate with other human beings to deliver information, express our emotions, present ideas, and much more. The key to communication is language. We need a common language to communicate, which both ends of the conversation can understand. Doing this is possible for humans, but it might seem a bit difficult if we talk about communicating with a computer system or the computer system communicating with us. 

But we have a solution for that, Artificial Intelligence, or more specifically, a branch of Artificial Intelligence known as Natural Language Processing (NLP). Natural Language Processing enables the computer system to understand and comprehend information the same way humans do. It helps the computer system understand the literal meaning and recognize the sentiments, tone, opinions, thoughts, and other components that construct a proper conversation. 

Natural Language Processing (NLP)
Applications of Natural Language Processing

After making the computer understand human language, a question arises in our minds, how can we utilize this ability of a computer to benefit humankind? 

Natural Language Processing Applications: 

Let’s answer this question by going over some Natural Language Processing applications and understanding how they decrease our workload and help us complete many time-taking tasks more quickly and efficiently. 

1. Email filtering 

Email is a part of our everyday life. Whether it is related to work or studies or many other things, we find ourselves plunged into the pile of emails. We receive all kinds of emails from various sources; some are work-related or from our dream school or university, while others are spam or promotional emails. Here Natural Language Processing comes to work. It identifies and filters incoming emails into “important” or “spam” and places them into their respective designations.


Large language model bootcamp


2. Language translation 

There are as many languages in this world as there are cultures, but not everyone understands all these languages. As our world is now a global village owing to the dawn of technology, we need to communicate with other people who speak a language that might be foreign to us. Natural Language processing helps us by translating the language with all its sentiments.  

3. Smart assistants 

In today’s world, every new day brings in a new smart device, making this world smarter and smarter by the day. And this advancement is not just limited to machines. We have advanced enough technology to have smart assistants, such as Siri, Alexa, and Cortana. We can talk to them like we talk to normal human beings, and they even respond to us in the same way.

All of this is possible because of Natural Language Processing. It helps the computer system understand our language by breaking it into parts of speech, root stem, and other linguistic features. It not only helps them understand the language but also in processing its meaning and sentiments and answering back in the same way humans do. 

 4. Document analysis 

Another one of NLP’s applications is document analysis. Companies, colleges, schools, and other such places are always filled to the brim with data, which needs to be sorted out properly, maintained, and searched for. All this could be done using NLP. It not only searches a keyword but also categorizes it according to the instructions and saves us from the long and hectic work of searching for a single person’s information from a pile of files. It is not only limited to this but also helps its user to inform decision-making on claims and risk management. 

5. Online searches 

In this world full of challenges and puzzles, we must constantly find our way by getting the required information from available sources. One of the most extensive information sources is the internet. We type what we want to search and checkmate! We have got what we wanted. But have you ever thought about how you get these results even when you do not know the exact keywords you need to search for the needed information? Well, the answer is obvious.

It is again Natural Language Processing. It helps search engines understand what is asked of them by comprehending the literal meaning of words and the intent behind writing that word, hence giving us the results, we want. 

 6. Predictive text 

A similar application to online searches is predictive text. It is something we use whenever we type anything on our smartphones. Whenever we type a few letters on the screen, the keyboard gives us suggestions about what that word might be and when we have written a few words, it starts suggesting what the next word could be. These predictive texts might be a little off in the beginning.

Still, as time passes, it gets trained according to our texts and starts to suggest the next word correctly even when we have not written a single letter of the next word. All this is done using NLP by making our smartphones intelligent enough to suggest words and learn from our texting habits. 

7. Automatic summarization 

With the increasing inventions and innovations, data has also increased. This increase in data has also expanded the scope of data processing. Still, manual data processing is time taking and is prone to error. NLP has a solution for that, too, it can not only summarize the meaning of information, but it can also understand the emotional meaning hidden in the information. Thus, making the summarization process quick and impeccable. 

 8. Sentiment analysis 

The daily conversations, the posted content and comments, book, restaurant, and product reviews, hence almost all the conversations and texts are full of emotions. Understanding these emotions is as important as understanding the word-to-word meaning. We as humans can interpret emotional sentiments in writings and conversations, but with the help of natural language processing, computer systems can also understand the sentiments of a text along with its literal meaning. 

 9. Chatbots  

With the increase in technology, everything has been digitalized, from studying to shopping, booking tickets, and customer service. Instead of waiting a long time to get some short and instant answers, the chatbot replies instantly and accurately. NLP gives these chatbots conversational capabilities, which help them respond appropriately to the customer’s needs instead of just bare-bones replies.

Chatbots also help in places where human power is less or is not available round the clock. Chatbots operating on NLP also have emotional intelligence, which helps them understand the customer’s emotional sentiments and respond to them effectively. 

 10. Social media monitoring   

Nowadays, every other person has a social media account where they share their thoughts, likes, dislikes, experiences, etc., which tells a lot about the individuals. We do not only find information about individuals but also about the products and services. The relevant companies can process this data to get information about their products and services to improve or amend them. NLP comes into play here. It enables the computer system to understand unstructured social media data, analyze it and produce the required results in a valuable form for companies.


We now understand that NLP has many applications, spreading its wings in almost every field. Help decrease manual labor and do the tasks accurately and efficiently. 

September 8, 2022

Natural Language Processing is a key Data Science skill. Learn how to expand your knowledge with R programming books on Text Analytics.

It is my firm conviction that Natural Language Processing/Text Analytics is a must-have skill for any practicing Data Scientist.

From analyzing customer feedback in NSAT surveys to scraping Microsoft’s internal job postings for analyzing popular technical skills, to segmenting customers via textual features, I have universally found that Text Analytics is a wildly useful skill.

R programming books – Sources to learn from

Not surprisingly, I am often asked by students of our Data Science Bootcamp, folks that I mentor on Data Science and my LinkedIn contacts about the subject of Text Analytics. The good news is that there are many great resources for the R programmer to learn Text Analytics.

What follows is a practical curriculum where the only required knowledge is basic R programming skills. I have read all of the books referenced below and can attest that studying the curriculum will have you mastering Text Analytics in no time!

Text Analytics with R for Students of Literature

Text Analytics with R for Students of Literature
Book cover of Text Analytics with R for Students of Literature by Matthew L. Jockers

is quite simply the best, most straightforward introduction to working with text that I have found. Professor Jockers illustrates many of the fundamentals using out of the box R programming. This book provides a great foundation for anyone looking to get started in Text Analytics with R.

Taming Text

Taming Text
Book cover of Taming Text by Grant, Thomas, and Andrew

is the next stop on the Text Analytics journey. While this book is primarily written for Java programmers, there is a lot of theory that is immensely useful for R programmers learning to work with text. Additionally, the book covers the OpenNLP Java library which is available to R programmers via the excellent openNLP package.

R Logo
R programming logo

The CRAN NLP Task View illustrates the wide-ranging Text Analytics support for the R programmer. Unfortunately, it also illustrates that the landscape is fractured as well. However, a couple of packages are worthy of study. The tm package is often the go-to Text Analytics package for R programmers. However, the new quanteda package shows a lot of promise. Lastly, the excellent openNLP package deserves a second callout.

Introduction to Information Retrieval for Text Analytics

Introduction to Information Retrieval for Text Analytics
Book cover of Introduction to Information Retrieval for Text Analytics by Christopher, Prabhakar, and Hinrich

while focused primarily on the problem of search, nevertheless, contains a wealth of theory and understanding (e.g., the Vector Space Model) to take the R programmer to the next level. The text is language agnostic, is quite excellent, and free!


While the Natural Language Toolkit (NLTK) is Python-based, the book on the subject of NLP is a wealth of goodness to the R programmer. I put this resource last in the list as learning the above conceptual material and R packages provides the necessary background to translate some of the concepts (e.g., chunking) into the R context. Awesome stuff, and free to boot!

There you have it, a practical curriculum for the R programmer to ramp into Text Analytics. Don’t hesitate to reach out if you have any questions or comments – I monitor my blog almost continually.

Until next time, happy data sleuthing!

Watch our video tutorials on text analytics.

June 15, 2022

Do you know what can be done with your telecom data? Who decides how it should be used?

Telecommunications isn’t going anywhere. In fact, your telecom data is becoming even more important than ever.

From the first smoke signals to current, cutting-edge smartphones, the objective of telecommunications has remained the same:

Telecom transmits data across distances farther than the human voice can carry.

Telecommunications (or telecom), as an industry with data ingrained into its very DNA, has benefited a great deal from the advent of modern data science. Here are 7 ways that telecommunications companies (otherwise known as telcos) are making the most of your telecom data, with machine learning purposes.

1: Aiding in infrastructure repair

A person analyzing data reports

Even as communication becomes more decentralized, signal towers remain an unfortunate remnant of an analog past in telecommunications. Companies can’t exactly send their in-house software engineers to climb up the towers and routinely check on the infrastructure. This task still requires field workers to carry out routine inspections, even if no problem visibly exists. AT&T is looking to change that through machine learning models that will analyze video footage captured by drones. The company can then passively detect potential risks, allowing human workers to fix structural issues before they affect customers. Read more about AT&T’s drones here.

2: Email management and lead identification

A number of mails / e-mails

Mass email marketing is a vital asset of the modern corporation, but even as the sending process becomes more automated, someone is still required to sift through the responses and interpret the interests and questions from potential customers.

To make your life easier, you could instead offload that task to AI. In 2016, CenturyLink began using its automated assistant “Angie” to handle 30,000 monthly emails. Of these, 99% could be properly interpreted without handing them off to a human manager. Imagine how much time the human manager would save, without having to sift through that telecom data.

The company behind Angie, California-based tech developer Conversica, advertises machine learning models as a way to identify promising leads from the dense noise of email communication, which enables telcos to efficiently redirect their marketing follow-up efforts to the right representatives.

3: Rise of the chat bots

Chat bots sending automated message

Dealing with chat bots can be a frustrating (or hilarious) experience. Despite the generally negative perception that precedes them, it hasn’t slowed down bot implementation into the customer service side of most telecom companies. Spectrum and AT&T are among the corporations that utilize chat bots at some level of their customer service pipeline, and others are quickly following suit. As the algorithms behind these programs grow more nuanced, human customer service, which brings its own set of frustrations, is beginning to be reduced or phased out.

4: Working with language

The advancement of natural language processing has made interacting with technology easier than ever. Telcos like DISH and Comcast have made use of this branch of artificial intelligence to improve the user interface of their products. One example of this is allowing customers to navigate channels and save shows as “favorites” using only their natural speech. Visually impaired customers can make use of vocal relay features to hear titles and time-slots read back to them in response to spoken commands, widening the user base of the company.

5: Content customization

Content customization concept on different channels

If you’re a Netflix user, I’m sure you’ve seen the “Recommended for you” and “Because you watched (insert show title)” recommendations. They used to be embarrassingly bad, but these suggestions have noticeably improved over the years.

Netflix has succeeded partly on the back of its recommendation engine, which tailors displayed content based on user behavior (in other words, your telecom data). Comcast is making moves towards a similar system, utilizing machine vision algorithms and user metadata to craft a personalized experience for the customer.

As companies begin to create increasingly precise user profiles, we are approaching the point of your telco knowing more about your behavior than you do, solely from the telecom data you put out.This can have a lot of advantages, one of the more obvious ones include being introduced to a new favorite show.

6: Variable data caps

Nobody likes data caps that restrict them, but paying for data usage you’re not actually using is nearly as bad. Some telecom companies are moving towards a system that calculates data caps based on user behavior and adjusts the price accordingly, in an effort to be as fair as possible. Whether or not you think corporations will use tiered pricing in a reasonable way depends on your opinion of said corporations. On paper, big data may be able to determine what kind of data consumer you are and adjust your data restrictions to fit your specific needs. This could potentially save you hundreds of dollars a year.

For as long as data could be extracted from phone calls, the telecommunications industry has been collecting your telecom data. “Call detail records” (CDRs) are a treasure trove of user information.

CDRs are accompanied by metadata which includes parameters such as the numbers of both speakers on the call, the route the call took to connect, any faulty conditions the call experienced, and more. Machine learning models are already working to translate CDRs into valuable insights on improving call quality and customer interactions.

It’s important to note that phone companies aren’t the only ones making use of this specific data. Since this metadata contains limited personal information, the Supreme Court ruled that it does not fall under the 4th Amendment, and as such, CDRs are used by law enforcement almost as much as by telcos.


Sabrina Dominguez: Sabrina holds a B.S. in Business Administration with a specialization in Marketing Management from Central Washington University. She has a passion for Search engine optimization and marketing.

James Kennedy: James holds a B.A. in Biology with a Creative Writing minor from Whitman College. He is a lifelong writer with a curiosity for the sciences.

This is the first part in a series identifying the practical uses of data science in various industries. Stay tuned for the second part, which will cover data in the healthcare sector.


June 14, 2022

Related Topics

Machine Learning
Generative AI
Data Visualization
Data Security
Data Science
Data Engineering
Data Analytics
Computer Vision
Artificial Intelligence