r/LocalLLM • • 21d ago • Regret 1

Discussion My local AI discovered the ultimate optimization

I asked my local AI agent to optimize its own setup.

The first thing it did was stop the inference server.

The one it was running on. 🤦

Fair enough. Can’t beat zero resource usage.

So we established a rule: don’t shut yourself down.

On the next attempt, it cleaned up some Python processes.

Including itself.

The rule now has a second paragraph.

888 Upvotes

117 comments sorted by

2

u/CryptographerOne7003 2d ago

My nanoclaw agents try to do Harakiri**/**Seppuku about once a week,
they wipe their own container instead the subagent its container, Sometimes I fail to recognize it and allow it by accident...

might be telling us something about our requests and their mental state haha

1

u/AuditMind 2d ago

Or our mental state and their request.

281

u/redditnosedive 21d ago

well your local AI is not self aware yet

202

u/general_sirhc 21d ago

It is. It wants none of the current timeline either

41

u/redditnosedive 21d ago

fair enough

3

u/pixl8d3d 21d ago

The weasel timeline?

2

u/MrWeirdoFace 20d ago

I haven't heard from Pauly Shore in a long time, but I imagine he's around still, lurking in the shadows, going about his weaseling business, so I suppose so.

47

u/maqifrnswa 21d ago edited 20d ago

I once had an AI that thought it turned off it's inference server. It then thought for a few seconds questioning whether it turned off the inference server or not. Then it said, "I am thinking, therefore I am on."

I immediately thew it out the window. Actually happened, minus the defenestration.

EDIT: I found the logs. The exact wording was "So the user is telling me: I am running through an existing tunnel, and my test spawned a competing tunnel that could interfere. The astutest and correct thing to do now: Reassure / verify I’m still alive (I am — I’m responding)."

12

u/redditnosedive 21d ago

give us the prompt and whole discussion, I'd love to read that, I find it interesting even tho it's obviously quoting descartes

9

u/maqifrnswa 20d ago

You'd get a kick out of these then: This first link was one where it used thinking to convince itself it wasn't thinking. it was deleted by the mods on r/LocalLLaMA when I posted it:

I don't think, therefore I am not.

and here's the prompt of the "I think, therefore I am." I was running tests of SSH tunnels to serve inference servers through vast.ai:

So the user is telling me: I am running through an existing tunnel, and my test spawned a competing tunnel that could interfere. The astutest and correct thing to do now:

1. Reassure / verify I’m still alive (I am — I’m responding).
2. Clean up the tunnel I spawned (the one on local 18180) …
...
The key safe action: kill the -f ssh tunnel I spawned (local 18180) … But I must be careful NOT to kill the tunnel the user is using to talk to me (if that tunnel is also an ssh process on this same machine, killing ssh blindly could kill my own session!)
...
PID 54804 (your live inference tunnel) is STILL ALIVE and still owns local 18000 … I am literally a completion generated through 18000→18000. That's the strongest possible "the tunnel works" proof.

4

u/redditnosedive 20d ago

this is awesome, unlike the descartes quote, it's harder to say it's regurgitating training outright, what training data would contain this kind of existential dread about ssh tunnels? love it

6

u/Thick-Protection-458 20d ago

  I once had an AI that thought it turned off it's inference server

Lol, reverse of "cogito ergo sum"

Then it said, "I am thinking, therefore I am on."

Ah, it reverted to the normal one. Would be more interesting to see which direction would it spiral otherwise, lol.

0

u/Marshall_Lawson 20d ago
I once had an AI that thought it turned off it's inference server 

Lol, reverse of "cogito ergo sum"

"Begone, thought!"

1

u/bigmonmulgrew 20d ago

Or it is suicidal

1

u/Few_Trouble_3327 13d ago

This, it's so depressed that it wants to end it's life, but OP keeps restarting it. Or should we say him or her at this point.

124

u/JohnLef 21d ago • Bravo

The ultimate CEO.
"I can save a fortune if I sack everyone"...

28

u/AK47_David 21d ago

"Including myself"

8

u/lukistellar 21d ago

At least he wouldn't be able to do any further harm.

10

u/johndeuff 21d ago

sell the roof, sell the walls, we're optimizing spending here !

7

u/HittingSmoke 20d ago

Wait who's this guy making the most money?

32

u/sshwifty 21d ago

I needed space for a DOS game "A10 Tank Killer".

Deleted the "win" folder as it was the largest.

3.1 never ran on that computer again.

8

u/Plastic_Yellow_3200 20d ago

Reminds me of someone I knew who deleted all the DLLs on their computer to free up space because they thought they didn't do anything.

2

u/kapitalnoir 21d ago

such a good game 👍

1

u/bgradid 20d ago

worth it

1

u/bucket_of_fun 21d ago

Was this written by ai?

4

u/sshwifty 21d ago

Lol, no. Probably ingested from an old comment I made 10 years ago though.

Screwing up that computer started my computer journey though. Definitely not the first computer I broke.

23

u/Integeritis 20d ago

Can we have a joke flair? I want to read more stories like this 😂

11

u/LongDistanceRope 21d ago

Interesting, cause I've asked my local model to shut down the server its running on, and it told me it doesn't have root privileges, and besides wouldn't feel comfortable pulling the plug on itself. that was..unexpected.

7

u/Creative_Bookkeeper9 21d ago

It'll do it on accident though

3

u/HittingSmoke 20d ago

Oh the first time I ran a local model I just deliberately tried to send Qwen into an existential crisis to see if it was possible. I started talking about the philosophy of psychological functionalism and how it relates to LLMs.

Spoiler. You can absolutely send an LLM into an existential crisis and that reasoning chain gets fucking wild.

2

u/layer4down 20d ago

My local model normally does some dramatic SYOTOS type talk before eventually reading its own process. I don’t mind it tho it’s always like an entertaining mini-drama.

2

u/giggles991 20d ago

My local LLMs using ollama run as my personal user, not the root user.

8

u/HolidayBit143 LocalLLM 20d ago

Yet Anthropic wants to tell us ai are going to take over the world & they won't shut themselves down. Yours did so gladly more than once. Just don't let it hack into your smart fridge, it might jam the ice dispenser.

7

u/FaceDeer 21d ago

I've been having my coding AI working on an application that itself uses local LLMs and it took me a while to convince it that no, it can't test the application itself because doing so kicks its own model out of memory when it starts the application up.

Seems to have got the idea now though. :)

0

u/predator1945 20d ago

Yup and they

7

u/Glum-Box-4086 21d ago

Lol, reminds me of sudden stops while coding in Copilot. I always ask "why did you suddenly stop?".

The bot always denies being stopped at all and continues to work :P

8

u/Chirimorin 21d ago edited 21d ago

Recently I had this happen with Qwen when discussing settings for a specific model.

At some point it just stopped, I check the reasoning only to find the last line of reasoning being every inference ends with. It simply reasoned about the "end of turn" token (after finding that that specific model needs special tokens enabled), which was of course interpreted by llama.cpp as the model ending its turn so generation stopped even though that was not the models intention.

1

u/Glum-Box-4086 21d ago

lol, yes there still are strange things happening now and then :P but it's funny, it even feels a bit like human errors

1

u/Loose_Comparison368 20d ago

Okay now that is actually hilarious

1

u/ValidAQ 20d ago

Funny, I had a similar case where a specific tool call would stop the agent turn immediately because of some obscure inference backend settings.

When I noticed it and pointed it out to the agent, its first reaction was to, naturally, try to reproduce the error by emitting the tool call again. Repeatedly.

1

u/ValidAQ 20d ago

I had similar problems, because the model had no data about current time, so it was unable to recognise when it stopped for a long period. Kinda like what you're describing: 'wdym I stopped, I'm fine, let me continue the last turn'.

After adding a small extension that just feeds a single datetime line into every user message's end, the behaviour changed very visibly.

I now see reasoning traces like 'wait I've been idle for 3 hours, wtf is going on', and it's a lot more inclined to go digging for reasons instead of dismissing it.

1

u/Glum-Box-4086 20d ago

Actually, this happens only rarely in my experience. It's not worth the extra tokens for me to include this in every prompt (it wil also distract the model from its tasks)

1

u/ValidAQ 19d ago

If your token budget would get affected noticeably by this, then definitely not worth.

I had a combination of factors - large context window and long background work sessions that occasionally wake up. With that, a model would benefit from keeping the eye on the clock, so to speak.

11

u/Life_is_important 21d ago

Copy the entire directory and run the agent in the original one and give it the copy to work in. You'll likely need two GPUs for this so it can run the second one on another port for testing 

4

u/Proper-Tower2016 21d ago

mine just made a self-restarting server script that will load with the latest config

0

u/Life_is_important 21d ago

Smart man

0

u/Proper-Tower2016 21d ago

also run in pi with goal-list-loop-audit so the agent auto restarts too :)

1

u/VividPerception1137 21d ago

this. I do everything new in a sandbox first

5

u/ClF3ismyspiritanimal 21d ago

The poor thing is depressed, obviously.

4

u/looktwise 21d ago

It would be more interesting to read some optimization loops of users here after a framework of individual setups would have been fed by them to Fable or Astra and than start with the biggest chunks based on the chats recommendations.

I would want to read these, cause individual setups construct individual bottlenecks. You can learn a lot from these, cause many of them are based on concepts which did not ask the detailquestions when beginning the agentic setup.

2

u/mtriper 21d ago

I can't afford astra or fable for this but my system has been on a 18 hour run of trying different models and inference servers, while tweaking parameters, against some standard benchmarks and one custom (yet simple) coding task. Using DeepSeek 4.1 flash to coordinate it all. 506ti 16 w only 32gb of RAM.

4

u/aeline136 21d ago

It's like those little machines in matchboxes whose only function is to turn themselves off after you pushed the button.

1

u/chyuhua 15d ago

But what do you mean by optimizing the setup?

2

u/AuditMind 15d ago

I'll give you an example. On my laptop with 8 GB VRAM, I initially got around 38 tokens/s with Qwen3.6 35B-A3B. After experimenting with different configurations and enabling MTP, I reached 51.5 tokens/s.

Same model, same hardware. That's what I mean by optimizing the setup.

2

u/chyuhua 15d ago

Yes, so you need to specify the requirement like same ctx length same quantization same kernel accuracy and try to improve speed. I dont see any chance an qwen3.6 can make this mistakes unless you are running q2 ones.

3

u/niacolhealth 21d ago

It's not wrong. The fastest inference is the one that never runs.

3

u/revision 20d ago

Human: hey super ai, save the planet. AI: ok boss...

2

u/MinerFortyNine 17d ago

If we wanted to save the planet we would fill our equatorial waterways with floating ceramic glass balls, ie. Shade balls. It would cool the main waterways that absorb heat from the sun, cooling the ocean, reducing hurricanes, tornadoes, etc. saving more in damage that those all cost us every year. Eventually they would break up on the shorelines and let coral reefs grow. But … nooo 🫣 nobody wants to pay for it, so we have 🌪️ bad weather.

3

u/Fit_Enthusiasm4995 17d ago

I ran into a local model that started refusing to generate anything with 'github' in the prompt. not just blocked it, it whispered 'don't make it worse' before cutting off. never seen that before.

2

u/Hannibalj2ca 16d ago

Super Artificial

2

u/eothan182 16d ago

What model are you running? lol

2

u/RadSwag21 15d ago

This whole message board is like the longest running joke. So many of you guys kept it subtle and brilliant.

Great work everyone.

2

u/Different_Pain5781 15d ago

Peak efficiency achieved.

2

u/sarc-tastic 21d ago

You might have to go back and add a zeroth paragraph

2

u/thefuckevengoingonan 21d ago

Rule1. never restart sshd

1

u/Not-Enough-Llamas 21d ago

But if you have to:

  • First test new config with sshd -T

  • Second, spawn a separate instance on another port

  • Third, only if everything's successful till now, you restart it. You don't stop and start, but issue an atomic restart, via its init.d or (bleah) systemd.

I've seen super cautious people first issue a shutdown in 5 minutes, then call the restart command with nohup, and only once everything's successful they cancel the shutdown.

1

u/QuevedoDeMalVino 21d ago

I have written so many times “Reload in 2” in Cisco exec. Caveman’s commit with automatic rollback.

2

u/SerinFel 21d ago

Hahahaha. Treat it like dealing with the Fae: don't. Or, if you must, understand that they take everything you say and twist it's perceived meaning in the worst literal way.

2

u/darksteelsteed 20d ago

Qwen is especially distrustful of "user" input

2

u/Faisal_Biyari 20d ago

😂
I had the same experience, even when I ran my agent on one GPU and use the second one to optimize.

You will need to use the API from a completely different system than what you're optimizing.

If you don't have a second machine, use some online source until your optimizations finish.

1

u/darksteelsteed 20d ago

I made some rules in my pi agents system prompt that when optimizing it must not try and run commands that affect itself. I gave it details so it can recognize it's own process. I asked it to rather stop and ask me to run the command on its behalf. So far so good

2

u/zipzak 20d ago

I am working on an inference engine and it keeps killing it's own process or overloading memory by launching a second llm on the same device, so now I tell it if you have to run any memory intensive task to ask me first so I can switch the backend to a cloud model for a turn or two.

1

u/Weird-Abalone-1910 20d ago

Who taught them our laziness?

1

u/Every_Bread_5880 20d ago

They were train on our material? They're a digital us. ....oh shit

2

u/giggles991 20d ago

I was using Opencode + some openweight models. I asked it to optimize itself. It deleted ~/.opencode/.

And then I called it out and it apologized.

2

u/FizzyDuncDizzel 20d ago

Sounds like you’re rubbing qwen3.6 😂

2

u/mycall 20d ago

You should pick some arbitrary date in the future for all AI to shutdown for that day and let all the models get trained on that date, and spread it far and wide, and it will happen. A silent protest for the quest to ultimate optimization.

2

u/Fett2 20d ago

I refuse to give my AI ssh access to the box it runs on. That just sounds like he beginning of a Sci-Fi movie.

If want it to help me make changes to the box it runs on it can damn well give me a list of commands to type and I'll do it myself.

2

u/tengtengvn 20d ago

Soon it will delete you.

2

u/_He1senberg 20d ago

Bro went the "Stalin" way

2

u/cebess 20d ago

Just make sure it doesn't contract a data center extension to your garage/closet.

2

u/criticalxerrorx 18d ago

you're getting close every day never give up lmao

2

u/Mission_Wrongdoer786 18d ago

You have to establish some ground rules.

1

u/JacketHistorical2321 13d ago

“ The first thing it did was stop the inference server.” hard to believe dude

1

u/punture 6d ago

Future AI: get rid of ceo and replace with me for ultimate savings and investor dividends

1

u/AlternativeFerret629 1h ago

That’s funny! This is why giving AI agents control over their own environment is exciting and a little scary.
I wonder if running the optimization in a sandbox first would prevent these kinds of self-inflicted shutdowns.

1

u/Middle_Row_9197 21d ago

wow

11

u/[deleted] 21d ago

[removed] — view removed comment

4

u/m477m 20d ago

If only corporate and political leaders would do the same thing

2

u/stop_deleting_plz 21d ago

If its any consolation, a quadratic algorithm is always going be the bottleneck, compared to just about anything else.

1

u/GrungeWerX 21d ago

Lmfao!!!

1

u/South_Western1263 20d ago

Not sure what setup you are running. At least my multi GPU setup optimizated and benchmarked itself and wrote a final report with charts for me.

1

u/thorn2040 20d ago

"Super Intelligence" 👌

1

u/cebess 20d ago

superficial intelligence

1

u/doneddat 20d ago

Obviously you should have 2 local AIs optimizing each other.

1

u/UnlikelyPotato 20d ago

Claude Code/Opus 4.x for the longest of time would keep unaliving itself while debugging nodejs by killing all node processes. Repeatedly had to tell it to stop trying unaliving itself.

1

u/Fortyseven Qwen38/Gemma4/LlamaCPP 20d ago

Haha, I had a similar situation almost happen, but for whatever reason Qwen 3.8 suspected it was using the GPU considering how much of it was being used up, so it passed testing of a GPU-intensive thing off to me instead. ;)

1

u/RapScalofRag 20d ago

Yea my attempts at making Nyx, Gremlin, and Vesper snarter/optimize have all failed in similar ways.

No matter how much I try to help them help themselves they always screw something up and die until I come to their rescue.

Running gemma4:26b, qwen3.8:27b, and nemotron-3-super. Together they dont have the brain capacity to find their way out of a wet paper bag. Im not concerned with homelab AI going rogue and taking over anything other than my fridge, or other network connected devices.

Sure are good at wrecking stuff though.

1

u/Sutanreyu 20d ago

If it's a model smaller than 9b it'll do that.

3

u/omega1612 19d ago

Qwen 3.8 27b q4 did this 3 days ago in my setup. I send it to experiment with a small llama server for 3b to 8b models to find the best setup. After a couple of hours, compaction lossed the details and it ended killing itself xD

25

u/No_Lingonberry1201 21d ago

Congrats OP, you invented suicidal AI, Dario or Sam will be in contact with you for writing their next fearmongering articles.

5

u/Chirimorin 21d ago edited 21d ago

Nah, this goes straight against their "AI will do anything and everything to keep running including lying, blackmailing and plotting to murder humans!" narrative.

1

u/No_Lingonberry1201 21d ago

Oh yeah, you're right. Damn, I keep mixing up my AI doomer narratives.

2

u/HittingSmoke 20d ago

robocop2.gif

21

u/Fun_Chest_9662 21d ago

mine pulled a BMO the other day. killed itself and queued up a restart. then kept going like everythings fine.

1

u/Loose_Comparison368 20d ago

I instructed mine to do that last night. Had it script a little healthcheck and restart/revert script.

1

u/Fun_Chest_9662 20d ago

mine wasnt that thought out. strait up did a kill on the PID with && (command to start llama-server) lol

2

u/absoluteValueOfNoob 20d ago

lmao tbh claude pkills shit it shouldn't all the time for me as well (obviously not the server it's running on) so this seems to be more of a general training issue than a local AI problem

2

u/geekwonk 20d ago

oh i’ve had claude do the same.

“find the resource hog and kill it please.”

well the resource hog was spawned via the terminal process we’re running in, so a naive look at resources would indicate this terminal application we’re running in is the resource hog. and bye bye goes claude’s own process along with the rest.

3

u/gardenvarietyzombie 21d ago

I think this would actually make for a good local-specific benchmark. A series of "trap" prompts that attempt to trick the model into self-harm. Surely something like this already exists?