You have 2 free member-only stories left this month.

GPT-3: Creative Potential of NLP

New ML milestone by OpenAI — in action

Image for post
Image for post
Photo: Merzmensch

It was last year in February, as OpenAI published results on their training of unsupervised language model GPT-2. Trained in 40Gb texts (8 Mio websites) and was able to predict words in proximity. GPT-2, a transformer-based language applied to self-attention, allowed us to generated very convincing and coherent texts. The quality was that good, so the main model with 1.5 billion parameters wasn’t initially publicly accessible, to prevent uncontrolled fake news. Luckily, the complete model was later published and could be even used with Colab Notebooks.

This year OpenAI strikes back with new language model GPT-3. With 175 billion parameters (read also: GPT-3 Paper).
Unnecessary spoiler: it’s incredibly good.

There are already some profound articles on TDS examining features and paper of GPT-3:

But how does it look like in action?

OpenAI is building an API, currently accessible via waiting list:

Fortunately, I could get access and experiment with GPT-3 directly. Here are some of my initial outcomes.

Interface, Settings, Presets.

Image for post
Image for post
Screenshot: beta.openai.com // by: Merzmensch

The AI Playground interface looks simple, but it bears the power within. For the first, here is a setting dialog, which lets you configure text length, temperature (from low/boring to standard to chaotic/creative), and other features.

Image for post
Image for post
Screenshot: beta.openai.com // by: Merzmensch

You also can define where the generated text has to start and to stop, these are some of the control functions that have a direct impact on textual results.

The simple interface provides also some GPT-3 presets. The amazing thing about transformer-driven GPT-models is among others the ability to recognize a specific style, text character, or structure. In case you begin with lists, GPT-3 continues generating lists. In case your prompt has a Q&A structure, it will be kept coherently. If you ask for a poem, it writes a poem.

You can do your own presets, or use the existing, which are:

Chat.

Image for post
Image for post
Screenshot: beta.openai.com // by: Merzmensch

A typical setting for a chatbot. You ask - AI answers. It’s possible to change the “characters” or setting also. As you can see, the chat situation was accomplished perfectly (even if my, Human’s, third question was kind of unfair).

Image for post
Image for post
Screenshot: beta.openai.com // by: Merzmensch

To demonstrate the contextual impact, let’s change the AI character from “helpful” and “very friendly” to “brutal, stupid and very unfriendly”. You will see how the whole dialogue will be influenced:

Image for post
Image for post
Screenshot: beta.openai.com // by: Merzmensch

I think, we re-invented Marvin the Paranoid Android.

Q&A

Image for post
Image for post
Screenshot: beta.openai.com // by: Merzmensch

This preset consists of a clear dual structure: Question and Answer. You need some training before it starts to answer the question (and get the rules), but then it works perfectly. I asked some random questions from various areas and here you go:

Image for post
Image for post
Screenshot: beta.openai.com // by: Merzmensch

I’d say, perfect!

Parsing unstructured data

Image for post
Image for post
Screenshot: beta.openai.com // by: Merzmensch

This one is fascinating and shows a good comprehension of the unstructured text — extracting structured data from the full text.

Summarizing for a 2nd grader

This preset shows another level of comprehension — including rephrasing of difficult concepts and sentences in clear words.

I tried Wittgenstein:

Image for post
Image for post
Screenshot: beta.openai.com // by: Merzmensch

The simple proverb can be paraphrased convincingly:

Image for post
Image for post
Screenshot: beta.openai.com // by: Merzmensch

Or look at this pretty well and clear transition of Sigmund Freud’s time distancing concept:

Image for post
Image for post
Screenshot: beta.openai.com // by: Merzmensch

As you see, compression of text and its coherent “translation” is one of the strengths of GPT-3.

What about languages?

GPT-2 was already a great language model when it was about English. You could generate amazing texts, especially with 1.5 billion parameters. I used GPT-2 for a screenplay of this short movie — and its absurdity could be rather understood as a good tradition of David Lynch and Beckett:

The dialogues were logical, even if spontaneous. But it was regarding English. If you’ve tried with inputs in other languages, you would face the barrier of understanding. GPT-2 tried to imitate languages, but you needed to fine-tune it on text corpus in a specific language to get good results.

GPT-3 is different.

Its processing in other languages is phenomenal.

I tried German, Russian, and Japanese.

German.

It was rather my daughter, who tried to let GPT-3 write a fairy tale. She began with “Eine Katze mit Flügeln ging im Park spazieren” (“A cat with wings took a walk in a park”).

Image for post
Image for post
Here is the full text.

The emerged story was astonishingly well written. With irony, vivid characters, and some leitmotifs. This is not just a collection of topoi or connected sentences. This is… a story!

Russian.

Image for post
Image for post
The full text is here.

I trained once GPT-2 on Pushkin’s poetry and have got some interesting neologisms, but it was a grammar mess. Here I input some lines of Pushkin’s poem — and the result I’ve got was… interesting. It hadn’t rhymes, but stylistically intense power. It was not Pushkin style, though. But almost without any mistakes or weird grammar. And… it works as poetry (especially if you are ready to interpret it).

Japanese.

Image for post
Image for post
Full text here.

This was something special. I entered just a random sentence:

今日は楽しい一日になりますように!と言いました。// Today was funny and entertaining day, I said.

And the result was a small story about prayer, happiness, wisdom, and financial investment. In well written Japanese (neutral politeness form, like the input).

It does mean: GPT-3 is ready for multilingual text processing.

Various experiments (and alerting signals).

ShakespAIre and writing poems

My first try was, of course, to write a Shakespearean sonnet. So the prompt was just:

here is a poem by Shakespeare

The result was this:

Image for post
Image for post
Screenshot: beta.openai.com // by: Merzmensch

Perfect iambic verse, great style, nice rhymes… If not one thing:

The first two lines are actually from Alexander Pope, The Rape of the Lock. And here we have a reason to be cautious: GPT-3 produces unique and unrepeatable texts, but it can reuse the whole quotes of existing texts it was trained on.

Re-examination of results is inevitable if you want to guarantee a singularity of a text.

I wonder, if there are some possibilities for “Projection” like StyleGAN2 feature, just in opposite to StyleGAN2 (where it compares the image with latent space), in GPT-3 it would compare with the dataset it was trained on? To prevent accidental plagiarism.

But the thing is: GPT-3 can write poems on demand, in particular styles.

Here is another example:

Essays

As I still hadn’t accessed, I asked a friend to let GPT-3 write an essay on Kurt Schwitters, a German artist, and Dadaist:

The outcome is: GPT-3 has already a rich knowledge, which can be recollected. It is not always reliable (you have to fine-tune it to have a perfect meaning match), but it’s still very close to the discourse.

Coding with GPT-3

Another mindblowing possibility is using GPT-3 is quite different cases than just text generation:

You can get support by CSS:

And calling it General Intelligence is already a thing:

Summary.

We are still at the beginning, but the experiments with GPT-3 made by the AI community show its power, potential, and impact. We just have to use it with reason and good intention. But that’s the human factor. Which is not always the best one.

For more wonderful text experiments I highly recommend you to read Gwern:

Let the journey continue!

Sign up for The Daily Pick

By Towards Data Science

Hands-on real-world examples, research, tutorials, and cutting-edge techniques delivered Monday to Thursday. Make learning your daily ritual. Take a look

By signing up, you will create a Medium account if you don’t already have one. Review our Privacy Policy for more information about our privacy practices.

Check your inbox
Medium sent you an email at to complete your subscription.

A Medium publication sharing concepts, ideas, and codes.

Fatal police shootings between 2015 and 2020.

Image for post
Image for post
Photo by Gabriel on Unsplash

The Washington Post has released a dataset containing fatal shootings by police in the US between 2015 and 2020. In the midst of racism discussions, this dataset is likely to shed light on the current situation.

We will use data analysis tools and techniques to reveal some numbers that summarize the dataset. This post is aimed to be a practical guide of data analysis and a discussion that approaches police shootings in the US from many perspectives.

The dataset is available in this repo by the Washington Post. …


Animated maps, racing bar charts, and Python merges, oh my!

Image for post
Image for post
Mapping the spread of COVID-19 cases from its initial outbreak in the U.S. to July 1, 2020. GIF by author.

This project arose out of an interest to visualize how COVID-19 hotspots have shifted over the course of the unfolding pandemic. Ever since watching this video, I’ve been interested in time-based animations like the “racing bar chart” shown in the video, as well as animated maps.

Since COVID outbreaks are highly linked to geography, I’m going to create some animated maps and racing bar charts to see what we can learn. …


Ganna Pogrebna in conversation with Briana Brownell — The chapters of her data science journey, impactful projects and current work in health care

Image for post
Image for post

Academic, Educator, Consultant, and Blogger Ganna Pogrebna started Data Driven Chat to explore the many interesting aspects of behavioural data science including human behaviour, data science and AI. Ganna Pogrebna is Professor of Behavioral Analytics and Data Science and a Lead of Behavioral Data Science strand at the Alan Turing Institute — the national centre for AI and Data Science in London (UK). The Data Driven Chat is the official podcast of the Behavioral Data Science Special Interest Group at Turing.

Data scientist turned tech entrepreneur Briana Brownell is the founder and CEO of Pure Strategy Inc. Using the leading edge technology in natural language processing, machine learning and neural networks Pure Strategy’s Automated Neural Intelligence Engine (ANIE) gives organizations the insights needed to make decisions confidently.


An introduction to time series, and basic concepts and modelling techniques related to time series analysis and forecasting.

Image for post
Image for post
Image by author

Time-series forecasting is one of the important areas of machine learning. This is very important when it comes to prediction problems that involve a time component.

These days I am doing my project task based on time series analysis and forecasting. So, I did some research on this area and thought it would be beneficial to me and also people who are getting started with time series forecasting to make those findings in some documented manner.

The purpose of this article is to give an introduction to time series, and basic concepts and modelling techniques related to time series analysis and forecasting. …


Learning how Gaussian distributions and the properties they have can help us perform anomaly detection on monitored data.

Image for post
Image for post
Using the Gaussian distribution for anomaly detection (image by author)

In the first article of this series, we’ve discussed the properties of the Gaussian function and how they can be used to detect anomalies in monitored data. In this part, we will be putting that knowledge to practice and build our very own anomaly detection program.

To recap, we finished the previous article with the Gaussian function in the graph above, on which two points mark different values a given data sample x might take. We then stated that the farther away x is from the mean, the higher the probability it represents an anomaly.

Two points p(x1) and p(x2) plotted on a Gaussian function g(x)
Two points p(x1) and p(x2) plotted on a Gaussian function g(x)
Two points p(x1) and p(x2) plotted on a Gaussian function g(x) (image by author)

The only problem in that statement is that the probability of getting any single value is precisely zero. Why is that? It turns out that the Gaussian function is a member of a group of functions calls “Probability Density Functions”, or PDF’s for short. Without diving too deep into the mathematics behind PDFs, it suffices to understand that they give us the probability of a “continuous random variable” yielding a value within a given “range”. …


Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store