0:00 MLX and memory management
So, according to Apple, if you're using Ollama or LM Studio, you're already using MLX. And yesterday we got a new update on MLX on Apple devices. And after the update, something, you know, great happened. So, you can see here the memory, the unified memory, is not getting crashed, like not getting overused. So, I have 32 GB of unified memory, and this model alone is of 20 GB. So, with context and everything, it can go up to 28 GB or 27 GB, all right?
And also, I am running this Xcode and OBX Studio, and LM Studio UI also is there. So, it's around 30 GB, you can see right now. But, it is not exceeding that, it is not crashing it. And then I I'm very much I'm trying to understand where the context is getting stored. Like context, I mean the KV cache. So, KV cache itself takes a huge memory, unified memory. And seriously, I want to know where the KV cache is getting stored. If it is getting stored on the SSD itself, because I think it is getting stored on the SSD, as we are getting a swap memory of 2.616 GB. But, this is a very less swap memory, all right? Not have had the KV cache KV cache should get stored. So, I think the KV cache is getting stored somewhere in the SSD. It is just working like oMLX, but trust me, LM Studio is far better. I was using oMLX before, but right now, after the update of the new it is quite faster, quite good, and let's see how it happens. And we have already generated 10,000 tokens here, you know? So, I'm 100% sure that KV cache is on the SSD, not on the unified memory. So, guys, this is a very good thing. You can run this kind of model without getting your system crashed on your Apple right now. And if it works good, I believe we are reaching somewhere where you can do local LLM 5-coding on your Mac, on your local machine, without your data leaving your local environment.
1:51 Troubleshooting Xcode errors
It started good, but it failed. Let me show you. So, we have this LM Studio, as you can see it's ready. And yeah, so here you can see the request could not be completed. So I clicked here and I saw it's failing to fetch command from LM Studio, but we already saw the LM Studio was running perfectly and it was generating tokens, but I don't know what went wrong. So I will be doing a little bit of research right Let's see how it was. And if it does not work, then we will try to test Gemma 4 because on the Apple video, because on the Apple official video, they were testing Gemma 4, all right? So we'll be doing Gemma 4 also. Let's see like maybe Gemma 4 can work with Xcode. If you have noticed that they were doing Gemma 4 with Xcode and Qwen 3.6 with OpenCode, right? So let us try that also, okay?
Let me change it a little bit. So I
2:38 Optimizing model performance
Asked for some help from Claude. So Claude is saying that we should load smaller model because it's taking so much context and so blah blah blah, which is not right because we are using MLX. Claude can be right, but I don't think it is right this time, And they are saying like to pre-warm the model, okay? Then try on Xcode. So yes, let's go to let us pre-warm the model and try on Xcode. Also, it's safe to you know run this to see the server respond.
Yes, we are getting the response and that's why all the models are showing here, right? So okay, let's let's load the model. I think the model is already there, you know, loaded. So let's go to chat. Let's do a chat. You know, new chat. What? What? Okay, let's eject the model first. So model is ejected. Let's load the
3:35 Testing the optimized model
Model again. This was the model, Qwen 3.6 35B 3B. Let's load it. Okay, so oh, it it can be you know the context window can be also a reason, but we are giving 20,000 context. I know increase the context to 128K, okay? TV receipt, what is the Okay. Let's Let us load the model, okay? Let us try to load the model. Let's see what Uh let's stop the A sliding edge, okay?
It's loading. Let's see activity It's 20 GB, 22 GB, 25 GB, 27 GB, 28 GB. No, we are not We are going to crash. Please don't crash. Please do not crash. Okay, the model is loaded, which is 26 GB and we are getting 7 GB 7 GB, okay? Let's say hi. Hi. We said hi hi two times, okay? Let's see what happens. Okay, remember, this is also running on the background. This uh Okay, it's giving the input. Uh it's giving the output already. So, it's thinking. It's a thinking model.
Let's see how much time does it take to give the output, okay? So, it is giving us 21.7 seconds and let us try this again, okay? This time, you have increased the uh token context window. Uh let's see how it works, all right? And I'm going to stop the OBS right now because it can get crashed. If it gets crashed, I'm going to make a video of it also and show you.
Uh let's pray it do not get crashed, all right? I'm stopping it right now.


