A Hackers' Guide to Language Models
Jeremy Howard8 HN recommenders · 2023–2024
580K views · tutorial · dated · Uploaded 2023-09-24
Jeremy Howard's 90-minute practical tour of language models. It covers how they work, GPT-4's capabilities and limits, using the OpenAI API, code writing, data analysis and fine-tuning.
Repeatedly named the best practical tutorial for using LLMs, with a well-liked fine-tuning section.
2:25:52The spelled-out intro to neural networks and backpropagation: building micrograd
Andrej Karpathy
18:40But what is a neural network? | Deep learning chapter 1
3Blue1Brown
1:30:28AlphaGo - The Movie | Full award-winning documentary
Google DeepMind
27:14Transformers, the tech behind LLMs | Deep Learning Chapter 5
3Blue1Brown
51:22USENIX Security '18-Q: Why Do Keynote Speakers Keep Suggesting That Improving Security Is Possible?
USENIX
1:08:40Lecture 1 | Machine Learning (Stanford)
Stanford
5:58MarI/O - Machine Learning for Video Games
SethBling
3:31:24Deep Dive into LLMs like ChatGPT
Andrej Karpathy
13 comments from Hacker News
Thanks a lot for this video, best LLM usage tutorial I've seen so far. At [VIDEO] when talking about valid use cases for a local model vs GPT4 is: "You might want to create your own model that's particularly good at solving the kinds of problems that you need to solve using fine tuning, and these are all things that you absolutely can get better than GPT4 performance". In regards to this, there's an idea I've been thinking about for some time: Imagine a chatbot that is backed by multiple "small" models (such as 7B parameters), where each model is fine tuned for a specific task. Could such a system outperform GPT4? Here's a high level overview how I imagine this to work: - Context/prompt is sent to a "router model", which is trained to determine what kind of expert model can best answer/complete the prompt. - The system then passes the context/prompt to the expert model and returns that answer. - If no expert model is found, just use a generic instruct tuned general purpose LLM to answer If you can theoretically get better than GPT4 performance on a small models fine tuned for that task, maybe a cluster of such small models could collectively outperform GPT4. Does that make sense?
Jeremy Howard talks about it in his recent video "A Hackers' Guide to Language Models": [VIDEO] That link goes directly to the timestamp where he discusses fine tuning, but the whole talk is great. Punchline, check out Axolotl: [LINK]
You're right about the basic mistakes they can make - they can also excel at the same tasks if prompted differently. But I was making a slightly different point. The point is they can reason about things in a better-than-chance way (I mean, a much-better-than-chance way) when given problems not in the training set. Have you read the Codex paper? Seriously, go look, an LLM even from years ago (which is like decades ago in ML-time) is often able to write code to solve novel programming problems that were handwritten to not be in the training set! Also, the benchmarks against which GPT3, InstructGPT, and GPT4 were tested are illuminating about its problem solving ability on novel problems, these are described in the three respective papers. Secondly, quality is highly variant and there are traps the context window can fall into which causes especially bad results. Jeremy Howard has a great video ( [VIDEO] , starting at 18:05 the 'limitations and capabilities' section is only 13 minutes long) talking about how quality depends on: how you frame your prompts, model power (4 does a lot of stuff that 3.5 can't), and whether you're in a kind of "context trap" of repeated mistakes. Of course, some people like to point out that if it's so "finicky" and variant, it is "dumb." Sure, if you like. I'm not interested in whatever definitions you're using those things, the objective and observable point is that given well-known prompting practices, LLMs can do something functionally equivalent
Jeremy Howard put a nice example in his Video 'A Hackers' Guide to Language Models' [0]. He asked a LLM to solve the 'Wolf, goat and cabbage problem' [1], which it could do without a problem. When he modified the problem in a way, that made it trivially solvable by a reasoning human, the LLM failed miserably. It kept parroting the solution to the original problem. [0] [VIDEO] [1] [LINK]
An interesting solution to the blind spot error (taken directly from Jeremy Howard's amazing guide to language models - [VIDEO] ) is to erase the chat history and try again. Once GPT has made an error (or as the author of this article says, the early layers have irreversibly pruned some important data), it will very often start to be even more wrong.
If you're looking for a practical guide on how to use LLMs, highly recommend "Hackers Guide to language models" by Jeremy Howard. 1.5h video packed with practical information: [VIDEO]
Will you still be working on educational content on the side? (e.g. updating fast.ai and/or making one off lectures like [VIDEO] ) Either way thank you for all the amazing free content you've already put out and good luck on the new endeavor!
I understand the sadness around not understanding it, it's fucking hard. however, there are more and more resources online getting published for how to get started understanding it that help with understanding the math at an abstraction that helps with learning how to build with it. I would strongly strongly strongly recommend starting with karpathy's from 0 to hero neural networks youtube course - it starts with building a tensor library and back propagation, explaining it in a way that finally clicked for me [LINK] jeremy howard also has a fantastic video that is more around how to use LLMs and such called a hacker's guide to language models - [VIDEO] as i've dove more and more into it, i would strongly recommend trying to run things on your local machine too (llama.cpp, ollama, LM studio). that has helped me fight that feeling of like "are we all just going to be open AI developers in the end" and made me feel like you _can_ integrate these things into stuff you build by your self. I can't imagine how fucked we'd all be if llama was never opensourced. being old does not mean that you can't continue to grow, and remember that it's okay to feel overwhelmed about all this - many people are.
For "citation needed", read "please link me to a blog post showing how, don't just tell me to Google for one". The internet is full of blog posts about this. That doesn't mean they're actually good - I'd love to be pointed at one that has proven itself useful for someone (and definitely isn't just LLM blog-spam). I don't care if it's trivial to fine-tune and get crap results - I care about fine-tuning where the result was worth the effort. For the record, my favourite guide to fine-tuning is the section of this Jeremy Howard video that shows how to train a text-to-SQL model: [VIDEO]
I suspect these videos would be higher quality than most offerings from universities or business schools (given that it's a fast moving field, and most of the true experts are practitioners, and so if they're teaching, they're not teaching actual classes, at most they're doing youtube videos or interviews): - [VIDEO] (Jeremy Howard Hacker's Guide to LLMs) - [LINK] (Karpathy Intro to LLMs)
I believe it was originally written by Jeremy Howard, who has been featured here in HN a number of times. [VIDEO]
Here is Jeremy Howard's system prompt [0]. I often have success using a modified version of this. > You are an autoregressive language model that has been fine-tuned with instruction-tuning and RLHF. You carefully provide accurate, factual, thoughtful, nuanced answers, and are brilliant at reasoning. If you think there might not be a correct answer, you say so. > > Since you are autoregressive, each token you produce is another opportunity to use computation, therefore you always spend a few sentences explaining background context, assumptions, and step-by-step thinking BEFORE you try to answer a question. > > Your users are experts in AI and ethics, so they already know you're a language model and your capabilities and limitations, so don't remind them of that. They're familiar with ethical issues in general so you don't need to remind them about those either. > > Don't be verbose in your answers, but do provide details and examples where it might help the explanation. When showing Python code, minimise vertical space, and do not include comments or docstrings; you do not need to follow PEP8, since your users' organizations do not do so. [0] - [VIDEO]
It sounds like you want more broad stuff, not necessarily learning how to train models. More like learning to use them and how they work. [LINK] and Hacker's Guide to LLMs by Jeremy from Fast.ai - [VIDEO] State of GPT by Karpathy - [LINK] LLMs by 3b1b - [LINK] Visualizing transformers by 3b1b - [LINK] How ChatGPT trained - [LINK] AI in a nutshell - [LINK] How Carlini uses LLMs - [LINK] For staying updated: X/Twitter & Bluesky. Go and follow people that work at OpenAI, Anthropic, Google DeepMind, and xAI. Podcasts: No Priors, Generally Intelligent, Dwarkesh Patel, Sequoia's "Training Data"