Professional Documents
Culture Documents
Chatgpt Gets Its "Wolfram Superpowers"!-Stephen Wolfram Writings
Chatgpt Gets Its "Wolfram Superpowers"!-Stephen Wolfram Writings
RECENT | CATEGORIES |
Contents
Search Writings
See also:
“What Is ChatGPT Doing … and Why Does It Work?” »
Recent Writings
ChatGPT Gets Its “Wolfram Superpowers”! Aggregation and Tiling as
March 23, 2023 Multicomputational Processes
November 3, 2023
This is part of an ongoing series about our LLM-related technology: How to Think Computationally about AI,
ChatGPT Gets Its “Wolfram Superpowers”! the Universe and Everything
Instant Plugins for ChatGPT: Introducing the Wolfram ChatGPT Plugin Kit October 27, 2023
The New World of LLM Functions: Integrating LLM Technology into the Wolfram Language
Prompts for Work & Play: Launching the Wolfram Prompt Repository Expression Evaluation and Fundamental
Introducing Chat Notebooks: Integrating LLMs into the Notebook Paradigm Physics
September 29, 2023
All by date »
Popular Categories
Artificial Intelligence
Big Picture
Companies & Business
Computational Science
Computational Thinking
Data Science
To enable the functionality described here, select and install the Wolfram plugin from Education
within ChatGPT. Future Perspectives
Note that this capability is so far available only to some ChatGPT Plus users; for more Historical Perspectives
information, see OpenAI’s announcement. Language & Communication
Life & Times
Life Science
Mathematica
In Just Two and a Half Months… Mathematics
New Kind of Science
Early in January I wrote about the possibility of connecting ChatGPT to Wolfram|Alpha. And today—
New Technology
just two and a half months later—I’m excited to announce that it’s happened! Thanks to some heroic Personal Analytics
software engineering by our team and by OpenAI, ChatGPT can now call on Wolfram|Alpha—and Philosophy
Wolfram Language as well—to give it what we might think of as “computational superpowers”. It’s still Physics
Ruliology
very early days for all of this, but it’s already very impressive—and one can begin to see how
Software Design
amazingly powerful (and perhaps even revolutionary) what we can call “ChatGPT + Wolfram” can be. Wolfram|Alpha
Back in January, I made the point that, as an LLM neural net, ChatGPT—for all its remarkable Wolfram Language
prowess in textually generating material “like” what it’s read from the web, etc.—can’t itself be Other
expected to do actual nontrivial computations, or to systematically produce correct (rather than just
“looks roughly right”) data, etc. But when it’s connected to the Wolfram plugin it can do these things.
Writings by Year
So here’s my (very simple) first example from January, but now done by ChatGPT with “Wolfram
2023 2022 2021 2020 2019 2018 2017
superpowers” installed:
2016 2015 2014 2013 2012 2011 2010
2009 2008 2007 2006 2004 2003 All
It’s a correct result (which in January it wasn’t)—found by actual computation. And here’s a bonus:
immediate visualization:
How did this work? Under the hood, ChatGPT is formulating a query for Wolfram|Alpha—then
sending it to Wolfram|Alpha for computation, and then “deciding what to say” based on reading the
results it got back. You can see this back and forth by clicking the “Used Wolfram” box (and by looking
at this you can check that ChatGPT didn’t “make anything up”):
There are lots of nontrivial things going on here, on both the ChatGPT and Wolfram|Alpha sides. But
the upshot is a good, correct result, knitted into a nice, flowing piece of text.
Let’s try another example, also from what I wrote in January:
A fine result, worthy of our technology. And again, we can get a bonus:
In January, I noted that ChatGPT ended up just “making up” plausible (but wrong) data when given
this prompt:
But now it calls the Wolfram plugin and gets a good, authoritative answer. And, as a bonus, we can also
make a visualization:
Another example from back in January that now comes out correctly is:
If you actually try these examples, don’t be surprised if they work differently (sometimes better,
sometimes worse) from what I’m showing here. Since ChatGPT uses randomness in generating its
responses, different things can happen even when you ask it the exact same question (even in a fresh
session). It feels “very human”. But different from the solid “right-answer-and-it-doesn’t-change-if-
you-ask-it-again” experience that one gets in Wolfram|Alpha and Wolfram Language.
Here’s an example where we saw ChatGPT (rather impressively) “having a conversation” with the
Wolfram plugin, after at first finding out that it got the “wrong Mercury”:
One particularly significant thing here is that ChatGPT isn’t just using us to do a “dead-end” operation
like show the content of a webpage. Rather, we’re acting much more like a true “brain implant” for
ChatGPT—where it asks us things whenever it needs to, and we give responses that it can weave back
into whatever it’s doing. It’s rather impressive to see in action. And—although there’s definitely much
more polishing to be done—what’s already there goes a long way towards (among other things) giving
ChatGPT the ability to deliver accurate, curated knowledge and data—as well as correct, nontrivial
computations.
But there’s more too. We already saw examples where we were able to provide custom-created
visualizations to ChatGPT. And with our computation capabilities we’re routinely able to make “truly
original” content—computations that have simply never been done before. And there’s something else:
while “pure ChatGPT” is restricted to things it “learned during its training”, by calling us it can get up-
to-the-moment data.
This can be based on our real-time data feeds (here we’re getting called twice; once for each place):
Or both:
And, yes, by “opening the box” one can check that the right question was asked to us, and what the
raw response we gave was. But now we can go on and ask for a map:
But there are “prettier” map projections we could have used. And with ChatGPT’s “general
knowledge” based on its reading of the web, etc. we can just ask it to use one:
But maybe we want a heat map instead. Again, we can just ask it to produce this—underneath using
our technology:
Let’s change the projection again, now asking it again to pick it using its “general knowledge”:
And, yes, it got the projection “right”. But not the centering. So let’s ask it to fix that:
OK, so what do we have here? We’ve got something that we “collaborated” to build. We incrementally
said what we wanted; the AI (i.e. ChatGPT + Wolfram) progressively built it. But what did we actually
get? Well, it’s a piece of Wolfram Language code—which we could see by “opening the box”, or just
asking ChatGPT for:
If we copy the code out into a Wolfram Notebook, we can immediately run it, and we find it has a nice
“luxury feature”—as ChatGPT claimed in its description, there are dynamic tooltips giving the name of
each country:
(And, yes, it’s a slight pity that this code just has explicit numbers in it, rather than the original
symbolic query about beef production. And this happened because ChatGPT asked the original
question to Wolfram|Alpha, then fed the results to Wolfram Language. But I consider the fact that this
whole sequence works at all extremely impressive.)
Say “Use Wolfram”, though, and it’ll send it to the Wolfram plugin, which indeed handles it nicely:
(You may sometimes also want to say specifically “Use Wolfram|Alpha” or “Use Wolfram Language”.
And particularly in the Wolfram Language case, you may want to look at the actual code it sent, and
tell it things like not to use functions whose names it came up with, but which don’t actually exist.)
When the Wolfram plugin is given Wolfram Language code, what it does is basically just to evaluate
that code, and return the result—perhaps as a graphic or math formula, or just text. But when it’s
given Wolfram|Alpha input, this is sent to a special Wolfram|Alpha “for LLMs” API endpoint, and the
result comes back as text intended to be “read” by ChatGPT, and effectively used as an additional
prompt for further text ChatGPT is writing. Take a look at this example:
The result is a nice piece of text containing the answer to the question asked, along with some other
information ChatGPT decided to include. But “inside” we can see what the Wolfram plugin (and the
Wolfram|Alpha “LLM endpoint”) actually did:
There’s quite a bit of additional information there (including some nice pictures!). But ChatGPT
“decided” just to pick out a few pieces to include in its response.
By the way, something to emphasize is that if you want to be sure you’re getting what you think
you’re getting, always check what ChatGPT actually sent to the Wolfram plugin—and what the plugin
returned. One of the important things we’re adding with the Wolfram plugin is a way to “factify”
ChatGPT output—and to know when ChatGPT is “using its imagination”, and when it’s delivering solid
facts.
Sometimes in trying to understand what’s going on it’ll also be useful just to take what the Wolfram
plugin was sent, and enter it as direct input on the Wolfram|Alpha website, or in a Wolfram Language
system (such as the Wolfram Cloud).
And the critical point is that the “code” is something one can realistically expect to read (if I were
writing it, I would use the slightly more compact RomanNumeral function):
It’s often possible to use a pidgin of Wolfram Language and English to say what you want:
And, by the way, to make this work it’s critical that the Wolfram Language is in a sense “self-
contained”. This piece of code is just standard generic Wolfram Language code; it doesn’t depend on
anything outside, and if you wanted to, you could look up the definitions of everything that appears in
it in the Wolfram Language documentation.
OK, one more example:
Obviously ChatGPT had trouble here. But—as it suggested—we can just run the code it generated,
directly in a notebook. And because Wolfram Language is symbolic, we can explicitly see results at
each step:
So close! Let’s help it a bit, telling it we need an actual list of European countries:
And there’s the result! Or at least, a result. Because when we look at this computation, it might not be
quite what we want. For example, we might want to pick out multiple dominant colors per country,
and see if any of them are close to purple. But the whole Wolfram Language setup here makes it easy
for us to “collaborate with the AI” to figure out what we want, and what to do.
So far we’ve basically been starting with natural language, and building up Wolfram Language code.
But we can also start with pseudocode, or code in some low-level programming language. And
ChatGPT tends to do a remarkably good job of taking such things and producing well-written Wolfram
Language code from them. The code isn’t always exactly right. But one can always run it (e.g. with the
Wolfram plugin) and see what it does, potentially (courtesy of the symbolic character of Wolfram
Language) line by line. And the point is that the high-level computational language nature of the
Wolfram Language tends to allow the code to be sufficiently clear and (at least locally) simple that
(particularly after seeing it run) one can readily understand what it’s doing—and then potentially
iterate back and forth on it with the AI.
When what one’s trying to do is sufficiently simple, it’s often realistic to specify it—at least if one does
it in stages—purely with natural language, using Wolfram Language “just” as a way to see what one’s
got, and to actually be able to run it. But it’s when things get more complicated that Wolfram Language
really comes into its own—providing what’s basically the only viable human-understandable-yet-
precise representation of what one wants.
And when I was writing my book An Elementary Introduction to the Wolfram Language this became
particularly obvious. At the beginning of the book I was easily able to make up exercises where I
described what was wanted in English. But as things started getting more complicated, this became
more and more difficult. As a “fluent” user of Wolfram Language I usually immediately knew how to
express what I wanted in Wolfram Language. But to describe it purely in English required something
increasingly involved and complicated, that read like legalese.
But, OK, so you specify something using Wolfram Language. Then one of the remarkable things
ChatGPT is often able to do is to recast your Wolfram Language code so that it’s easier to read. It
doesn’t (yet) always get it right. But it’s interesting to see it make different tradeoffs from a human
writer of Wolfram Language code. For example, humans tend to find it difficult to come up with good
names for things, making it usually better (or at least less confusing) to avoid names by having
sequences of nested functions. But ChatGPT, with its command of language and meaning, has a fairly
easy time making up reasonable names. And although it’s something I, for one, did not expect, I think
using these names, and “spreading out the action”, can often make Wolfram Language code even
easier to read than it was before, and indeed read very much like a formalized analog of natural
language—that we can understand as easily as natural language, but that has a precise meaning, and
can actually be run to generate computational results.
Another “old chestnut” for Wolfram|Alpha is math word problems. Given a “crisply presented” math
problem, Wolfram|Alpha is likely to do very well at solving it. But what about a “woolly” word
problem? Well, ChatGPT is pretty good at “unraveling” such things, and turning them into “crisp math
questions”—which then the Wolfram plugin can now solve. Here’s an example:
Here’s a slightly more complicated case, including a nice use of “common sense” to recognize that the
number of turkeys cannot be negative:
Beyond math word problems, another “old chestnut” now addressed by ChatGPT + Wolfram is what
physicists tend to call “Fermi problems”: order-of-magnitude estimates that can be made on the basis
of quantitative knowledge about the world. Here’s an example:
Posted in: Artificial Intelligence, Mathematica, New Technology, Wolfram Language, Wolfram|Alpha
+ 16 comments
Related Writings
How to Think Computationally about Expression Evaluation and
AI, the Universe and Everything Fundamental Physics
October 27, 2023 September 29, 2023