Llama (another Large Language Model) and GPT comparison

DOWLOAD-DESKTOP-NOTEBOOK.nb (99.2 KB)
GPT-via-API.wl (4.21 KB)

8 Likes

Note, that the question in the riddle section:

What 3 numbers give the same result when multiplied and added together? (Answer 1,2,3)

has of course and infinite number of other answers, such as -1,0,1
as -1+0+1=0 and -101=0
which both models have missed. In fact for any k which is integer the numbers -k,0,k will work.

Mathematica can find all of these solutions with

Solve[a + b + c == a*b*c, {a, b, c}, Integers]

(*{{c -> ConditionalExpression[(a + b)/(-1 + a b), Or[
And[
Element[
Alternatives[a, b, (a + b)/(-1 + a b)], Integers], a >= 1, b > 
      a^(-1)], 
And[
Element[
Alternatives[a, b, (a + b)/(-1 + a b)], Integers], a >= 1, b < 
      a^(-1)], 
And[
Element[
Alternatives[a, b, (a + b)/(-1 + a b)], Integers], b < a^(-1), 
      a <= -1], 
And[
Element[
Alternatives[a, b, (a + b)/(-1 + a b)], Integers], a <= -1, b > 
      a^(-1)]]]}, {a -> 
   ConditionalExpression[0, (b | b) \[Element] Integers], 
  c -> ConditionalExpression[-b, (b | b) \[Element] Integers]}}*)

combining GPT-4 with the Mathematica Kernel via LLMTools like so

tool = LLMTool[{"runCode", "Run Wolfram Language code"}, "code", 
  If[ChoiceDialog["Run this code?\n\n" <> #code], 
    ToString[ToExpression[#code], InputForm], "Code not allowed"] &]

LLMSynthesize["What 3 Integers give the same result when multiplied \
and added together? Find all solutions. Use the tool.", All, 
 LLMEvaluator -> <|"Tools" -> tool|>]

This will produce a longer output, which after some tool call, contains the right answer.

Cheers,
Marco

2 Likes

news-congrads-kkluyshnik-02-04-19.jpg – you have earned Featured Contributor Badge 2015-11-02_10-07-11.png
Your exceptional post has been selected for our editorial column Staff Picks http://wolfr.am/StaffPicks and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!

1 Like

Hi Everyone,

there is an updated version the functions and additional functionality available via my newer posts such as Google’s Gemini - API access from the Wolfram Language and Mistral AI via the API in the Wolfram Language

Please have a look there for more on LLMs in MMA.

Cheers,
Marco