《MobiDev:如何集成GPT模型:6个ChatGPT用例测试(英文版)(29页).pdf》由会员分享,可在线阅读,更多相关《MobiDev:如何集成GPT模型:6个ChatGPT用例测试(英文版)(29页).pdf(29页珍藏版)》请在三个皮匠报告上搜索。
1、Table of ContentsWhat is ChatGPT and What are GPT Models in General?How to Use ChatGPT in Your App or Website1.THE TASK IS VIABLE BY MEANS OF THE EXISTING MODEL.2.FINE-TUNING THE MODEL WITH YOUR OWN DATA.ChatGPT Business Use Cases1.CUSTOMER SUPPORT2.LEAD GENERATION3.DATA ANALYTICS1.Copywriting with
2、ChatGPT2.General Programming with ChatGPT3.Building AI pipelines with the help of GPT Models4.Processing Table Data with ChatGPT5.ChatGPT for recommendation systems6.Using ChatGPT for Computer Vision Tasks7.Your ChatGPT Business Case?The Importance of Prompt Engineering and the Future of GPT Models1
3、GPT models werent widely popular until November 2022,once OpenAI built asuccessor of their language models called ChatGPT.As for March 2023 ChatGPTis now officially released with an API and SDK to integrate the model into yourproducts.While there are a plethora of applications on the surface,ChatGPT
4、offers a wide range of improvements for different types of technical andbusiness processes.So here well put to the test the most viable,and see whereit gets us.Ill share with you my vision on how we can benefit from GPT models ondifferent levels of automation,while providing you with a concise answe
5、r of thequestion,“What do I need to implement a GPT model in my product?”.Please note:all the tests were made during the pre-release stage.What is ChatGPT and What are GPT Models inGeneral?If you already know what ChatGPT and other GPT models are,you can skip thispart.Because here Ill define ChatGPT
6、 from different angles,along with how toexploit its capabilities to dig for data and provide us with necessary information.The easiest way to do this is by simply asking the model,and here is howChatGPT identifies itself:ChatGPT defines itselfChatGPT is the latest GPT model that was developed on the
7、 basis of GPT 3.5.Ithas the ability to interact with the user in the form of a dialogue and provideanswers to almost any question based on events and information up until 2021.2GPT models are highly capable of solving a range of Natural LanguageProcessing(NLP)tasks with the possibility of customizat
8、ion such as:Keywords extractionText translationQuestion answeringText generationText summarySpelling correctionText style transferringNamed entity recognitionHow to Use ChatGPT in Your App or WebsiteAs of March 2023,ChatGPT is available via API and some companies likeSnapchat are already using it.So
9、 it makes sense to discuss how ChatGPT can beintegrated in your application for a technical standpoint.There is a certain forkof options here:1.THE TASK IS VIABLE BY MEANS OF THE EXISTING MODEL.Here,the model operates as a smart catalog,helping the user to browsethrough content and make choices more
10、 quickly using the response of GPT.However,customizations and personalization are not available.2.FINE-TUNING THE MODEL WITH YOUR OWN DATA.Such models can be useful for creating a personalized chatbot recommendersystem based on user actions/desires and other use cases.Using your own data,the GPT mod
11、el can be trained to introduce the element of personalization.Theamount of data needed to fine tune a GPT model depends on various factors,such as the size and complexity of the data set,and the desired performance ofthe model.Typically,at least a few hundred examples are required to effectivelyfine
12、-tune a GPT model.However,in complex domains,it may take tens ofthousands or even millions of examples to achieve optimal model performance.3To understand whether youll need to fine-tune the model,I would recommendyou running through these 5 steps:1.Business understanding that involves learning the
13、business case,whattask is delegated to the model,what data it should use,and thepersonalization features that are expected.2.Data gathering.This step can be skipped if personalized information canbe skipped at the early stages.But if you plan to use the GPT model in ahighly specific domain,by defaul
14、t,the model will fail to operate correctly.Which means,this stage is necessary.For example,it is necessary torecommend clothes for the user based on what is available in the store.Then it is necessary to collect information about the products of the storeand provide basic instructions for recommenda
15、tions(for example,jeanswith the article YYYY should be worn over a T-shirt with such XXXX).3.Data annotation/Data labeling.This stage will include creating a promptfor each sample from the data gathering stage.For example:shorts withYYYY articles must be worn over a T-shirt with XXXX article=what sh
16、ould Iwear under a T-shirt with XXX article?And the expected answer:jeans withYYYY article.4.Data Preparation.This implies converting the data into a suitable format,e.g.“prompt”:“”,“completion”:“”.5.Modeling.Finally,applying those changes and implementing the model inproduction.Keep in mind that th
17、e GPT model is not a complete product that covers all thedomain areas out of the box.Youll also need the application for it andmanagement tools on the backend.Then,the output of a GPT model has to beprocessed with NLP methods in order to extract meaningful information.Themodel returns an answer as t
18、ext in multiple sentences,like a list.This outputshould be presented in the form of one word or several,which will be used as afilter or keywords in the following parts of the pipeline.So this means the GPTmodel will also require other models to operate.Knowing that,lets discuss GPT models as a comp
19、lementary tool suitable fordifferent business and technical needs.4ChatGPT Business Use CasesChatGPT is much more capable than its predecessors since it was trained withthe help of the reinforcement learning with human feedback(RLHF)technique.This provided a distinguishing level of performance compa
20、red to the no lesspopular GPT 3 model.Because of this,ChatGPT is now adopted to a range ofbusiness and technical tasks using its NLP capabilities.Let us ask what ChatGPTthinks of its business use cases:ChatGPT business use casesHere we can see the model providing an answer listing some of the mostco
21、mmon use cases.Since the model relies on data limited to 2021,its not even afull list and there are tons of low level tasks we can delegate to ChatGPT.We canalso try to narrow down our focus,and extract some value in a single domainarea:5ChatGPT gives advice on how to develop a product strategyBased
22、 on these examples,we can make a bunch of conclusions concerning threeof the most promising business use cases:1.CUSTOMER SUPPORTChatGPT is a highly capable conversational bot that can be customized with yourown data.As its able to understand the question correctly even with brokengrammatical struct
23、ure or missing syntactical parts,it can be considered a readymade solution for customer support systems,and namely chat bots.2.LEAD GENERATIONFollowing up on the previous point,the same capabilities can be used in leadgeneration activities since in most cases,the ChatGPT level of speech doesntdiffer
24、 too much from what people can write.63.DATA ANALYTICSAt some point,GPT models may become an alternative to modern businessintelligence and data analytic solutions.Since they can operate on hugedatabases of historical data and provide human workers with valuable insights.However,when it comes to rea
25、l-time data analysis that requires constantupdates and the most recent information available,GPT models appear to beclumsy.The process of training with the RLHF technique is complex,and besidesthat,it will require a machine learning pipeline with automated retraining andredeployment of the models.Wh
26、ich is,kind of a rocket science for now.So applications that rely heavily on real-time data updates are not really suitablefor GPT models yet.What else can we do with it?1.Copywriting with ChatGPTOne of the most popular statements about language models and neuralnetworks is that they can definitely
27、take the job of copywriters or at least boostthe speed of writing to a large extent.Let us see whether its true for today.Welluse two types of requests to check how the model will handle article writing onthe software engineering topic.The first type of request simply states thegeneral idea of the t
28、ext,while the second one will specify things I want themodel to describe and provide an expert opinion or arguments for.Request:“Write me an article about different PHP frameworks.”ChatGPT output:7ChatGPT article on PHP frameworks topicRequest:“Write me an article about the difference between Larave
29、l and Symfonyframeworks,and what PHP framework should I choose for an Ecommerceapplication.”8ChatGPT output:ChatGPT article comparing PHP frameworks9In both cases,the model handles the topic pretty well concerning theinformation standpoint.Grammatically and stylistically texts are also fine.However,
30、when it comes to the level of creativity,ease of reading,reasoning,andjustification of a certain point,it looks very standard and unconvincing.While ChatGPT certainly can generate some blueprints to simplify yourmarketing efforts,it imposes one problem for human proofreaders.As themodel parses the d
31、ata by itself,it appears difficult to find the source ofinformation and prove the models claims.So to be used for marketingpurposes,ChatGPT requires fine tuning and additional features like AIexplainability to be effective and useful.2.General Programming with ChatGPTIf GPT models can speak a human
32、language,nothing stops them from usingprogramming languages to write applications.Our PHP/DevOps group leader,Anton Logvinenko,put this to the test to see what results can be achieved byexploiting the model to write code in PHP for various functions.Request:“Write a PHP code on Laravel Framework whi
33、ch will display the list ofusers”.ChatGPT response:User controller10View“In most cases,this code will definitely work.In this specific case,it lacks the databasestructure,as well as which fields does each user have,like name and surname.Soyou should keep in mind that currently ChatGPT doesnt provide
34、 you with a finishedcode that can be used off the shelf.The use case I can see for this is to support junior-level developers in learning PHP orits frameworks and speed up the process a bit.While the code itself is written in asyntactically correct manner,there are a lot of things to improve.Anton L
35、ogvinenkoPHP/DevOps Group Leader”Request:“Write a PHP code which implements REST API with CRUD endpoints forarticle resource”.11ChatGPT response:Rest API12“Again,looking at what the models suggest,the code looks like a beginner level effortin PHP,but it will most likely work if you set up the databa
36、se,configure access and soon.Although this code is written on the level of an intern PHP developer,it doesntuse any of the frameworks available,and it is not optimized nor can you easily scaleit to the whole application.Additionally,there are potential security threats in theform of SQL injections w
37、hich ChatGPT leaves places for,which is not good in anycase.Anton LogvinenkoPHP/DevOps Group Leader”13Tree task request,first attempt14ChatGPT response:Tree task response,first attempt“In the first attempt of this example,I wanted ChatGPT to generate the tree of itemsbased on the provided example.Ho
38、wever,the output turned out to be a garbagecode,and I figured out that I didnt specify that its a tree in the prompt.So at thesecond attempt Ive added an explanation of what I need as the output.Anton LogvinenkoPHP/DevOps Group Leader”15Tree task request,second attempt16ChatGPT response:Tree task re
39、sponse,second attempt“In the second attempt,ChatGPT completed the task and the tree looks fine except for thecode quality.What can we conclude from this little experiment?Obviously,ChatGPT isnt ableto replace software engineers yet because the approach and the quality of code writing is stillvery sh
40、allow.But at the end of the day,this thing will definitely see improvements over time.For now,its too early to speak of ChatGPT as an automated code writer.Anton LogvinenkoPHP/DevOps Group Leader”17If you are considering options to partially automate coding workflows andsupport your developers,we wo
41、uld recommend using Copilot.Copilot usesOpenAI Codex to suggest code snippets and functions in real-time,and it provedto be much more usable by middle-level/senior software engineers with a muchbetter quality code.Compared with just Googling whats needed to finish thecode,Copilot enables much faster
42、 workflows,so comes as a better alternative towhat ChatGPT can suggest at the moment.3.Building AI pipelines with the help of GPTModelsGiven that we know GPT models can complete the majority of NLP tasks,we canthink of it as an alternative to training your own language models.Following thistradition
43、,Ill provide the basics by questioning ChatGPT why it can be a betteroption than training a custom NLP model:Why is ChatGPT better than training your own NLP model?18It is important to realize the limitations of this approach.Since GPT models donot have access to real-time data,they can only help yo
44、u kickstart some servicewithout initial data gathering.Over time,youll be able to collect live data fromthe models interaction with the users,but this doesnt serve as a hotfix for allthe specific NLP tasks.Instead,we can think of other application areas in data science where GPTmodels can be used4.P
45、rocessing Table Data with ChatGPTIn order to build a classification,regression,or forecasting model,we need torun through exploratory data analysis(EDA)steps.EDA allows us to find therelationships between different features in data,and denote the insights andoutliers to understand the reason for thi
46、s or that anomalous behavior.So themajority of data science projects will require performing 4 steps:EDA PipelineWith the help of the GPT model,the above pipeline can be stripped down to asingle well-formulated request to the GPT model.For instance,lets use thisrequest about Amazon sales numbers by
47、quarters,and ask ChatGPT to extractinsights from this information.19Amazon sales ChatGPT responseAnd here,we can see what insights and conclusions ChatGPT came up with,based on the previously presented data:ChatGPT response:“Insights:Amazons net sales increased by 38%YoY in Q4In Q1,net sales increas
48、ed by 26%YoYin Q2 it increased by 40%YoYQ2 it increased by 40%YoY,and in Q3 it increased by 37%YoYConclusions(reasons):Its important to note that the COVID-19 pandemic had a significant impact onAmazons sales,as more people turned to online shopping while physicalstores were closed.Additionally,Amaz
49、ons AWS and Advertising segments alsohad significant growth in 2020.”20The output of the model can vary in quality,so it does require supervision orfinetuning of the initial prompt.However,such capabilities can be easily appliedto make the EDA stage easier and potentially automate data science pipel
50、inetasks.5.ChatGPT for recommendation systemsRecommendation systems or recommender engines have become as commonas search engines on various platforms and within various applications.Recommendations perform one very important task:understanding thepreferences of each customer,to suggest relevant con
51、tent and keep thecustomer on the platform as long as possible.But,despite competitive advantages recommender systems can provide,the factthat we cant build one without gathering data,experimenting and training aworking model appears to be a major reason why not everyone can affordrecommendations.To
52、start recommending,we generally need to collect dataconcerning our content first,and then methodically track what contentcategories our customers gravitate towards.In this situation,we can use ChatGPT as an alternative to recommendationengines,because it already has tons of data inside of it.While i
53、ts not fine tunedfor your content and it doesnt know your users search history,it can providefairly specific recommendations once we use specific enough prompts.For instance,we used this type of request:“I want to have a journey.I have a2-year-old kid and like to spend time near the sea.Where should
54、 I go?”.Here is theoutput:ChatGPT response:“Taking a trip with a 2-year-old and spending time near the seacan be a great idea.Here are a few suggestions for destinations that might be a goodfit for you and your family:The beaches of California:The beaches of California offer a great combinationof su
55、n,sand,and sea.Some popular destinations include Santa Monica,Huntington Beach,and Newport Beach.The beaches of Florida:Florida is home to many beautiful beaches,includingMiami Beach,Siesta Key,and Clearwater Beach.21The beaches of Hawaii:Hawaiis beaches are famous for their clear waters andsoft,whi
56、te sand.Some popular destinations include Waikiki Beach,KaanapaliBeach,and Poipu Beach.The beaches of the Caribbean:The Caribbean is home to many beautifulbeaches,including Seven Mile Beach in Jamaica,Eagle Beach in Aruba,andGrace Bay in Turks and Caicos.The beaches of the Mediterranean:Mediterranea
57、n countries like Spain,Greece,and Italy are home to many beautiful beaches.Some populardestinations include Playa de Muro in Mallorca,Mykonos in Greece,andPositano in Italy.Its worth noting that these destinations also offer a variety of other activities andattractions for both adults and children,s
58、uch as swimming,sunbathing,watersports,playgrounds and theme parks.Its also important to consider other factorssuch as weather,safety,and accessibility before making a decision.”If we specify our request by adding details,heres how the answer may look:Request:“I want to have a journey.I have a 2-yea
59、r-old kid and like to spend timenear the sea,I have 3000$.Where should I go?”.ChatGPT response:“Taking a trip with a 2-year-old and spending time near the sea can be a great idea.Its important to consider your budget when planning your trip.Here are a fewsuggestions for destinations that might be a
60、good fit for you and your family withinyour budget:The beaches of Mexico:Mexico offers a great combination of sun,sand,andsea.Some popular destinations include Cancun,Playa del Carmen,and PuertoVallarta.The beaches of Central America:Countries like Costa Rica,Panama,andNicaragua have beautiful beach
61、es,great weather and are budget-friendly.The beaches of Southeast Asia:Countries like Thailand,Vietnam,and thePhilippines have beautiful beaches,great weather and are budget-friendly.22The beaches of the Caribbean:Some Caribbean destinations such as theDominican Republic,Jamaica,and Cuba are budget-
62、friendly and havebeautiful beaches.Its worth noting that these destinations also offer a variety of other activities andattractions for both adults and children,such as swimming,sunbathing,watersports,playgrounds and theme parks.Also,when traveling with a 2-year-old,itsimportant to consider accessib
63、ility,safety,and the availability of good qualityaccommodation and services,such as good hospitals and childcare facilities.”As you can see the output isnt framed around parameters we provided as arequest,as the model tries to go past the initial prompt.And even those rawresults can perform better t
64、han trying to find content by applying dozens offilters,because it requires a human to use the right words to get satisfyingresults.Thats basically the major advantage of NLP-based recommendationsover standard approaches.6.Using ChatGPT for Computer Vision TasksSince GPT models are trained on text d
65、ata,its obvious we cant replacecomputer vision models this way.However,ChatGPT can simplify theimplementation of certain parts of the computer vision pipeline such as:Color detection for known imagesImage similarity,e.g.logos similar to MCDonalds by color or typographyObject detection,for instance i
66、dentifying the object depicted on photos,graphic materials,brand symbols,etc.ptical character recognition or OCRThe information provided by ChatGPT can be useful when analyzing andpreparing data for a computer vision model in different areas.For instance,inOCR tasks,the model can be used to drag tex
67、t from a picture,like in ID cardrecognition.This is a separate step in preparing data for training.23Polish IDSince ID cards have their own format and different fields in each country,thetask of recognizing ID cards can be very resource intensive.With GPT models,wecan reduce the time needed for extr
68、acting textual data from the images,sinceChatGPT can take some part of a pipeline on its own.Text fields of polish ID247.Your ChatGPT Business Case?If youve caught yourself thinking whether GPT models can cover your specificuse case,it is always better to discuss the integration with the professiona
69、ls.MobiDev has a vast experience in data science,machine learning and customlanguage models that operate in different business domains.We will provideyou with concise support on your project,handling both the development andbusiness part of a question.The Importance of Prompt Engineering andthe Futu
70、re of GPT ModelsPrompt engineering is basically the discipline of creating working input textthats passed to the GPT model like a technical task.The output will alwaysdepend on how you explain what you need,and it involves understanding whatsthe best way to point to each aspect of your request so th
71、at the model doesntproduce some Frankenstein for you.There are several basic principles of rapiddevelopment of GPT models:Be specific:the more specific the prompt,the more relevant the generated textwill be to the task at hand.Define the context:the more context the model has,the clearer the task fo
72、r theGPT model is.Set the prompt in the same language and in the same terminology(using thefeatures of the domain area)in which you want to receive an answer.Find a compromise between prompt length and specificity:longer and morespecific prompts can lead to more accurate and relevant answers,but als
73、ocomplicate model management.In some cases,complex and long prompts cantrigger the model to break and write an unfinished response,which we haveexperienced several times during our testing.25All the following examples were made exploiting ChatGPT on a pre-release stage,and it shows much better resul
74、ts than its predecessors.However,GPT 4 modelhas been announced by OpenAI in a first quarter of 2023,and it uses 500 x moredata samples then GPT 3.So it also makes sense to keep track of the releasedates and the situation is very dynamic and you might prefer future models byOpenAI for your product.Th
75、e comparison between training data using for GPT 3 and GPT 4 modelsThe main advantage of GPT models is the ability to find ways to solve a problemwithout an initial large volume of data.Obviously,such models cannot replacethe desired functionality completely.However,in the first iterations of theproduct,the use of such models helps to start development,providing userswith a service while collecting custom data.26