Generative AI, Mobile App

Improving the performance of the GPT-4-powered chatbot by 1900% with Pinecone, LangChain, and embeddings

Industry
Fitness
Year
2023
Location
Asheville, NC
Services
GPT integration, Mobile app development
Project’s length
4 weeks

Spren

Spren is a bleeding-edge fitness tech startup from North Carolina backed by investors such as Boston Seed Capital and Drive by DraftKings. Their platform uses computer vision and machine learning algorithms to turn users’ smartphone cameras into powerful body composition scanners. By measuring body fat percentage, lean mass, and other parameters, it can provide users with deep insights into their body fat composition, lean mass, and cardio-metabolic health. And, what’s most important, turn that data into actionable insights that can help users optimize their health, performance, and longevity.

Project Overview

Spren saw potential in utilizing generative AI to provide users with recommendations and answers to their questions and increase user engagement. They had an idea to integrate the GPT model into their chat. The model would then combine user context with an industry-specific knowledge base to provide users with reliable answers and recommendations.

Our tasks

GPT Integration

To improve its usability and general look & feel, ​​we designed a completely new UI for the application.

GPT Optimization

Using React, Typescript, NestJS, AWS, and Terraform, we developed the new Latch platform from scratch.

Back-end Optimization

To streamline internal processes, we implemented 3rd party tools for intelligent sentiment analysis, product analytics, and message automation.

01

Goals

Increasing user engagement

Through hyper-personalized recommendations, Spren aimed to increase user engagement in the existing app. The engagement was measured with time spent in the app and the frequency of its usage.

Making data more understandable

The idea underlying the project was to help users make use of their performance data. To do so, Spen wanted to present that data in a conversational form through a virtual assistant that would help users understand metrics and provide personalized recommendations.

Improving the app’s performance

Initially, the model required as much as 40 seconds to process the requests and provide users with a response. The goal was to shorten this time as much as possible to avoid friction and frustrations on the users’ side.

The Neoteric team were excellent as a staff-augment to our engineering team. The leadership group took the time to understand our needs and recommend the right augment skillsets. Their engineers work hard and fast, always keeping us on our toes! We’re pleased with the combined end product and look forward to working with the Neoteric team again.

Vivek Menon, Co-founder of Spren

02

Challenges

Long time to response

Unstructured data

GPT hallucinating

03

Our approach

Testing different models

While GPT-4-32K is the most powerful of the OpenAI LLMs, it doesn’t mean that it’s the best one for every possible use case. Considering the accuracy and cost-efficiency, we used GPT-4 for the large-context requests and text generation and GPT-3.5 for the less complex tasks, such as user context extraction.

Increasing model performance by using embeddings

Every input we had – user queries, user context, knowledge base – was changed into vectors (embeddings) stored in the JSON files. Additionally, the knowledge base content was stored in a Pinecone vector database. It increased the solution’s performance and made it possible to introduce a relevance score to improve its accuracy.

Filtering the knowledge base with a relevance score

Basing architecture on LangChain

Technology we used

Copilot

Pinecone

Langchain

GPT-3.5

GPT-4

04

Results

Shortening the bot’s time of response by 95%

Thanks to implemented solutions and optimizations, we managed to decrease the bot’s response time in the mobile app from ~40 seconds to ~2 seconds. This significantly improves the usability of the solution to the end users.

Delivering an MVP ready to be tested with users

One of the goals at this stage of the project was to validate the assumptions and test the idea of introducing an AI-powered assistant to the app. The MVP that we helped to deliver enabled successful tests with users and further product development.

Do you like our work?

Let's talk about your project!

Discover our
other projects