TechnologyApril 8, 2024

How Physics Wallah Uses DataStax Astra DB, Vector Search and RAG to Revolutionize Education

How Physics Wallah Uses DataStax Astra DB, Vector Search and RAG to Revolutionize Education

From its humble beginnings in 2016 as an educational YouTube channel, Physics Wallah (PW) has experienced quite a growth arc. The success of the content provided by educator Alakh Pandey convinced him to collaborate with co-founder Prateek Maheshwari in 2020 to build an app tailored to students preparing for India’s National Eligibility cum Entrance Test (NEET) and the Joint Entrance Exam (JEE). Physics Wallah (PW) provided easy access to a broad range of comprehensive courses catering to various domains, and by January 2024, its app had amassed over 15 million downloads. The company simultaneously achieved unicorn valuation status and secured $100 million in funding.

AI Guru tutor

Physics Wallah built an AI Guru - a personalized AI tutor application, to assist students with their academic and support queries. AI Guru captures the user's intent, whether academic or support-related and then, based on metadata filtering, routes the query to the dataset containing relevant content. AI Guru is a multi-model app where audio, text, and images can be input to the chatbot, and, based on the user's query, it returns the relevant content and links to YouTube videos that cover that content. Students can also ask questions about products offered by PW and any other support-related queries. The application also collects feedback for every question and stores it as vectors in DataStax Astra DB, which is later used to improve the relevance and overall user experience.

Technology stack overview

While developing the use case, PW experimented with various vector stores, LLMs, and embedding models before settling on Astra DB as its vector store, Azure OpenAI (GPT 3.5) as the LLM, and text-ada-32 as the embedding model. Initially, they tested ChromaDB and PG vector as potential vector stores but chose Astra DB, describing it as more developer-friendly and easier to integrate into their system. They employed CassIO, a powerful Python library developed by DataStax and integrated with LangChain, to load and retrieve data from Astra DB efficiently. Factors such as scalability, performance, and cost also influenced their decision. With Astra DB, PW successfully and quickly scaled their solution from 50K users to millions.

According to Sandeep Varma, PW’s data science and engineering leader. “Astra DB is rock-solid. We experienced a 50x traffic increase on the e-learning platform with zero downtime during a live demo with 1 million students. Our application was stable with no performance issues.”

Similarly, PW found Azure OpenAI outperformed other LLMs, such as Vertex, in the context of their Hinglish chatbot. This choice was driven by the superior performance and compatibility of OpenAI with Azure, which ensured optimal functionality for their chatbot project.

This architecture outlines a text processing and embedding pipeline for a search system. It begins with extracting text and metadata from a product catalog and knowledge base. The extracted content is then segmented by a Text Splitter. Following segmentation, the Cassio Doc Loader processes the text for embedding by a machine learning model, Text-ada-32, which converts the text into numerical vectors. Finally, these vectors are loaded into DataStax Astra DB, a scalable cloud database.

The diagram below depicts a text analysis system's search and retrieval phase. A user query is processed to capture intent and filtered through DataStax Astra DB using metadata to narrow down relevant documents. The refined query is passed to a Text-ada-32 Embedding Model, which likely transforms the query into a vector form for similarity searching. This search is conducted within a vector store in Astra DB to find the most relevant document vectors. The system then presumably uses GPT-3.5 turbo (an advanced language model) for prompting or generating content (CoT stands for "chain of thought"), which leads to the final output that likely involves generating human-like text based on the query and the retrieved documents. This architecture supports intelligent search capabilities with enhanced context understanding, delivering precise responses to user inquiries. 

Additionally, the system allows users to provide feedback on its performance using a simple interface with thumbs-up and thumbs-down icons. This feedback mechanism is essential for machine learning models, as it helps understand the quality of the system's responses. All the feedback and responses are stored in AstraDB for further analysis

What’s next?

Physics Wallah aims to scale its platform's chatbot to accommodate 10 million active users. This ambitious endeavor reflects its commitment to expanding its reach and impact within education. It also aims to develop a recommendation engine that operates seamlessly atop the chatbot infrastructure. This engine will harness the power of AI to discern and analyze user interactions with the AlakhAI chatbot, enabling it to deliver personalized course recommendations tailored to each student's unique preferences and learning journey.

Physics Wallah not only revolutionizes the learning experience but also champions the transformative power of education. Gaining admission to a school of one's choice can be life-altering, opening doors to endless opportunities. Through its cost-effective approach, Physics Wallah ensures that every student, regardless of background or circumstance, has the chance to realize their limitless potential.

Get started building on Astra DB for free.

One-stop Data API for Production GenAI

Astra DB gives JavaScript developers a complete data API and out-of-the-box integrations that make it easier to build production RAG apps with high relevancy and low latency.