LLM
LLM
Large Language Model
GPT-2 is so small that we can run it in a local machine, it is available at Wolfram NN repo:
In[]:=
llm=NetModel[{"GPT2 Transformer Trained on WebText Data","Task"->"LanguageModeling"}]
Out[]=
NetChain
We can try to guess the next text token:
In[]:=
llm["Gosto de esportes radicais porque"]
Out[]=
es
We can check the 15 best possibilities for the next sentence word (token) LLM style:
llm["At harvard I am going to study",{"TopProbabilities",15}]%//ColumnPieChart[Values[%%],ChartLabels->Keys[%%]]
Now in a LOOP... we can try to complete the sentences by the next 20 tokens:
In[]:=
generateSample[languagemodel_][input_String,numTokens_:10,temperature_:1]:=Nest[Function[StringJoin[#,llm[#,{"RandomSample","Temperature"->temperature}]]],input,numTokens];
In[]:=
generateSample[llm]["Albert Einstein was a German-born theoretical physicist",20]
Out[]=
Albert Einstein was a German-born theoretical physicist, with close records in physics and his institute of physics was the German Foundation for Archival Research,
In[]:=
generateSample[llm]["Sonia Braga é uma atriz brasileira famosa por",20]
Out[]=
Sonia Braga é uma atriz brasileira famosa por contease de ses innisateurs : verísquina informazione prrigava
The Next Word...
The Next Word...
Getting another model we can run locally in our PC:
In[]:=
llm2=NetModel[{"GPT Transformer Trained on BookCorpus Data","Task"->"LanguageModeling"}]
Out[]=
NetChain
In[]:=
Information[llm2]
Out[]=
We can again try to guess the next word (token):
In[]:=
llm2["I never gonna let you "]
Out[]=
go
In[]:=
llm2["You say, Yes, I say, No. You say, Stop and I say, "]
Out[]=
stop
In[]:=
llm2["The book is on the "]
Out[]=
table
In[]:=
llm2["Where have you "]
Out[]=
been
In[]:=
llm2["Scooby Dooby "]
Out[]=
.
In[]:=
llm2["Be or not to be this is the "]
Out[]=
same
In[]:=
llm2["At the grossery store I buy "]
Out[]=
a
OpenAI API integration
OpenAI API integration
The newer algorithms GPT-3.5 and GPT-4 that run on the cloud because they are giant (Big data) and can’t run on our local PC, we have better results.
In[]:=
LLMResourceFunction["Emojify"]["For what shall it profit a man, if he shall gain the whole world, and lose his own soul?"]
Out[]=
For what shall it profit a man, if he shall gain the 🌍, and lose his own 😇?
In[]:=
LLMSynthesize[{LLMPrompt["PoemVersion"],LLMPrompt["Emojify"]["Roses are red, violets are blue."]}]
Out[]=
In colors splendid, nature's true delight,Roses bloom and violets shine so bright.🌹🌺🌹🌺With petals gentle, crimson and pure,A love story written, love that endures.❤️💑💞As dawn's light breaks, on a new day's morn,Blooming roses, a beauty finely born.🌅🌹🌷🌞And violets, lovely as the twilight sky,Together, they paint a heartfelt lullaby.🌃🌹🌸🎶Love's symphony, harmonious and grand,In every petal, emotions understand.💞🎵🌹While roses whisper secrets, love's embrace,Violets add their charm with gentle grace.🌹💬💕🌸Their vibrant hues, emotions softly speak,Of passion, affection, love pure and meek.❣️🎨💬😌So let these flowers, in verse, portray,Love's magic, that forever may stay.🌹🌸✍️💖
Those cloud integration to OpenAI APIs brings synthesis algorithms for images too:
CHAT NOTEBOOKS
You can use those chat notebooks on Mathematica client for Mac, Windows or Linux:
File ▶ New ▶ Chat–Enabled Notebook
File ▶ New ▶ Chat–Driven Notebook
File ▶ New ▶ Chat–Driven Notebook
ChatGPT Plus: Wolfram Plugin
ChatGPT Plus: Wolfram Plugin
Those are resources from OpenAI, not from Wolfram, but integrated with Wolfram tech.
◼
Open - GPT-3 (Gratuito - free)
◼
ChatGPT Plus - Browser - GPT-4 (US$ 20.00 ao mês pago anualmente - monthly price paid annually)
◼
API (Pré-pago, cobrança por token) - Prazo de teste...
AI technology has been super fashionable these last few months. Wolfram AI technology has been a reality for a long time.
For subscribers of OpenAI’s ChatGPT Plus ($20.00 month), the Wolfram plugin is available, with access to accurate data from Wolfram Alpha, code generation in Wolfram Language. ChatGPT is very bad at calculation, now the problem is solved. Furthermore, ChatGPT does not have updated data, it works with previously trained data. Now he has access to updated data on weather, stocks, maps, elevation, flights, countries, history, etc... In addition to sophisticated algorithms including ML and AI. Top virtual assistants make calls to Wolfram “behind the scenes” and now ChatCPT does too.
ChatGPT Gets Its “Wolfram Superpowers”!
https://writings.stephenwolfram.com/2023/03/chatgpt-gets-its-wolfram-superpowers/
AI technology has been super fashionable these last few months. Wolfram AI technology has been a reality for a long time.
For subscribers of OpenAI’s ChatGPT Plus ($20.00 month), the Wolfram plugin is available, with access to accurate data from Wolfram Alpha, code generation in Wolfram Language. ChatGPT is very bad at calculation, now the problem is solved. Furthermore, ChatGPT does not have updated data, it works with previously trained data. Now he has access to updated data on weather, stocks, maps, elevation, flights, countries, history, etc... In addition to sophisticated algorithms including ML and AI. Top virtual assistants make calls to Wolfram “behind the scenes” and now ChatCPT does too.
ChatGPT Gets Its “Wolfram Superpowers”!
https://writings.stephenwolfram.com/2023/03/chatgpt-gets-its-wolfram-superpowers/
Cooking recipes with GPT-3, Dall-e and the Wolfram Language
https://community.wolfram.com/groups/-/m/t/2848741
For GPT-3.5 and GPT-4 we have integration with the OpenAI API in the cloud with a Packet, in this case you need an OpenAI key for your access:
https://resources.wolframcloud.com/PacletRepository/resources/ChristopherWolfram/OpenAILink/
https://community.wolfram.com/groups/-/m/t/2848741
For GPT-3.5 and GPT-4 we have integration with the OpenAI API in the cloud with a Packet, in this case you need an OpenAI key for your access:
https://resources.wolframcloud.com/PacletRepository/resources/ChristopherWolfram/OpenAILink/
GPT-4 Training
GPT-4 Training
Training cost US$ 4M to US$ 6M
4 Weeks at the cloud to process
Big Data from:
- WEB (HTML, TXT, etc...)
- Wikipedia
- Reddit (mídia sócial)
- Books digitalized
Bloomberg: Did training on your knowledge base - BloombergGPT: A Large Language Model for Finance
https://www.bloomberg.com/company/press/bloomberggpt-50-billion-parameter-llm-tuned-finance/
Big techs can handle that! To train, maintain and process LLMs. Other companies will consume WEB API to integrate it with their systems, data and knowledgebase.
4 Weeks at the cloud to process
Big Data from:
- WEB (HTML, TXT, etc...)
- Wikipedia
- Reddit (mídia sócial)
- Books digitalized
Bloomberg: Did training on your knowledge base - BloombergGPT: A Large Language Model for Finance
https://www.bloomberg.com/company/press/bloomberggpt-50-billion-parameter-llm-tuned-finance/
Big techs can handle that! To train, maintain and process LLMs. Other companies will consume WEB API to integrate it with their systems, data and knowledgebase.
AI Hype
AI Hype
To learn more
References
References
Online Books
Online Books
◼
An Elementary Introduction to the Wolfram Language
https://www.wolfram.com/language/elementary-introduction/2nd-ed/
https://www.wolfram.com/language/elementary-introduction/2nd-ed/
◼
◼
What Is ChatGPT Doing … and Why Does It Work?
https://writings.stephenwolfram.com/2023/02/what-is-chatgpt-doing-and-why-does-it-work/
https://writings.stephenwolfram.com/2023/02/what-is-chatgpt-doing-and-why-does-it-work/
◼
Query: Getting information from data with the Wolfram Language
https://www.wolfram.com/language/query-getting-information-from-data-with-the-wolfram-language/
https://www.wolfram.com/language/query-getting-information-from-data-with-the-wolfram-language/
Explore...
Explore...
Wolfram Language: INTRODUÇÃO RÁPIDA PARA PROGRAMADORES
https://www.wolfram.com/language/fast-introduction-for-programmers/pt-br/?source=footer
https://www.wolfram.com/language/fast-introduction-for-programmers/pt-br/?source=footer
Mathematica e Wolfram Language INTRODUÇÃO RÁPIDA PARA ESTUDANTES DE MATEMÁTICA
https://www.wolfram.com/language/fast-introduction-for-math-students/pt-br/?source=footer
https://www.wolfram.com/language/fast-introduction-for-math-students/pt-br/?source=footer
Wolfram Language hands on at Wolfram Cloud
NOW!
Wolfram Language hands on at Wolfram Cloud
NOW!
NOW!
www.wolframcloud.com
- Numerical Computation
https://www.conradwolfram.com/writings/covid19-excel07
https://floating-point-gui.de/
- Expressions
https://reference.wolfram.com/language/tutorial/Expressions.html#4715
https://reference.wolfram.com/language/guide/Expressions.html
- Symbolic Computation
https://reference.wolfram.com/language/tutorial/SymbolicCalculations.html
https://reference.wolfram.com/language/tutorial/AlgebraicCalculations.html#29942
- Functional Programming
https://reference.wolfram.com/language/tutorial/FunctionalOperations.html#17469
https://reference.wolfram.com/language/guide/FunctionalProgramming.html
- Numerical Computation
https://www.conradwolfram.com/writings/covid19-excel07
https://floating-point-gui.de/
- Expressions
https://reference.wolfram.com/language/tutorial/Expressions.html#4715
https://reference.wolfram.com/language/guide/Expressions.html
- Symbolic Computation
https://reference.wolfram.com/language/tutorial/SymbolicCalculations.html
https://reference.wolfram.com/language/tutorial/AlgebraicCalculations.html#29942
- Functional Programming
https://reference.wolfram.com/language/tutorial/FunctionalOperations.html#17469
https://reference.wolfram.com/language/guide/FunctionalProgramming.html
Final Thoughts
Final Thoughts
AI is here to stay!
There is a hype!
Lots of possibilities!
Academia and big techs heading the field!
There is a hype!
Lots of possibilities!
Academia and big techs heading the field!
◼
Experiment - CODE
◼
Read & Learn
◼
Share - Community
◼
Turn your idea into a startup and generate value
◼
Surf this wave
Wolfram Summer School
Wolfram Summer School
Wolfram Summer School
Explore and create projects at the frontiers of science, technology and innovation
https://education.wolfram.com/summer-school
Explore and create projects at the frontiers of science, technology and innovation
https://education.wolfram.com/summer-school
CITE THESE NOTEBOOKS
CITE THESE NOTEBOOKS
Warm-up workshop: Foundations of Wolfram Language, IA, ML, and LLMs
by Daniel Carvalho
Wolfram Community, STAFF PICKS, November 9, 2023
https://community.wolfram.com/groups/-/m/t/3062527
by Daniel Carvalho
Wolfram Community, STAFF PICKS, November 9, 2023
https://community.wolfram.com/groups/-/m/t/3062527