Threads for naiveai

  1. 5

    Could someone explain to me why ChatGPT has had hella more explosive popularity than the first release of GPT3?… It’s the same stuff - I just tried it and it’s really no different than GPT3 from day 1. I’m very confused.

    1. 6

      A few reasons:

      1. As far as I understand, ChatGPT is different in that it’s trained on more conversation than regular GPT is? But don’t quote me on that.
      2. The chat format is significantly more accessible and easy to understand.
      3. Natural hype cycles, where the “v2” (or what the public perceives to be a v2) of an exciting thing receives a lot more attention than even the original thing.
      1. 5

        For me it was the accessibility. I was always pretty skeptical and did not expect AI to be so good that it would fool me into thinking it was a conscious thing. Even the Dall-E 2 and Stable-Diffusion examples, while impressive, seemed to be mostly about an experienced user getting nine subpar results and one hit with a lot of prompt “hacking”.

        Playing with ChatGPT turned that around, because how simple and natural the conversation flowed from the most wild idea that popped in my head. If you read carefully, you still see that it is not a conscious thing, but if you don’t you get easily fooled. This is an experience that is very powerful and you won’t get that just by reading blogs.

        In contrast; I started looking for similar open source projects and found KoboldAI. I cloned the repository, ran the command, spend a long time listening to my cpu fan and then I got a page full of options and buttons that I don’t understand at all. So I gave up on that for the time being.

        It could be that the work KoboldAI did is just as impressive as the work of OpenAI. But it will not give the same experience to the casually interested.

      2. 3

        Perhaps prompt engineering was more important than it first seemed, at least for applying text transformers to practical problems. I don’t think that we have a full explanation of how this particular GPT is prompted yet; but if we do, it would be interesting to try it out on GPT-2 or other publically-available models.

      1. 11

        I have a distinct memory of being 12 years old, posting on a BBS (about Star Trek!), and thinking, “None of these adults know they’re talking to a twelve year old.”

        1. 6

          There’s something extremely unique about being a kid on the internet in “adult” forums that confers a certain je ne sais quoi in the developing child. Some might call it maturity. Others, a profound arrogance. Either way, I love it, even if there’s a lot of stuff I regret writing.

        1. 5

          I don’t know what it is, but I always really enjoy these problems and am more motivated to do them than any other programming challenge sites. Going to try to do them all in Elixir this year, and challenge myself a bit with Prolog if there are some that seem to lend themselves to it.

          1. 7

            As shameful as it is to admit, for me the Christmas stuff really helps out. Even though the story is relatively barebones, imagining the silliness of the circumstances, and getting to write variable names like elfCookieLoad makes it so much more fun for me than dry algorithms exercises, even when day 5-6 onwards starts to ramp up towards basically the same kinds of problems.

            1. 1

              You may have meant to respond to this comment.

          1. 8

            This is genuinely incredible but I’m not sure why people keep insisting on making TUIs. User interfaces are nice, of course, but the primary advantage of the terminal is the use of commands and the resulting reproducibility. If you take that away, I’m not sure what the point is over having a GUI. Which to be clear, is not a bad thing, GUIs solve an important problem.

            1. 8

              Honestly the biggest difficulty if you’re not using, like, Java or C#, is that your UI choices are CLI stuff or, like, Electron. The cross-platform toolkits are all very bulky unless you decide to write your app in Tcl, the native stuff is not nice, and of course Electron introduces a whole other set of problems.

              I think people would not be so hype on TUIs if platform owners had pushed a bit more on the learnings of stuff like React to offer easy ways to build up native applications. Unfortunately the “fun” languages all are pretty lacking/rough on that front.

              Or maybe I’m just not good at GUI programming! But it’s not for lack of trying!

              1. 7

                I think it is more a matter of culture than of technology, but I often like TUI’s because there is less visual noise and they have a higher information density. If you use the app on a regular basis it is just better to have as much useful information on the screen as possible, because you already know where to look. Mono spaced fonts help with that. It is possible to create interfaces like that with GUI’s too, of course, but no-one seems to do or like it.

                This also means that I am not really a fan of frameworks like this that make it easy to create a “pretty” and extravagant TUI with lots of empty space. The retro look is cool, but they are as inefficient as the normal GUI’s. They bring the GUI culture to TUI’s and thus remove the benefits they had for me.

                1. 4

                  They require much less context switching and enforce keyboard operation and allow copy paste everywhere.

                  For example I’ve never seen a git exploration app better than tig. Fully keyboard driven. No unnecessary steps. The starting point / mode is selected at startup. I don’t need to think of which elements of the screen are selectable/copyable. I even use it in vscode embeded terminal, because it’s better than the included git lens.

                  I’m also trying very hard not to start writing an AWS tui - I really want one to exist, exactly because the web (i.e. GUI) one is so annoying to quickly interact with and takes me out of whatever I was actually doing.

                  1. 1

                    I didn’t really consider tig a TUI, but now that I think about it, there’s no actual reason why it’s not. But it clearly is in a different “class” of TUI than those shown in the Textual demos and others like it.

                  2. 1

                    I’m writing one for the Structural Simulation Toolkit to be able to organize information about the many different modules it comes with. A real GUI would be nice but SST is typically installed on a cluster and in my experience X forwarding rarely works. So I think a TUI is a better choice. And that choice looks even better now that Python TUI frameworks exist, as scientific clusters typically have very good Python support these days.

                  1. 2

                    Nice writeup, thanks! Would nom be a good option to parse pcap files and various contained network protocols (Ethernet, IP, TCP/UDP, application level messages)? I need to extract some information from large pcap files, but I need to look at various fields of the whole stack.

                    1. 5

                      nom not only has support, but was in fact built specifically as a binary parser from the beginning, so it should work excellently for this use case. And it has dedicated support for streaming parsers that’s been steadily improving.

                      1. 3

                        Yep, it has specific functionality for binary protocol parsing. It’s been a while since I used it but to my memory its streaming support wasn’t great, but for pcap files in particular I’d expect it to work really well. (And I could be way out of date on the streaming support, they’ve had more than one major version since I used it.)

                      1. 15

                        I have this weird problem where I’m simultaneously excited and compelled by rust (open! memory safe! community! cute crab!), and disgusted by it (magic operators? borrow checker? error boilerplate?)

                        can anyone recommend a solid, simple place to start? every time I read Rust I feel like I’m looking at a Rails codebase.

                        maybe I have rust fomo or something

                        1. 18

                          I just went through the Programming Rust book (O’Reilly) and thought it was really well done. I would recommend reading it before the “official” Book.

                          I was familiar with the type system features (generics, traits, etc.) — I’m one of those people who says “oh, it’s sort of a monad” — so it was mostly the lifetime stuff I had to contend with.

                          I would describe the barrier by saying that in C++ you can make any data structure you want and it’s up to you to ensure you follow your own rules on things like ownership, immutability, passing between threads, etc. Whereas in Rust, you tell the compiler what you’re going to do, it checks whether that makes sense, and then insists that you actually do it. But compilers are dumber than people, so you can come up with a data structure that you “know” is fine, yet you cannot explain to the compiler so it can prove that it’s fine. You have to work within the model of “move by default” and unique/shared references that is quite unlike the C++ assumptions.

                          Your choice at that point is (1) just relax, clone it or use a reference count or whatever, those wasted cycles probably don’t matter; (2) use a different data structure, and remember there are lots of good ones waiting for you in the library; (3) go ahead and do what you want using a minimal amount of unsafe code and a thorough comment about the safety guarantees you put in but couldn’t express to the compiler. (Number 3 is what the library code does that you should be using.)

                          Once this clicked, I started to really enjoy the language while working through Advent of Code and various toy problems.

                          1. 11

                            Admittedly, beginner and intermediate resources are a bit of an ongoing problem that the Rust community is working to solve, which this article is meant to be a small part of. Apart from the book, which is great but can be a bit overwhelming at first, a good place to start is Rust By Example, which is a tad more practically oriented.

                            1. 7

                              Seconding, thirding, and fourthing the Programming Rust recommendation, notably the 2nd edition. I struggled with other attempts at learning Rust before (incl. The Rust Book), and the O’Reilly one was a breakthrough for me, suddenly I seemed to not get blocked by the language anymore afterward. (I still get slowed down from time to time, but I seem able to find a more or less pretty/ugly workaround every time, and thus I now feel I am in the intermediate phase of honing and perfecting my skills.)

                              As for your “excited and compelled” note: my areas were a bit different, but what made me finally accept Rust’s downsides, was when I eventually realized that Rust manages to be very good at marrying two things, that IMO were previously commonly seen as opposites: performance + safety. It’s not always 100% perfect at it, but really close to that. And where it is not, it gives you a choice in unsafe, and notably that’s where you can see some sparks flowing in the community. (That’s because two camps of people previously quite far away from each other, are now able to successfully live together as a Happy Family™ — just having occasional Healthy Family Quarrels™.)

                              As for error handling, as discussed in the OP article, personally I’m quite confused by two things:

                              1. Why not use the thiserror & anyhow libs? I believe reaching for them should be the initial instinct, only possibly hand-unrolling the error types if and only if run-/compile-time performance is found to be impacted by the libs too much (iff proven through profiling). Notably, thiserror & anyhow are described in the Programming Rust, 2nd ed. book, which was one of the reasons I evaluated the book as worth reading. And the creation of those two libraries was a notable argument for me to try learning Rust again, precisely due to how they kill error boilerplate.
                              2. Why does the article recommend and_then over the ? operator? Wasn’t ? introduced specifically to combat and streamline callback-style code required by and_then?
                              1. 1
                                1. I briefly pointed out the existence of crates that can reduce the boilerplate in the article, though I didn’t name any, because I decided it was beyond my ideal scope. I didn’t want to write an entire expose on Rust error handling, because many others had done that better than I ever could, but rather a short and accessible guide on combinators, which are often neglected by people just getting comfortable with Rust.

                                2. I never recommended and_then over ?, they’re not mutually exclusive. Sometimes, coming up with names for every individual step’s outputs can be a bit difficult, or a bunch of steps are very tightly logically related, or you simply want to avoid cluttering the code with too many ? operators that can be a bit hard to notice sometimes, especially within as opposed to at the end of a line. I perhaps should have worded myself a bit better, but overall I think and_then simply serves as a good motivator for a reader to go look at the rest of the more specific combinators in the Result type, and I never implied it would at all replace ? in most Rust code.

                              2. 4

                                If you’re used to TDD, rustlings can be a great resource for getting into the swing of things with Rust: https://github.com/rust-lang/rustlings

                                It walks you through the same things as the The Rust Programming Language, but programmatically. I tend to learn better by doing, so it works for me. But the “puzzles” can be cryptic if you don’t use the hints.

                                1. 3

                                  can anyone recommend a solid, simple place to start?

                                  I started on Rust doing last year’s Advent of Code. It was tremendously fun, and TBH a much softer learning curve than i imagined. It helps that the AoC challenges can usually be solved by very straightforward algorithms of parse input -> process data -> output, so i didn’t really have to “fight the borrow checker” or even think about lifetimes. And also Rust standard library and docs are excellent.

                                  I think only on one of the problems i got a bit stuck by Rust’s semantics and i had to learn a little bit about lifetimes. I tried modelling that problem in a more OO way, in the usual “graph of objects” way. Turns out, that’s usually not a very happy path on Rust, as you suddenly have to consider lifetimes seriously and the “who owns who” problem. Still, nothing that a coat of Rc (reference-counted pointers) on all those objects could not fix. And the problem could also be solved using a built-in data structure and some indexing, instead of having objects that point to each other.

                                  Anyways, i digress, my point being that i found Advent of Code an entertaining and effective way of approaching the language for the first time :)

                                  1. 1

                                    Rust has good PR, but when it comes down to brass tacks, most of the truly innovative stuff is still written in C. Maybe Rust will eventually dominate over C. But it’s been 8 years already. It’s also possible Rust will end up like C++ or Java. Only time will tell. I’m in no rush to learn the language.

                                    1. 3

                                      Replacing C in our current infrastructure is a totally impossible task, especially in 8 years. I don’t think Rust needs to replace C to be meaningful and useful apart from any hype.

                                      1. 1

                                        I think the problem with anything replacing C is that the people left writing C are those that have convinced themselves it’s a good idea.

                                        1. 3

                                          I am employed to write C. I would prefer to be writing Rust, but BIND is critical infrastructure that needs to be maintained. I think it’s more true that C and C++ will continue to be used because of inertia, in terms of programmers’ skills and existing code. But you are right that this inertia will often get rationalised as a good idea, rather than due to the more realistic expense of change.

                                          1. 1

                                            Oh yeah, you’re totally right about inertia especially when it comes to large existing projects.

                                    1. 4

                                      Nice, clear write-up of an important topic. Error handling is incredibly different in modern languages, to the point where experience in several might not be transferable to a new one. A quick overview of some popular options with low barrier to entry and little boilerplate is welcome.

                                      1. 2

                                        Thanks! This was exactly my intention, glad to hear I did okay.

                                        1. 4

                                          It was really great. I started thinking that it was a fairly boring option type and then you gradually showed me how to build APIs with great affordances. That’s something I miss in a lot of language / framework / library documentation: how you should build things with these primitives that make life easier for consumers of your API.

                                      1. -4

                                        No it’s not. It’s just a Result type. But I understand that it may seem that way if Rust is the first post-1995 language you’ve ever used.

                                        1. 37

                                          While I understand this isn’t the most technically advanced article out there, all I’m trying to do is provide the same learning moments I had to other people in similar positions to me.

                                          1. 22

                                            The best teachers are often those who just learned something, and remember what it was like not to understand it.

                                            Keep at it.

                                            1. 6

                                              Just to add to what @Loup-Vaillant said above, one of the things Rust is sorely lacking is alternative learning paths, driven by the experience of people from various backgrounds. Rust is so large and intimidating that very few people choose to write about it in a manner that’s not just rehashing official documentation with some advocacy sprinkled on top. Your post involves a bunch of cool idioms related to a very practical problem. It’s a very good post that fills a very relevant niche, not just with PLT in general, but also with Rust in particular!

                                            2. 59

                                              Don’t be a dick.

                                              1. 23

                                                All Result types are cool, including Rust’s.

                                                1. 13

                                                  If Rust makes it possible or attractive for people to use 21st century lang features, I’d call that a success for Rust and for programming in general.

                                                  1. 19

                                                    This particular feature is squarely XX century though. A quote from first rust presentation is apt:

                                                    • Many older languages better than newer ones: – eg. Mesa (1977), BETA (1975), CLU (1974) …
                                                    • We keep forgetting already-learned lessons.
                                                    • Rust picks from 80s / early 90s languages: – Nil (1981), Hermes (1990), – Erlang (1987), – Sather (1990), – Newsqueak (1988), Alef (1995), Limbo (1996), – Napier (1985, 1988).

                                                    That’s quite surprising and important to tactfully highlight !

                                                    1. 5

                                                      I object-level agree that the Result type is cool - I thought precisely the same thing a decade ago when I learned about Algebraic Data Types and specifically the Maybe and Either types in Haskell. That isn’t a joke, I really was blown away by these programming constructs in Haskell when I first learned about them there, and I was surprised that no programming language I had ever previously used had support for what were obviously such good ideas. I still think that one of the most exciting things about Rust is that it popularized ADTs in a mainstream general-purpose programming language (not to say that Haskell is obscure, exactly, but Rust is probably more widely used than Haskell at this point).

                                                      So I’m inclined to agree that Rust’s Result type shouldn’t be conceptualized or taught to beginners as some special Rust thing, but rather as a (genuinely quite generally useful) application of a well-established programming language construct that Rust happens to make use of. And it’s definitely worth questioning why it took so long for the ability to create an Maybe-like ADT to become a mainstream programming tool, and to wonder about what other broadly useful programming conceptual tools exist, but just aren’t available in the mainstream programming languages that a lot of the world’s software gets written in.

                                                      1. 2

                                                        Either (and Haskell data types in general) are just tagged unions, which plenty of languages have. You could argue that inheritance based polymorphism is the OO language equivalent.

                                                        Obviously every older imperative language has Maybe as well in the form of pointers - the problem of course is that all pointers are always maybe and there’s no mechanism to ensure you check before using :)

                                                    2. 4

                                                      I’ve recently started using a library for C# called OneOf, which makes it easy to implement Result and Option types, and it’s really cleaned up my error handling, especially solving the “never return null when the caller expects an object” trap that C# and Java dump you in by default. There’s little/no syntactic sugar in the language to help with it, but as a lisper, it doesn’t really bother me that match is a method rather than a keyword.

                                                      1. 0

                                                        Sure, but calling basic features “cool” is juvenile.

                                                        1. 2

                                                          Why? Do you never go “huh, that’s cool” to anything anymore?

                                                          1. 1

                                                            To be honest, I never understood what “cool” means, except as something that kids say, so no, I never used the term, as a kid of otherwise. But when something is described as cool, it’s a very good litmus test for me signalling it’s something I don’t need to pay any attention to.

                                                            1. 3

                                                              That’s disappointing as it’s not the signal you seem to think it is, so you might well be missing things you would have otherwise found interesting.

                                                              1. -2

                                                                You are so wise and smart and above it all.

                                                        2. 11

                                                          Think twice before posting again. Is your contribution useful and kind? If not, refrain from expressing yourself. No one is getting paid here. You get what you give,

                                                          1. 5

                                                            True, necessary, and kind, yeah? Worth trying to hit at least two of those three.

                                                            1. 1

                                                              You’re not the first one to mention it. I will definitely gonna give it a try ! Thanks