12 ms·
What we've learned from a year of building with LLMs
- solidasparagus 2y agoNo offense, but I'd love to see what they've successfully built using LLMs before taking their advice too seriously. The idea that fine-tuning isn't even a consideration (perhaps even something they think is absolutely incorrect if the section titles of the unfinished section is anything to go by) is very strange to me and suggests a pretty narrow perspective IMO
- gandalfgeek 2y agoThis was kind of conventional wisdom ("fine tune only when absolutely necessary for your domain", "fine-tuning hurts factuality"), but some recent research (some of which they cite) has actually quantitatively shown that RAG is much preferable to FT for adding domain-specific knowledge to an LLM: - "Does Fine-Tuning LLMs on New Knowledge Encourage Hallucinations?" https://arxiv.org/abs//2405.05904 https://arxiv.org/abs//2405.05904 - "Fine-Tuning or Retrieval? Comparing Knowledge Injection in LLMs" https://arxiv.org/abs/2312.05934 https://arxiv.org/abs/2312.05934
- solidasparagus 2y agoThanks, I'll read those more fully. But "knowledge injection" is still pretty narrow to me. Here's an example of a very simple but extremely valuable usecase - taking a model that was trained on language+code and finetuning it on a text-to-DSL task, where the DSL is a custom one you created (and thus isn't in the training data). I would consider that close to infeasible if your only tool is a RAG hammer, but it's a very powerful way to leverage LLMs.
- gandalfgeek 2y agoAgree that your use-case is different. The papers above are dealing mostly with adding a domain-specific textual corpus, still answering questions in prose. "Teaching" the LLM an entirely new language (like a DSL) might actually need fine-tuning, but you can probably build a pretty decent first-cut of your system with n-shot prompts, then fine-tune to get the accuracy higher.
- yoelhacks 2y agoThis is exactly (one of) our use cases at Eraser - taking code or natural language and producing diagram-as-code DSL. As with other situations that want a custom DSL, our syntax has its own quirks and details, but is similar enough to e.g. Mermaid that we are able to produce valid syntax pretty easily. What we've found harder is controlling for edge cases about how to build proper diagrams. For more context: https://www.eraser.io/decision-node/on-building-with-ai https://www.eraser.io/decision-node/on-building-with-ai
- CuriouslyC 2y agoFine tuning has been on the way out for a while. It's hard to do right and costly. LoRAs are better for influencing output style as they don't dumb down the model, and they're easier to create. This is on top of RAG just being better for new facts like the other reply mentioned.
- solidasparagus 2y agoHow much of that is just the flood of traditional engineers into the space and the fact that collecting data and then fine-tuning models is orders of magnitude more complex than just throwing in RAG? I suspect a huge amount of RAG's popularity is just that any engineer can do a version of it + ChatGPT API calls in a day. As for lora - in the context of my comment, that's just splitting hairs IMO. It falls in the category of finetuning for me, although I understand why you might disagree. But it's not like the article mentions lora either, nor am I aware of people doing lora without GPUs which the article is against (No GPUs before PMF)
- altdataseller 2y agoI disagree. No amount of fine tuning will ever give the LLM the relevant context with which to answer my question. Maybe if your context is a static Wikipedia or something that will never change, you can fine tune it. But if your data and docs keep changing, how is fine tuning going to be better than RAG?
- solidasparagus 2y agoContinuous retraining and deployment maybe? But I'm actually not anti-RAG (although I think it is overrated because the retrieval problem is still handled extremely naively), I just think that fine-tuning should also be in your toolkit.
- altdataseller 2y agoWhy is the retrieval part overrated? There isnt even a single way to retrieve. It could be a simple keyword sesrch, a vector sesrch, a combo, or just simply retrieving a single doc and stuffing it in the context
- OutOfHere 2y agoFine-tuning is an absolutely necessary for true AI, and even if it's desirable, it's unfeasible to do for now for any large model considering how expensive GPUs are. If I had infinite money, I'd throw it at continuous fine-tuning and would throw away the RAG. Fine-tuning also requires appropriate measures to prevent forgetting of older concepts.
- solidasparagus 2y agoIt is not unfeasible. It is absolutely realistic to do distributed finetuning of an 8B text model on previous generation hardware. You can add finetuning to your set of options for about the cost of one FTE - up to you whether that tradeoff is worth it, but in many places it is. The expertise to pull it off is expensive, but to get a mid-level AI SME capable of helping a company adopt finetuning, you are only going to pay about the equivalent of 1-3 senior engineers. Expensive? Sure, all of AI is crazy expensive. Unfeasible? No
- OutOfHere 2y agoI don't consider a small 8B model to be worth fine-tuning. Fine-tuning is worthwhile when you have a larger model with capacity to add data, perhaps one that can even grow its layers with the data. In contrast, fine-tuning a small saturated model will easily cause it to forget older information. All things considered, in relative terms, as much as I think fine-tuning would be nice, it will remain significantly more expensive than just making RAG or search calls. I say this while being a fan of fine-tuning.
- solidasparagus 2y ago> I don't consider a small 8B model to be worth fine-tuning. Going to have to disagree with you on that one. A modern 8B model that has been trained on enough tokens is ridiculously powerful.
- OutOfHere 2y agoA well-trained 8B model will already be over-saturated with information from the start. It will therefore easily forget much old information when fine-tuning it with new materials. It just doesn't have the capacity to take in too much information. Don't get me wrong. I think an 70B or larger model would be worth fine-tuning, especially if it can be grown further with more layers.
- lmeyerov 2y agoWe work in some pretty serious domains and try to stay away from fine tuning: - Most of our accuracy ROI is from agentic loops over top models, and dynamic RAG example injection goes far here that the relative lift of adding fine-tuning isn't worth the many costs - A lot of fine-tuning is for OSS models that do worse than agentic loops over the proprietary GPT4/Opus3 - For distribution, it's a lot easier to deploy for pluggable top APIs without requiring fine-tuning, e.g., "connect to your gpt4/opus3 + for dumber-but-bigger tasks, groq" - The resources we could put into fine-tuning are better spent on RAG, agentic loops, prompts/evals, etc We do use tuned smaller dumber models, such as part of a coarse relevancy filter in a firehose pipeline... but these are outliers. Likewise, we expect to be using them more... but again, for rarer cases and only after we've exhausted other stuff. I'm guessing as we do more fine-tuning, it'll be more on embeddings than LLMs, at least until OSS models get a lot better.
- solidasparagus 2y agoSee if the article said this, I would have agreed - fine-tuning is a tool and it should be used thoughtfully. Although I personally believe that in this funding climate it makes sense to make data collection and model training a core capability of any AI product. However that will only be available and wise for some founders.
- lmeyerov 2y agoAgreed, model training and data collection are great! The subtle bit is just doesn't have to be for LLMs, as these are typically part of a system-of-models. E.g., we <3 RAG, and GNNs for improving your KG is fascinating. Likewise, dspy's explorations in optimizing prompts, vs LLMs, is very cool.
- solidasparagus 2y ago> we <3 RAG, and GNNs for improving your KG is fascinating Oh man I am so torn between this being a fantastic idea and this being "building a better slide-rule in the age of the computer". dspy is definitely a project I want to dig into more
- jph00 2y ago> The idea that fine-tuning isn't even a consideration (perhaps even something they think is absolutely incorrect if the section titles of the unfinished section is anything to go by) is very strange to me and suggests a pretty narrow perspective IMO The article has a section called "When to finetune", along with links to separate pages describing how to do so. They absolutely don't say that "fine-tuning isn't even a consideration". Instead, they describe the situations in which fine-tuning is likely to be helpful.
- deleted 2y ago[deleted]
- solidasparagus 2y agoHuh. Well that's embarrassing. I guess I missed it when I lost interest in the caching section and jumped straight to Evaluation and Monitoring.
- bbischof 2y agoHello, it’s Bryan, an author on this piece. I’d you’re interested in using one of the LLM-applications I have in prod, check out https://hex.tech/product/magic-ai/ https://hex.tech/product/magic-ai/ It has a free limit every month to give it a try and see how you like it. If you have feedback after using it, we’re always very interested to hear from users. As far as fine-tuning in particular, our consensus is that there are easier options first. I personally have fine-tuned gpt models since 2022; here’s a silly post I wrote about it on gpt 2: https://wandb.ai/wandb/fc-bot/reports/Accelerating-ML-Content-Creation-with-ML---VmlldzoxNzQ0MDAw https://wandb.ai/wandb/fc-bot/reports/Accelerating-ML-Conten...
- solidasparagus 2y agoI took at look at Magic earlier today and it didn't work at all for me, sorry to say. After the example prompt, I tried to learn about a table and it generated bad SQL (correct query to pull a row, but with limit 0). I asked it to show me the DDL and it generated invalid SQL. Then I tried to ask it to do some population statistics on the customer table and ended up confused about why there appears to be two windows in the cell, with the previously generated SQL on the left and the newly generated SQL on the right. The new SQL wouldn't run when I hit run cell, the error showed the originally generated SQL. I gave up and bounced. I went back while writing this comment and realized it might be showing me a diff (better use of color would have helped, I have been trained by github). But I was at a loss for what to do with that. I just now figured out the Keep button exists and it accepted the diff and now it sort of makes sense, but the SQL still doesn't return any results. My honest feedback is that there is way too much stuff I don't understand on the screen and it makes me confused and a little stressed. Ease me into it please, I'm dumb. There seems to be cells that are linked together and cells that aren't(? separated by purplish background) and I don't understand it. I am a jupyter user and I feel like this should be intuitive to me, but it isn't. I am not a designer, but I suspect the structural markings like cell boundaries are too faint compared to the content of the cells and/or the exterior of a cell having the same color as the interior is making it hard for me. I feel lost in a sea of white. But the core issue is that, excluding the prompt I copy-pasted word for word which worked like a charm, I am 0 out of 4 on actually leveraging AI to solve the problems I asked of Magic. I like the concept of natural language BI (I worked on in the early days when Alexa came out) so I probably gave it more chances than I would have for a different product. For me, it doesn't fit my criteria for good problems to solve with AI in 2024 - the conversational interface and binary right/wrong nature of querying/presenting data accurately make the cost of failure too high, which is a death sentence for AI products IMO (compare to proactive, non-blocking products like copilot or shades-of-wrong problems like image generation or conversations with imaginary characters). But text-to-SQL and data presentation make sense as AI capabilities in 2024 so I can see why that could be a good product to pursue. If it worked, I would definitely use it.
- deleted 2y ago[deleted]
- OutOfHere 2y agoAlmost all of this should flow from common-sense. I would use what makes sense for your application, and not worry about the rest. It's a toolbox, not a rulebook. The one point that comes more from experience than from common-sense is to always pin your model versions. As a final tip, if despite trying everything, you still don't like the LLM's output, just run it again! Here is a summary of all points: 1. Focus on Prompting Techniques: 1.1. Start with n-shot prompts to provide examples demonstrating tasks. 1.2. Use Chain-of-Thought (CoT) prompting for complex tasks, making instructions specific. 1.3. Incorporate relevant resources via Retrieval Augmented Generation (RAG). 2. Structure Inputs and Outputs: 2.1. Format inputs using serialization methods like XML, JSON, or Markdown. 2.2. Ensure outputs are structured to integrate seamlessly with downstream systems. 3. Simplify Prompts: 3.1. Break down complex prompts into smaller, focused ones. 3.2. Iterate and evaluate each prompt individually for better performance. 4. Optimize Context Tokens: 4.1. Minimize redundant or irrelevant context in prompts. 4.2. Structure the context clearly to emphasize relationships between parts. 5. Leverage Information Retrieval/RAG: 5.1. Use RAG to provide the LLM with knowledge to improve output. 5.2. Ensure retrieved documents are relevant, dense, and detailed. 5.3. Utilize hybrid search methods combining keyword and embedding-based retrieval. 6. Workflow Optimization: 6.1. Decompose tasks into multi-step workflows for better accuracy. 6.2. Prioritize deterministic execution for reliability and predictability. 6.3. Use caching to save costs and reduce latency. 7. Evaluation and Monitoring: 7.1. Create assertion-based unit tests using real input/output samples. 7.2. Use LLM-as-Judge for pairwise comparisons to evaluate outputs. 7.3. Regularly review LLM inputs and outputs for new patterns or issues. 8. Address Hallucinations and Guardrails: 8.1. Combine prompt engineering with factual inconsistency guardrails. 8.2. Use content moderation APIs and PII detection packages to filter outputs. 9. Operational Practices: 9.1. Regularly check for development-prod data skew. 9.2. Ensure data logging and review input/output samples daily. 9.3. Pin specific model versions to maintain consistency and avoid unexpected changes. 10. Team and Roles: 10.1. Educate and empower all team members to use AI technology. 10.2. Include designers early in the process to improve user experience and reframe user needs. 10.3. Ensure the right progression of roles and hire based on the specific phase of the project. 11. Risk Management: 11.1. Calibrate risk tolerance based on the use case and audience. 11.2. Focus on internal applications first to manage risk and gain confidence before expanding to customer-facing use cases.
- felixbraun 2y agorelated discussion (3 days ago): https://news.ycombinator.com/item?id=40508390 https://news.ycombinator.com/item?id=40508390
- DylanSp 2y agoLooks like the same content that was posted on oreilly.com a couple days ago, just on a separate site. That has some existing discussion: https://news.ycombinator.com/item?id=40508390 https://news.ycombinator.com/item?id=40508390.
- Multicomp 2y agoAnyone have a convenience solution for doing multi-step workflows? For example, I'm filling out the basics of an NPC character sheet on my game prep. I'm using a certain rule system, give the enemy certain tactics, certain stats, certain types of weapons, right now I have a 'god prompt' trying to walk the LLM through creating the basic character sheet, but the responses get squeezed down into what one or two prompt responses can be. If I can do node-red or a function chain for prompts and outputs, that would be sweet.
- CuriouslyC 2y agoYou can do multi shot workflows pretty easy, I like to have the model produce markdown, then add code blocks (```json/yaml```) to extract the interim results. You can lay out multiple "phases" in your prompt and have it perform each one in turn, and have each one reference prior phases. Then at the end you just pull out the code blocks for each phase and you have your structured result.
- deleted 2y ago[deleted]
- mentos 2y agoI still haven’t played with using one LLM to oversee another. “You are in charge of game prep and must work with an LLM over many prompts to…”
- hugocbp 2y agoFor me, a very simple "breakdown tasks into a queue and store in a DB" solution has help tremendously with most requests. Instead of trying to do everything into a single chat or chain, add steps to ask the LLM to break down the next tasks, with context, and store that into SQLite or something. Then start new chats/chains on each of those tasks. Then just loop them back into LLM. I find that long chats or chains just confuse most models and we start seeing gibberish. Right now I'm favoring something like: "We're going to do task {task}. The current situation and context is {context}. Break down what individual steps we need to perform to achieve {goal} and output these steps with their necessary context as {standard_task_json}. If the output is already enough to satisfy {goal}, just output the result as text." I find that leaving everything to LLM in a sequence is not as effective as using LLM to break things down and having a DB and code logic to support the development of more complex outcomes.
- dbs 2y agoShow me the use cases you have supported in production. Then I might read all the 30 pages praising the dozens (soon to be hundreds?) of “best practices” to build LLMs.
- joe_the_user 2y agoI have a friend who uses ChatGPT for writing quick policy statement for her clients (mostly schools). I have a friend who uses it to create images and descriptions for DnD adventures. LLMs have uses. The problem I see is, who can an "application" be anything but a little window onto the base abilities of ChatGPT and so effectively offers nothing more to an end-user. The final result still have to be checked and regular end-users have to do their own prompt. Edit: Also, I should also say that anyone who's designing LLM apps that, rather than being end-user tools, are effectively gate keepers to getting action or "a human" from a company deserves a big "f* you" 'cause that approach is evil.
- harrisoned 2y agoIt certainly has use cases, just not as many as the hype lead people to believe. For me: -Regex expressions: ChatGPT is the best multi-million regex parser to date. -Grammar and semantic check: It's a very good revision tool, helped me a lot of times, specially when writing in non-native languages. -Artwork inspiration: Not only for visual inspiration, in the case of image generators, but descriptive as well. The verbosity of some LLMs can help describe things in more detail than a person would. -General coding: While your mileage may vary on that one, it has helped me a lot at work building stuff on languages i'm not very familiar with. Just snippets, nothing big.
- int_19h 2y agoGPT-4 has amazing translation capabilities, too. Actually usable for long conversations.
- thallium205 2y agoWe have a company mail, fax, and phone room that receives thousands of pages a day that now sorts, categorizes, and extracts useful information from them all in a completely automated way by LLMs. Several FTEs have been reassigned elsewhere as a result.
- threeseed 2y agoRAGs do not prevent hallucinations nor does it guarantee that the quality of your output is contingent solely on the quality of your input. Using LLMs for legal use cases for example has shown it to be poor for anything other than initial research as it is accurate at best 65%: https://dho.stanford.edu/wp-content/uploads/Legal_RAG_Hallucinations.pdf https://dho.stanford.edu/wp-content/uploads/Legal_RAG_Halluc... So would strongly disagree that LLMs have become “good enough” for real-world applications" based on what was promised.
- mattyyeung 2y agoYou may be interested "Deterministic Quoting"[1]. This doesn't completely "solve" hallucinations, but I would argue that we do get "good enough" in several applications Disclosure: author on [1] [1] https://mattyyeung.github.io/deterministic-quoting https://mattyyeung.github.io/deterministic-quoting
- threeseed 2y agoHave seen this approach before. It's the yes we hallucinate but don't worry because we provide the sources for users to check. Even though everyone knows that users will never check unless the hallucination is egregious. It's such a disingenuous way of handling this.
- phillipcarter 2y ago> So would strongly disagree that LLMs have become “good enough” for real-world applications" based on what was promised. I can't speak for "what was promised" by anyone, but LLMs have been good enough to live in production as a core feature in my product since early last year, and have only gotten better.
- sheepscreek 2y agoI’m sure this has some decent insights but it’s from almost 1 year ago! A lot has changed in this space since then.
- bgrainger 2y agoAre you sure? The article says "cite this as Yan et al. (May 2024)" and published-time in the metadata is 2024-05-12. Weird: I just refreshed the page and it now redirects to a different domain (than the originally-submitted URL) and has a date of June 8, 2023. It still cites articles and blog posts from 2024, though.
- jph00 2y agoLooks like they made a mistake in the article metadata - they definitely just released this article.
- jph00 2y agoOK I let them know, and they've fixed it now.
- sheepscreek 2y agoAwesome - thanks. Makes much more sense now. Can’t update my original comment but hopefully people will read this.
- mloncode 2y agoThis is Hamel, one of the authors of the article. We published the article with OReilly here: Part 1: https://www.oreilly.com/radar/what-we-learned-from-a-year-of-building-with-llms-part-i/ https://www.oreilly.com/radar/what-we-learned-from-a-year-of... Part 2: https://www.oreilly.com/radar/what-we-learned-from-a-year-of-building-with-llms-part-ii/ https://www.oreilly.com/radar/what-we-learned-from-a-year-of... We were working on this webpage to collect the entire three part article in one place (the third part isn't published yet). We didn't expect anyone to notice the site! Either way, part 3 should be out in a week or so.
- seventytwo 2y agoWas wondering about the June 8th date on there :)
- xnx 2y agoThe link to part II from part I points back to part I.
- blumomo 2y ago> PUBLISHED > June 8, 2024 Is this an article from the future?
- defrost 2y agoGood catch. Best guess is that's the anticipated publishing date of the full three parts on the official O'Reilly site. See: https://news.ycombinator.com/item?id=40551413 https://news.ycombinator.com/item?id=40551413
- mercurialsolo 2y agoAs we go about moving LLM enabled products into production we definitely see a bunch of what is being spoken about resonate. We also see the below as areas which need to be expanded upon for developers building in the space to take products to production : I would love to see this article also expand to touch upon things like : - data management - (tooling, frameworks, open vs closed data management, labelling & annotations) - inference as a pipeline - frameworks for breaking down model inference into smaller tasks & combining outputs (do DAG's have a role to play here?) - prompts - areas like caching, management, versioning, evaluations - model observability - tokens, costs, latency, drift? - evals for multimodality - how do we tackle evals here which in turn can go into loops e.g. quality of audio, speech or visual outputs
- JKCalhoun 2y ago> Note that in recent times, some doubt has been cast on if this technique is as powerful as believed. Additionally, there’s significant debate as to exactly what is going on during inference when Chain-of-Thought is being used... I love this new era of computing we're in where rumors, second-guessing and something akin to voodoo have entered into working with LLMs.
- ezst 2y agoThat's the thing, it's a novel form of computing that's increasingly moving away from computer science. It deserves to be treated as a discipline of its own, with lots of words of caution and danger stickers slapped over it.
- skydhash 2y agoIt’s text (word) manipulation based on probalistic rules derived from analyzing human-produced text. And everyone knows language is imperfect. That’s why we have introduced logic and formalism so that we can reliably transmit knowledge. That’s why LLMs are good at translating and spellchecking. We’ve been describing the same world and almost all texts respect grammar. That’s the first things that surface. But you can extract the same rules in other way and create a program that does it without the waste of computing power. If we describe computing as solving problems, then it’s not computing because if your solution was not part of the training data, you won’t solve anything. If we describe computing as symbol manipulation, then it’s not doing a good job because the rules changes with every model and they are probabilistic. No way to get a reliable answer. It’s divination without the divine (no hint from an omniscient entity).
- amelius 2y agoYeah like psychology being a different field from physics even if it is running on atoms ultimately. Imagine if physics literature was filled with stuff about psychology and how that would drive physicists nuts. That's how I feel right now ;)
- deleted 2y ago[deleted]
- asshatdev 2y ago[flagged]
- pklee 2y agoThis is pure gold !! Thank you so much eugene and gang for doing this. For those of them which I have encountered, I can 100 % agree with them. This is fantastic !! So many good insights.
- jakubmazanec 2y agoI'm not saying the content of the article is wrong, but what apps are people/companies writing articles like this actually building? I'm seriously unable to imagine any useful app. I only use GPT via API (as better Google for documentations, and its output is never usable without heavy editing). This week I tried to use "AI" in Notion: I needed to generate 84 check boxes for each day starting with specific date. I got 10 check boxes and line "here should go rest..." (or some variation of such lazy output). Completely useless.
- qeternity 2y agoI think you're going about it backwards. You don't take a tool, and then try to figure out what to do with it. You take a problem, and then figure out which tool you can use to solve it.
- jakubmazanec 2y agoBut it seems to me that's what they're doing: "We have LLMs, what to do with them?" But anyway, I'm seriously just looking for an example of app that is build with stuff described in the article. Me personally, I only used LLM for one "serious" application: I used GPT-3.5Turbo for transforming unstructured text into JSON; it was basically just ad-hoc Node.js script that called API (prompt was few examples of input-output pairs), and then it did some checks (these checks usually failed only because GPT also corrected misspellings). It would take me weeks to do it manually, but with the help of GPT it was few hours (writing of the script + I made a lot of misspellings so the script stopped a lot). But I cannot imagine anything more complex.
- exhaze 2y agohttps://github.com/hrishioa/lumentis https://github.com/hrishioa/lumentis Since you seem to have not noticed my comment above, here's another example of a project that implements many of these techniques. Me and many others have used this to transcribe hour long videos into a well organized "docs site" that makes the content easy to read. Example: https://matadoc.vercel.app/ https://matadoc.vercel.app/ This was completely auto-generated in a few minutes. The author of the library reviewed it and said that it's nearly 100% correct and people in the company where it was built rely on these docs. Tell me how long it would take you to write these docs. I'm really confused where your dismissive mentality is coming from in the face of what I think is overwhelming evidence to the contrary. I'm happy to provide example after example after example. I'm sorry, but you are utterly, completely wrong in your conclusions.
- hakanderyal 2y agoIf you didn't follow what has been happing in the LLM space, this document gives you everything you need to know about state of the art LLM usage & applications. Thanks a lot for this!
- gengstrand 2y agoInteresting blog. It seems to be a compendium of advice for all kinds of folks ranging from end user to integration partner. For a slightly different take on how to use LLMs to build software, you might be interested in https://www.infoq.com/articles/llm-productivity-experiment/ https://www.infoq.com/articles/llm-productivity-experiment/ which documents an experiment where the same prompt was given to various prominent LLMs asking to write two unit tests for an already existing code base. The results were collected, metrics were analyzed, then comparisons were made. No advice on how to write better prompts but some insight on how to work with and what you can expect from LLMs in order to improve developer productivity.