37 ms·
The Languages of English, Math, and Programming
- owenpalmer 2y agoA formal notation for reasoning could possibly solve some reasoning issues for LLMs. Perhaps something like Lojban or symbolic logic. We don't have a lot of data for it, but it might be possible to synthetically generate it. On a dark note, I wonder if increasing AI reasoning capability could have dangerous results. Currently, LLMs are relatively empathetic, and seem to factor the complex human experience into it's responses. Would making LLMs more logical, cold, and calculating result in them stepping on things which humans care about?
- Jianghong94 2y agoDue to the extreme data quantity requirement for pre-training, LLM effectively locks your reasoning language into the lowest common denominator, aka Python. Sure, people (maybe very smart) can come up with reasonable, effective, efficient notation; the problem is to train the model to use it properly.
- seanhunter 2y ago> A formal notation for reasoning could possibly solve some reasoning issues for LLMs. Perhaps something like Lojban or symbolic logic. We don't have a lot of data for it, but it might be possible to synthetically generate it. There's definitely anecdata supporting this. For some time chatgpt was better on a lot of arithmetic/logic type tasks if you asked it to generate a python program to do x than if you just asked it to do x for example. I haven't tested this specifically on the latest generation but my feeling is it has caught up a lot.
- earslap 2y agoIt is more obvious when taken to extreme: With the current feedforward transformer architectures, there is a fixed amount of compute per token. Imagine asking a very hard question with a yes/no answer to an LLM. There are infinite number of cases where the compute available to the calculation of the next token is not enough to definitively solve that problem, even given "perfect" training. You can increase the compute for allowing more tokens for it to use as a "scratch pad" so the total compute available will be num_tokens * ops_per_token but there still are infinite amount of problems you can ask that will not be computable within that constraint. But, you can offload computation by asking for the description of the computation, instead of asking for the LLM to compute it. I'm no mathematician but I would not be surprised to learn that the above limit applies here as well in some sense (maybe there are solutions to problems that can't be represented in a reasonable number of symbols given our constraints - Kolmogorov Complexity and all that), but still for most practical (and beyond) purposes this is a huge improvement and should be enough for most things we care about. Just letting the system describe the computation steps to solve a problem and executing that computation separately offline (then feeding it back if necessary) is a necessary component if we want to do more useful things.
- downboots 2y ago> The language that a problem-solver uses matters! Because the "intelligence" is borrowed from language (lower entropy)
- albert_e 2y agoGut feel: doing this in two steps (1. write an algorithm for and 2. write code for) or even chain-of-thought prompting might yield better results.
- nick0garvey 2y agoI took a Udacity class by Norvig [1] and my abilities as a programmer clearly were improved afterward. His code here demonstrates why. It is both shorter and much easier to understand than anything the LLMs generated. It is not always as efficient as the LLMs (who often skip the third loop by calculating the last factor), but it is definitely the code I would prefer to work with in most situations. [1] https://www.udacity.com/course/design-of-computer-programs--cs212 https://www.udacity.com/course/design-of-computer-programs--...
- upghost 2y agoSingle handedly most important class in my career back in the day. It took me 3 months to really grok and generalize the Qpig algorithm, even my professors couldn't explain it. It's amazing how he never used the words "AI" once in this course despite the fact that it is a straight up AI course. I revisit the course notes at least once a year and I still walk away with something new every time.
- JohnKemeny 2y agoWhat's the Qpig algorithm?
- TaurenHunter 2y agoquantile function for the Poisson-inverse Gaussian?
- upghost 2y agoQ as in maximum expected utility for a given move, Pig as in the dice game of Pig. https://web.archive.org/web/20140122073352/https://www.udacity.com/wiki/cs212/unit_5_code https://web.archive.org/web/20140122073352/https://www.udaci... Yes, I know that you can get the Q value via RL with Bellman equation or non-parametric evo learning, but at the time I didn't know that and I'm glad I didn't. Depending on how you count, this code features either 2 or 4 mutually recursive functions, something that is quite rare in Python (esp outside the context of an FSM) but is a signature of PN code. I had to learn so much about so many things to untangle it.
- segmondy 2y agoTried these with some local models and these are the ones that generated the program one shot, a few of them also generated the results correctly one shot. llama3.1-70b, llama3.1-405b, deepseekcoder2.5, gemma-27b, mistral-large, qwen2.5-72b. https://gist.github.com/segmond/8992a8ec5976ff6533d797caafe151fa https://gist.github.com/segmond/8992a8ec5976ff6533d797caafe1... I like how the solution sort of varies across most, tho mistral and qwen look really similar.
- assadk 2y agoWhat specs does your machine have to run these models locally?
- ryandv 2y agoIt's worth noting that math and programming do not appear to be considered "languages" by much of the academic and/or neuroscientific literature; see [0] on the front page right now and my comments regarding the same [1]. [0] https://news.ycombinator.com/item?id=41868884 https://news.ycombinator.com/item?id=41868884 [1] https://news.ycombinator.com/item?id=41892701 https://news.ycombinator.com/item?id=41892701
- nurettin 2y agoYes, calling an algorithm, a formal description of a generative function "a language" is clearly wrong. I don't think we need an academic dissertation on this.
- ryandv 2y agoI take it you disagree with the conclusions from TFA then? > Sometimes a natural language such as English is a good choice, sometimes you need the language of mathematical equations, or chemical equations, or musical notation, and sometimes a programming language is best. Written language is an amazing invention that has enabled human culture to build over the centuries (and also enabled LLMs to work). But human ingenuity has divised [sic] other notations that are more specialized but very effective in limited domains.
- bbor 2y agoHuh, interesting. Programming languages were devised with Chomsky’s foundational theory of formal languages in mind, and they’re one of the few actual implementations of it. I read your comment and it seems your main thrust is that arithmetic activity lights up different brain regions than communicative activity, which I don’t personally see as a compelling basis for a definition of the word “language”. Of course, this is what Chomsky calls a “terminological dispute”, so I mean no offense and you’re ofc free to stand your ground that the only language is what appears in human brains! But if mathematical notation and programming languages aren’t languages, what are they…? Protocols? Recursively generative patterns? Maybe just grammars? The best move in any terminological dispute is “my terms are more useful”, so this seems like a good reason to keep language as it’s defined by the generative linguistics. Or, more broadly: Saussure approaches the essence of language from two sides. For the one, he borrows ideas from Steinthal and Durkheim, concluding that language is a 'social fact'. For the other, he creates a theory of language as a system in and for itself which arises from the association of concepts and words or expressions. Thus, language is a dual system of interactive sub-systems: a conceptual system and a system of linguistic forms. Neither of these can exist without the other because, in Saussure's notion, there are no (proper) expressions without meaning, but also no (organised) meaning without words or expressions. https://en.wikipedia.org/wiki/Theory_of_language https://en.wikipedia.org/wiki/Theory_of_language
- itronitron 2y agoso, in conclusion, the training data containing 'math' that LLMs have access to is predominantly written as software code, and not as mathematical notation
- jll29 2y agoIt would be quite exciting to train a LLM with (OCR scans of) all mathematical journals, pre-prints, time-series etc.
- okibry 2y agoI have question, we still do not know what behind "neuron network" of machine. What if we gave them some syntax of a language (or syntax of a area) then ask them extract a general rule for that language ? Can them can do that ?
- YeGoblynQueenne 2y ago>> Only 2 of the 9 LLMs solved the "list all ways" prompt, but 7 out of 9 solved the "write a program" prompt. The language that a problem-solver uses matters! Sometimes a natural language such as English is a good choice, sometimes you need the language of mathematical equations, or chemical equations, or musical notation, and sometimes a programming language is best. Written language is an amazing invention that has enabled human culture to build over the centuries (and also enabled LLMs to work). But human ingenuity has divised other notations that are more specialized but very effective in limited domains. If I understand correctly, Peter Norvig's argument is about the relative expressivity and precision of Python and natural language with respect to a particular kind of problem. He's saying that Python is a more appropriate language to express factorisation problems, and their solutions, than natural language. Respectfully -very respectfully- I disagree. The much simpler explanation is that there are many more examples, in the training set of most LLMs, of factorisation problems and their solutions in Python (and other programming languages), than in natural language. Examples in Python etc. are also likely to share more common structure, even down to function and variable names [1], so there are more statistical regularities for a language model to overfit-to, during training. We know LLMs do this. We even know how they do it, to an extent. We've known since the time of BERT. For example: Probing Neural Network Comprehension of Natural Language Arguments https://aclanthology.org/P19-1459/ https://aclanthology.org/P19-1459/ Right for the Wrong Reasons: Diagnosing Syntactic Heuristics in Natural Language Inference https://aclanthology.org/P19-1334/ https://aclanthology.org/P19-1334/ Given these and other prior results Peter Norvig's single experiment is not enough, and not strong enough, evidence to support his alternative hypothesis. Ideally, we would be able to test an LLM by asking it to solve a factorisation problem in a language in which we can ensure there are very few examples of a solution, but that is unfortunately very hard to do. ______________ [1] Notice for instance how Llama 3.1 immediately identifies the problem as "find_factors", even though there's no such instruction in the two prompts. That's because it's seen that kind of code in the context of that kind of question during training. The other LLMs seem to take terms from the prompts instead.
- zazaulola 2y agoNo LLM suggested to first build a table of primes for faster factorization. 108 is too small a number for the test. How long will each program hang to give results for, say, the prime number 1599999983: [1,1599999983,1]
- underdeserver 2y agoI'm just here to point out that since Python 3.10, you don't need to import anything from typing anymore, you could use the built-in types for annotation: from math import prod from itertools import combinations def find_products(k=3, N=108) -> set[tuple[int, ...]]: """A list of all ways in which `k` distinct positive integers have a product of `N`.""" factors = {i for i in range(1, N + 1) if N % i == 0} return {ints for ints in combinations(factors, k) if prod(ints) == N} find_products()
- superlopuh 2y agoThe typing version is still useful when you want to communicate that the result conforms to a certain interface, which doesn't include mutability in the case of Set, but not the exact type. Edit: I see that he imported the typing Set, which is deprecated, instead of collections.abc.Set, which is still useful, so your comment is correct.
- tmsh 2y agoWhat about o1? I think the world is sleeping on o1. Recently I misread a leetcode/neetcode problem (so I was curious that my version of the problem with an extra constraint could be solved in a different way). And 4o hallucinated incorrectly and double downed when asked follow up questions - but o1 solved it the first time what seemed like easily. It really is a major step forward.
- fifilura 2y agoSo... Can you enlighten us how it went?
- klibertp 2y agoAfter 34 seconds: import itertools def factors(n): result = set() for i in range(1, int(n**0.5) + 1): if n % i == 0: result.add(i) result.add(n // i) return sorted(result) def main(): n = 108 factors_list = factors(n) triplets = [] for a_idx in range(len(factors_list) - 2): a = factors_list[a_idx] for b_idx in range(a_idx + 1, len(factors_list) - 1): b = factors_list[b_idx] for c_idx in range(b_idx + 1, len(factors_list)): c = factors_list[c_idx] if a * b * c == n and a < b < c: triplets.append((a, b, c)) print("All ways in which three distinct positive integers have a product of 108:") for triplet in triplets: print(triplet) if __name__ == "__main__": main() Run: -▶ python a.py All ways in which three distinct positive integers have a product of 108: (1, 2, 54) (1, 3, 36) (1, 4, 27) (1, 6, 18) (1, 9, 12) (2, 3, 18) (2, 6, 9) (3, 4, 9) Too smart for its own good, maybe? Still, apparently correct on the first try. There's an import for `itertools` which isn't used, just as noted in the article for 4o. Can someone who knows what it's about say how optimal this version is, compared to other answers?
- fifilura 2y agoMy 5c. Algorithmically it is optimal, many corner cases thought of to make as few loops as possible. But it is suboptimal in the sense that it uses for loops so it is not possible for an underlying engine to execute in parallel, or to optimize the looping in native (e.g. C) code. In short - the for loops are 'how'. Without loops it is much more 'what' which leaves it up to the computer to optimize
- dandanua 2y agoIt's not the language it's the context. LLMs could give very different outputs depending on the supplied context. In this case, words "python" and "program" put it in a far better context to solve the problem.
- __0x01 2y agoI thought this was going to be an essay on the impact of English, Math and Programming on humanity. I would place English (or all spoken/written languages in general) first, Math (as discovered) second, and programming languages last.
- deleted 2y ago[deleted]
- bytebach 2y agoRelated HN discussion - https://news.ycombinator.com/item?id=41831735 https://news.ycombinator.com/item?id=41831735 using Prolog as an intermediate target language for LLM output improves their 'reasoning' abilities.
- akira2501 2y agoWhen an author writes things like: "But some of them forgot that 1 could be a factor of 108" I struggle to take them seriously. The anthropomorphization of AI into something that can "know" or "forget" is ridiculous and shows a serious lack of caution and thinking when working with them. Likewise it leads people into wasting time on "prompt engineering" exercises that produce overfit and worthless solutions to trivial problems because it makes them feel like they're revealing "hidden knowledge." Genuinely disappointing use of human time and of commercial electricity.
- PaulDavisThe1st 2y agoWithin hours to weeks to months, many LLMs will be better at solving the problem as originally given in TFA ... because of the existence of TFA. Not immediately clear what this means or if it is good or bad or something else.