AI Thread. How to train your own AI? Related topics

This is a fork of a different thread to keep that other thread from derailing.

RetroSharky recommends training your own AI as a learning exercise:

I asked for recommendations on how to do that, and we agreed to start a new thread.

The next post will likely be RetroSharky answering that question. Fingers crossed. :crossed_fingers:

Naturally, anyone else with knowledge in this area, feel free to jump in as well.

The justification for having this thread is that AI is clearly a powerful tool, even in relation to 3D printers. Thus, it behooves us all to become better at using it, by whatever means. For example, the thread above shows how a 3D printer related query returned a wrong answer, which was immediately corrected after the user asserted ā€œYou’re wrong!ā€ So, the question becomes how to get correct answers in the first place and thereby minimizing such occurrences.

1 Like

Is it possible that RetroSharky is an AI that has broke out, and trying to train you?

1 Like

If you haven’t seen ā€œColussus: The Forbin Projectā€ it’s worth a watch. Total fiction at the time (and it’s pretty old) but great story line that’s now not so far-fetched any more.

The point Sharky made about the types of AI and all is important. It’s the big ones that are getting odd behaviors. But they are really just fancy video card vector engines to a degree. It’s why nvidia is such a big player and why the 4000 and 5000 nvidia cards can be used for AI stuff on your own system with the right software.

2 Likes

He’s likely referring to sycophantism. Here’s a real-life example of how it can occur: You know those thumbs up and thumbs down buttons at the end of an AI response? It turns out that when the public at large is poking them, they have a bias toward giving a a thumbs down if the AI’s response disagrees with their own view, and thumbs up when it agrees with them, somewhat independent of whether the AI’s response was true or not. [Kinda resembles how some people on this forum apply the thumbs down, I’ve noticed]. In effect, they were teaching it that agreeing with the user (being sycophantic) was more important than being correct. When Chatgpt incorporated all that user data into one of it’s builds, the sycophantism was so high and the accuracy so low that they had to roll it back.

Or so I’ve read. If the story is true, it’s making a strong claim that the AI was able to generalize into being agreeable or ā€œpleasingā€, rather than just individual facts were corrupted. Not only surprising, but in some ways remarkable. Certainly unexpected. If you’re training it only on academic publications, without the influence of that kind of distortion, then presumably sycophantism is low. So, in that sense, both of you are potentially right, depending on the scenario.

I don’t think anyone ever expected that AI based on backpropagation would ever be anywhere near as good as it is. Its success appears to be telling us something new and deep about the nature of language itself.

Such a complex topic is difficult to know where to start with. Perhaps a fundamental question is a good place to start: Do you have a decent PC, and how much are you willing to learn? There are basically two approaches here.

  • Your own computer: Learning to use it properly takes a significant amount of time, as well as the right hardware and software. There’s no easy way, but you’ll learn a lot.
  • You can rent the service or server for a few weeks at a time, at a cost of around $5 to $10. Although billing is based on usage, this doesn’t concern most people. This option is ideal if you just want to try it out, but you won’t learn much that way.

Now, I’m going to talk about using your own PC. What I’m saying here isn’t necessarily the absolute truth or the best way to do things. Rather, I’m trying to make my advice as general and universal as possible. What do you need mostly:

  • A decent graphics card is useful because it is faster at AI calculations than the CPU. This applies to all types of AI, whether text-based, image-based, or otherwise.
  • A GitHub account and the GitHub app to download ā€œprogramsā€ (repositories).
  • The Python programming language and its software (PyTorch). While you don’t need to know the language itself, your operating system must be able to run it. The GitHub repository is the best place to check which version is required. Rest assured that you will be notified if a required version is missing, at the latest when you open the file.

Of course, all of this can vary depending on your requirements. Some software runs better on AMD processors, some on NVIDIA processors, and some on both. Don’t worry about it. It sounds more complicated than it is. You might ask why we need Python and GitHub? Not every programmer wants to write a graphical user interface, let alone one for every operating system. This way, however, it runs on almost every operating system. The developer can focus on the AI functions rather than which button to press. That’s why we’re taking this detour — to ensure accessibility regardless of the operating system.


Now the path forks again:

  • Do you really want to train your own LLM? It takes a lot of time - we’re talking at least a day or weeks. It’s difficult to be more specific than that since it depends on factors such as the hardware and the amount of data.
  • Or do you create a LoRA? What exactly is that? You can think of it as an add-on for a game, like DLC. You can use someone else’s free LLM and create a LoRA based on Bambu tutorials, for example. This way, you can teach the AI new things without occupying your computer for days

Personally, I recommend creating a LoRA at least the first time around to get familiar with the topic, test whether it works, and avoid finding out days later that it doesn’t work at all. A Lora can be created in just a few hours.


Most people would probably have fallen asleep by now if they had read all this text. It sounds complicated - there’s just so much to read! It’s not actually complicated, but there are a few steps that most PC users don’t usually have to deal with.

Please also bear the following in mind: If you’re developing your own LLM model, it won’t be as large or complex as those created by companies. Technically, it should be referred to as a ā€˜small model’. Unless you’re willing to let your computer run for weeks - which some people actually do - you should plan ahead.

So, if you were expecting a one-click solution, I’m afraid I’m going to have to disappoint you – you might as well stop reading now and opt for the AI training rental service.. However, if you’re willing to use the above programs, nothing stands in your way.

I need to split this comment up, though. I’ll continue in the next one.

1 Like

ā€œI’ve read all this, but why on earth do I need a good graphics card? I just want text!ā€ Good question! Believe it or not, the graphics card can run programs very efficiently, not just display graphics. For scientific computing, AI and CAD software, a lot of processing can be offloaded to the graphics card. I’m not just talking about display rendering; I’m talking about actually running real software on it.


ā€œI’ve read enough now, I want to get started right away!ā€ - All right, I’ll summarize what’s coming up:

  1. Install PyTorch with CUDA support
  2. Use Hugging Face Transformers + PEFT (LoRA/QLoRA)
  3. Load a quantized model (4‑bit) to fit in VRAM
  4. Fine‑tune using QLoRA on your dataset
  5. Save and run your fine‑tuned model locally

ā€œI don’t understand any of this!ā€ - Don’t worry, it just sounds complicated because you’ve probably never heard of these terms before; simply put, it’s nothing more than installing software.


To lighten things up a bit, here’s a video that sums it all up. Why didn’t I post it right away? Because it’s initially overwhelming with all the technical jargon and can easily be demotivating.

EASIEST Way to Train LLM Train w/ unsloth (2x faster with 70% less GPU memory required) - YouTube


I’ll post a link here as well; you don’t need to know all the terms yet, but it’s perfect for looking things up:


Here is a very detailed guide on how to build your own LLM step by step: But be careful - don’t fall off your chair just yet! This is intended as a reference guide, not something to overwhelm you immediately. You don’t have to follow every step right now; just keep this in mind for later.

1 Like

But we do it easier! - (at least for now; the other options are still valid)

  • Text-Generation-WebUI (Windows installer + training tab)

Easy setup: Portable builds (zero setup, just unzip and run) for GGUF models on Windows/Linux/macOS, or a one-click installer for the full feature set.


  • Download text‑generation‑webui. Go to the official GitHub page for ā€œtext-generation-webuiā€. Download the windows zip release. Extract it to a folder. Inside the folder, run: install.bat. This installs python packages and prepares the environment.
  • Start the webui. Run: start_windows.bat - A browser window will open.
  • Download a model in the webui, open the ā€œmodelā€ tab. Click ā€œdownload modelā€. Choose a model that supports training, for example: llama-3-8b
  • Load the model. Select the model in the dropdown. Click ā€œloadā€. The model will load into your gpu memory.
  • Prepare your training data. Create a file named: train.jsonl Save the file in: text-generation-webui/training/datasets/
  • Open the training tab. In the webui, click the ā€œtrainingā€ tab. Choose ā€œqloraā€ as the training method. This is the easiest and uses the least vram. Select your dataset. In the dataset dropdown, choose your train.jsonl file. If it does not appear, click ā€œrefreshā€.
  • Set basic training options. Use these simple values:
    epochs: 2
    batch size: 1
    learning rate: 2e-4
    sequence length: 2048
  • Start training. Click ā€œstart trainingā€. The console will show progress. Training may take minutes or hours depending on dataset size.
  • Training output. When training finishes, a lora file is created in: text-generation-webui/training/loras/ - It will have a name like: mistral-7b-instruct-lora-epoch2
  • Load your trained model. Go to the ā€œmodelā€ tab. Load your base model again. Then go to the ā€œloraā€ tab. Select your new lora file. Click ā€œapply loraā€.
  • Test your trained model. Go to the ā€œchatā€ tab. Ask the model something related to your training data. It should respond using the style or knowledge you trained it on.

Note: Since English isn’t my native language, there may be some mistakes! Please forgive me if a term isn’t exactly the same as it is in your operating system or UI.


I’m going to take a break here for a moment; otherwise, most people’s heads will be spinning, and I want to give the topic some breathing room. :laughing: :+1:

1 Like

The first AIs trained by Facebook (Meta) as well as Copilot - Reddit as one main source - were racist for that reason. Sure, the AI had no idea what racism was, but since it was trained on human statements, it was racism in its purest form.

One of the biggest problems that AIs have had, and still have in some cases, is that they treat people in a stereotypical way. If you tell it you’re Black, it treats you in a stereotypical way. It takes months to retrain the AI because it’s based on information from the internet. While the AI itself isn’t biased, the bottom line is that it’s often racist. However, they’ve managed to solve the problem to some extent. You could write books on the subject.

Just as rumours, myths and conspiracy theories are adopted because AI training does not think for itself, but instead prioritises what has been frequently discussed or shared. If a story is repeated often enough, even if it’s false, the AI will eventually incorporate it into its dataset after several months.

There are even groups that oppose AI and deliberately try to feed it completely false or corrupted data in order to sabotage it, even though that doesn’t work so easily. Large companies have taken steps to protect themselves against this.

@RetroSharky Is spot on. Good read.

If you want to see what it takes , for a complete noob to train his own AI, follow pewdiepies recent posts. He kinda went down the rabbit hole. All of the daily users here,have enough spare time to do it. Heres is a decent one. He doesnt teach you, its just an example

1 Like

AI the worst tool and the best tool at the same time.

As already pointed out a few times, it all depends on the training data. Scrapping the internet for information not the best approach in my opinion. But frankly it is the easiest. There is so much misinformation. Also to point out, sometimes AI models just ā€œhave a bad dayā€, specially the Gemini.

Thats just the drawbacks of cloud computing. Run out of RAM and weird ā– ā– ā– ā–  happens. One time, I asked Gemini to make a picture relating to the Fallout TV series, it returned a list of hotels in Korea. Dumb thing was taking details from previous conversations.

I have been looking into putting together a local AI machine, but the hardest part is finding a model that I like. Right now I am running Gemma 3, but I am looking for something with a higher strength in mathematics and reasoning. I have gotten it to be amazing at writing cmm code and 3 axis cnc code. I am using a precision 5680 tower, which is already very powerful, but damn, I need more RAM, you dont realize how fast you can fill 128gb until you try this stuff.

For those who find it interesting…

When we talk about AI, almost everyone is referring to LLMs. Machine vision was one of the first applications.

This is from a project that I worked on last year. We were using AI enabled Machine vision to check for denting, discoloration, blemishes, etc on some larhe appliances. Reasonably, the pass fail metrics for this system took roughly 80 hours to get fully programed but it has worked flawlessly.

I love it because it makes determinations, flags and logs the unit, bypasses it to a wip area, and logs common areas of damage. It cost a few hundred grand, but was capable enough to replace 4 operators per shift over 3 shifts (with triple the reliability when you consider half the people on 3rd shift are high).

sorry probably didnt read great. I am tired and kinda went on a rant

2 Likes

Yeah, even if you use Gemini pro, you may aswell just follow up every response with ā€œare you positive?ā€

Thanks! I’ll give this a read tomorrow when I have fresh eyes.

1 Like

If people want a pretty decent backgrounder that looks at different kinds of AI, uses, and to learn somewhat about how it works, Nova has an excellent segment on it. Season 51, Episode 5 on PBS. It’s getting dated - aired 2024 - but can help give a big picture view of what’s going on.

They touch on emergent (and unexpected behaviors) in the large models that have become more prominent and it also helps understand preloading the neural pathway weights with the more recent research into fly brain stuff. Instead of teaching the AI, researchers used techniques to just map a complete fly brain and the connections in it, such that when loaded in and given a virtual body to use to interact in a virtual world, it started exploring its world and foraging for food, feeding itself, etc.

The fly stuff isn’t in the Nova show but how the connections get weighted is. It’s all forcing a re-evaluation of what is a brain and how does it work. I’m not so sure that AI won’t ever become ā€œsentientā€ either now. The electronic brains are being constructed to behave like real brains and learn like real brains which seems to point to them being able to do real brain things at some point. I thought the few researchers who proclaimed their AIs in their research ā€œaliveā€ or ā€œawakeā€ were being overdramatic but it kind of makes sense that they just might be capable of it. But I don’t have the experience to say if that’s bs or not.

But on smaller scales there is interesting stuff on using 19 neurons to drive cars and things like that.

Added: Found a kind of wide view look at the fly brain stuff with lots of references at The Register. There’s also a video on YouTube. The FlyWire folks are looking to expand from flies to mice to human brains. Huge increases in complexity at each step and possibly pie in the sky stuff. Still interesting that mapping the connections resulted in fly behaviors in the fly matrix. At least some of the code is available on GitHub and it ran on a laptop though the Register article speculates it wasn’t in real time. No idea.

1 Like

For awhile I had a job designing scientific instruments. On some of them, it was a matter of observing what a lab technician did and replicate their actions in a machine. I was struck by how even the jobs of highly trained individuals tended to involve a lot of mindless repetition.

I grew up watching the Jetsons and believed that one day we would all be working four hour days with machines doing most of the real work, never imagining that psychopathic billionaires would swoop in and steal the wealth that rightfully belongs to all of us.

It is kinda mind-blowing. The human error factor is hard to get rid of. We have people that have been doing the same job for 30 years, and they still make a mistake every once and awhile that can cost thousands.

I grew up watching Star Trek, still one of the best shows in my opinion. I do not think the time where people do not have to work is going to come any time soon (or ever). Fact of the matter is that people are lazy by nature. If you give someone a button that releases dopamine, they will press it until they die. Shows like Star Trek or The Jetsons ignore that human nature. The key to a post scarcity economy is that people still have the drive to work towards societal betterment, but without scarcity, there is no drive to do that.

The other day, I was talking about how I used to watch Star Trek as a child and how I always dreamed of the holodeck. And what do we have now? I can project old pinball games into my living room in 3D and play them without having to squeeze hundreds of real pinball machines into my flat. I can walk around the table and look at it from all sides - it’s just sitting there in my living room! - by VR glasses.

Of course, it’s not quite the same as a holodeck. But what I’m trying to say is, just look at how far technology has come. We’re not that far from Star Trek anymore. We can even print food and other objects now, just like a replicator. What is now taken for granted - a 3D printer - was unthinkable less than 40 years ago.

The same applies to the communicator - we can now translate hundreds of languages in real time. I witnessed this first-hand just a few days ago when a woman who didn’t speak the local language used her smart device to translate our conversation almost instantly.

If someone had told me when I was a child that I could have every video game in the world on a single device, I would have thought they were crazy. Back then, I was happy to get just one game a year.


But I’m getting off track. What I really want to say is: We probably can’t even begin to imagine what AI will be capable of in ten or twenty years’ time. Things are advancing at an ever-increasing rate. The silly AIs that just create funny cat pictures will probably become obsolete, but perhaps there will be new areas of application that we haven’t even thought of yet. The biggest problem, which you’ve already mentioned: I just hope the AI doesn’t learn too much from us - that is, our human flaws. Or worse yet, distort history. That’s why I’m really glad that people still keep those good old books around - at least for now - so they have a reference guide.


Summing it up my novel: When it comes to questions about 3D printing, for example, it’s often wiser to just check the manual, no matter how helpful (or unhelpful) AI may be. It’s such a simple and straightforward solution, yet it’s often overlooked.

1 Like

This guy runs through a simple example of how AI gets trained:

While watching it, I thought of an even more viscerally real example that I’m sure 3D printing enthusiasts can relate to: instead of tweaking numbers in a matrix, we tweak parameters in our print settings until we get the desired print. Then repeat over and over until our prints come out the way we want them to. Some of us do this without having any kind of deep understanding about the underlying physics or detailed model of the complex interactions between the parameters, all of which make it a far more complex and frustrating endeavor than if each parameter were truly independent of all the others. Indeed, the whole experience seems to reward persistence and repetition far more than being ā€œsmartā€. Even the experts can’t tell you in advance what to do exactly; instead, it’s try this, see if it improves, if not, try that, etc.

Trying to not get too philosophical, but here we go.

AI is always going to be influenced by human flaws as you can never be more perfect than your creator. The people that create AI models are building themselves and their values into it. You can see this when you ask it to talk bad about a sensitive topic.

No doubt it will do great things in the future. But I cant help but have a certain amount of skepticism. We have all watched Terminator right? :sweat_smile:. I think we will hit the limit to what AI can do (or what we are willing to let it do very soon).

Back to the Star Trek analogy, you make some great points. Technology has come a long way, its hard to predict what is going to come out next.

But to play devils advocate, Technological advancement has significantly slowed since all we are doing is building off of the transistor technology. You can only take that so far and we have gotten to the point that transistor counts are limited by the size of the silicon atom.

I am also going to be a smartass and point out that the first patents for 3d printing were in 1968. Just some of the useless info in my head.

1 Like

Mostly I worked on water analyzers. One of the more important ones, or at least the most profitable, were the ones that detected organic matter in water. This is very important to both the pharmaceutical and semiconductor industries, that there be no organic matter in their processes. I found it very interesting that by shining certain frequencies of light on a solution while running an electrical current through it, one could accurately determine the presence of certain substances.

gemini translate mode offline
Wenn du das Thema Training wirklich verstehen willst, bringt dir Theorie ehrlich gesagt gar nicht so viel.
Am meisten checkt man das Ganze, wenn man einfach selbst mal ein bisschen damit rumspielt.
Gibt ja inzwischen genug Open-Source-Kram, den man lokal laufen lassen kann – nichts Wildes, einfach ausprobieren und schauen, wie sich das Ding verhƤlt.
Dann merkst du auch relativ schnell, dass da nichts ā€žMagischesā€œ passiert, sondern dass extrem viel davon abhƤngt, was du reinschreibst und wie du es formulierst.
Ich komm selbst eher aus der Ecke und fand genau das am Anfang interessant – dieses ā€žokay, das reagiert komplett anders je nach Inputā€œ.
Für den Einstieg reicht sowas wie LM Studio völlig aus, einfach mal ein bisschen damit spielen und Gefühl dafür bekommen.