An unofficial, read-only Hacker News reader.

Smart people who give a shit use tools (opens external site)

426 points by matthewsinclair 4 days ago | www.iankduncan.com | 322 comments on HN

View full thread · View on Hacker News

Comment thread (7)

  1. Do humans have semantics? My first instinct is to say yes, and that would imply AIs can also theoretically gain semantics one day without being compiler-like.
    Replies (1)
    1. Taking this seriously... Human communication in natural language does not have the kind of precise semantics needed to unambiguously convey the entire behavior of a program. That's why programming languages were invented in the first place.

      The problem is more subtle than just having a specification. Code is a complete positive and negative specification. It conveys exactly what a program will do and will not do, with a combination of presence and omission. Natural language communication does not work that way. It involves implicit shorthand everywhere. Details omitted are left to the receiver to infer, and there are lots of social rules in place about how to do that in good faith. But even in good faith, there are options that have different sets of cascading consequences in software.

      As an example: Say a web app needs to take an email address as user input, and the validation process is unspecified. Do you make email validation interstitial, where the process can't proceed until the user has received an email from your system at the specified address? Do you let the process proceed to collect other information, but defer completion of whatever your app does until the address is validated? Both of those are completely reasonable, but the latter requires architecturally allowing unverified users to participate in lots of functionality, but not all. The former only requires unverified users to be allowed to become verified. This architectural choice cascades through your software, as the policies and data structures shape everything your program does.

      Natural language specifications are filled with thousands of small ambiguities like that. Code... just says what to do. Precisely.

      Replies (1)
      1. > Code is a complete positive and negative specification. It conveys exactly what a program will do and will not do, with a combination of presence and omission.

        This kinda falls apart when coupled with undefined behavior, JIT optimizations and lazy evaluation. Various programming languages permit both for things to happen even when not specified by code, and for things specified in code to not happen, at the discretion of the compiler and the runtime environment. And these compilers still have this property of preserving the overall algorithm that AIs lack, and that I'm looking for a better name for.

        Usually, when people use the word "semantics" when talking about code, they do it to explicitly highlight they're talking about the opposite of the precise nature of the code as written. Especially as an adjective "semantically". For example, HTTP ETag is semantically the identifier of a particular version of a document. Semantically it's used to conditionally refetch the document if cache is stale. But in actual code, there are no versions, and ETag is basically a secondary cookie with lifetime tied to cache entry, that can contain an arbitrary string that may or may not have anything to do with the requested document. In actual code, presence of ETag enables the use of status code 304 and that's it, the rest is just a convention. Hulu famously ignored the intended semantics and used ETags for user tracking.

        Funnily enough, Wikipedia article on ETag contains the word "semantically" used in this meaning, talking about a different aspect of ETag: "A weakly validating ETag match only indicates that the two representations are *semantically* equivalent, meaning that for practical purposes they are interchangeable and that cached copies can be used. However, the resource representations are not necessarily byte-for-byte identical, and thus weak ETags are not suitable for byte-range requests."[0] Just to show I'm not pulling it out of my ass.

        All this considered, while I can see why you'd call this thing "semantics", I don't think it would be a useful term in practice, pretty much for the same reasons why determinism isn't.

        [0] https://en.wikipedia.org/wiki/HTTP_ETag

        Replies (1)
        1. Ah, I think I see. You mistook my statement for "a program fully specifies its exact behavior in all details". I can see why. I worded it too broadly. You are right, there is a bunch of room for uncertainty in internal details. But the key point is that those details are independent of the language semantics. As long as the semantics are observed, the details are allowed to vary. But that's my point: the language has semantics. They exist separately of code execution.

          You can examine code to see whether it's correct and complete. You might be able to examine a natural language prompt to find incorrect portions, but you'll never know that it's sufficient to generate a system with all the properties you need before you run it. And that's not because of nondeterminism, it's because natural language doesn't work that way.

          Replies (1)
          1. Here's the problem - you're talking about language, but it's the compiler, not the language, that has the property I'm talking about. LLM doesn't need to know English or any human language. It can be 100% trained entirely on programming languages with strictly defined semantics. You can have LLM that is only capable of understanding C and only produces valid LLVM IR. Every input will have known, verifiable semantics. Every output will have known, verifiable semantics. There would be zero question about the meaning of the input or the output, and everything will be according to every applicable spec. And yet, this LLM would produce bytecode that is only loosely based on the source code and only preserves the intent in very broad strokes - as opposed to a compiler that, despite producing something completely different in every way from the source, is guaranteed to perform all the same computations.

            What do you call this difference between a compiler and an AI, when both speak the same (programming) language?

            Replies (1)
            1. If that ever happens, I'll care. It won't, because no one is going to pay per-compilation of a language that can be compiled by a faster and cheaper local system.

              LLMs are only used for cases traditional compilers can't do. I don't consider a what a system does to be different from what it is.

              Continue this thread (1 replies) →