Monday, August 11, 2025

Malicious Ai training data and the lack of judgement

 So I just had an AI spit out a code snippit that was so egregiously bad that it boggled me for a while. 

function updateBlockSpan(sectionID, blockname) {
// Use jQuery to find the block_span in the section
// Will dynamically add the span if it doesn't exist yet
const $section = $('#' + sectionID);

if ($section.length) {
// Look for existing block_span
let $blockSpan = $section.find('.block_span');

// If no block_span exists, create one
if ($blockSpan.length === 0) {
// Create and add a debug span to the section
$blockSpan = $('<span class="block_span debug_display">Block: </span>');
$section.prepend($blockSpan);
}

// Update the content
$blockSpan.html('Block: ' + blockname);
} else {
console.log('Section not found: ' + sectionID);
}
} Without knowing the structure of the software I was working on, its difficult to see how shit this is.  

The key points are that the code is checking to see if the block_span tag exists... and if not, it tries to create one... and then PREPENDS it to the section.  

So as my UI works by showing and hiding lots of sections... this code would get called each time a section was displayed.  So it would create and inject a tag, outside of my sections that would persist and not get cleaned up, each time a section was displayed... so the error would stack up outside my UI area.... and keep on stacking the longer it went on.  


This is so many levels of bad ideas that it took me a while to articulate just how much I hate it. 

1) Hiding an error from a foundational assumption (that the block_span existed in the first place) 

2) Injecting DOM elements into random places.... 

3) The stacking behaviour as a consequence of not understanding the context where the function was being used. 




The larger context that I think is the problem, is that the AI presented this as its first attempt to solve this problem.  This was not the result of some vibe coding ..evolving to a bad solution... this was a simple first pass at replacing a 2 line function that was not selecting a tag correctly. 

This raised the question in my mind about how bad the training data must be to allow this to be generated as a first best guess.  How much rotted bad horrible code must have gone into training the AI that it has zero compunction about presenting this type of bad idea. 

I think this is a result of scraping the worst of the worst of the free internet and treating it all equally.  The AI's have not been trained on the best of the best code bases written by the most experienced and seasoned programmers... but by the most amateur keyboard cowboys who had the time to shit-post on the web. 

I would even go so far as to say that this is beyond a dark pattern... its actively malevolent.  And that can only have come from sufficient training data to generate persistently bad patterns in generative results.  


What's the solution to this?  

Very obviously the AI was not dealing with any context.  They are still taking in the minimum amount of code for the prompt and not considering the larger context that the function will be used in.  The tiny context windows... and the questionable way the AI actually uses the context creates the problem that I call this "sword fighting through a keyhole".   

But on top of this context we would expect "Judgement".  The ability to differentiate good from bad coding practices.  I still question that this exists or can exist for AI's that have been trained on a broad diet of random shit code from the internet.  
They have no means to learn judgement.  I can only assume that the code was not checked by seasoned programmers, line by line, before it was fed into the training data pool.  I think the evidence is building that any attempt to give these AI judgment has failed woefully. 


The other thought that occurred to me is that the vast majority of "high quality" code in many languages is probably hidden behind "commercial confidence".  There is going to be a lot of good quality code floating around in repos on github... passion projects by seasoned dev's... but the code that has been build to generate money... and battle tested by teams of seasoned devs is mostly going to be protected and not appear in training data sets that have been scraped or stolen for first generation AI's.  

Perhaps we will need to evolve the training data sets quality and meta data before we can evolve better AI code generators.  








Wednesday, April 23, 2025

Making choices makes you... you?

 So if you make a choice, does it define you?  Are you implicitly rejecting the other choice?  Can you sit on the fence and keep everyone happy or pick no sides and be on no ones side?

If you change your mind and take the other path... does that choice alone then define you?  Does the time spent exploring the other choice count?  Does the time spent on the fence matter?  

If you keep your feet on both forks of the path... are you just indecisive or making no progress? 


On the other hand, there is the case of making a decision and going for it.... with the risk that it may turn out in an unexpected way.  Every choice has risk, there is no way to eliminate it completely. 


So is choice just about risk?  Trying to pick the least risky choice?  What are the other factors?  Outcomes?  Time investment? Resources?  Ability to execute?  Side effects?  Intangibles? 


Do you pick the choice that will make you who you desire to be?  Will you still desire it when you get there or will the journey reform your desire along the way? 

Tuesday, April 22, 2025

How to live without discrimination....

 I am seeing more and more end games of anti-discrimination cropping up.  Poor folk who have not had any barriers or boundaries placed on their lives and are ending up in situations to which they are not suited. 

Its interesting to ask the question, is the situation not suitable for the candidate or is the candidate not suitable for the situation?  

I have always ascribed to the idea that people have to change to suite the environment.  But its always good to challenge an idea to see if its a rule or a heuristic.  Are there sufficient edge cases to re-evaluate the rule? 

So the instance I ran across today was about a woman who wanted to sue the US Navy because she could not get what she wanted.  The details are sad and not worth repeating... but the essence is that the environment (the Navy) would not give the woman what she wanted... for reasons. 


The issue I identified was that the Navy was not able to exercise judgment (for right or wrong) and reject her application... and the woman had been strung along and waffled around for so long that she had now passed an age cuttoff.  Imagine a system as large as the US Navy and the only boundary they have left is age.  All their other discrimination mechanisms have been systematically removed.  

This means that the organisation cannot effectively make a decision and enforce it directly.  The system has now adopted what always happens and has evolved indirect ways of trying to get an efficient result. 

There is plenty of scope to argue about need to change and was the previous discrimination system fit for purpose... but that's not the point.  The point is that without a discrimination system, the system has become frustrating, abusive, manipulative, untrustworthy and inefficient.


Its interesting that even as poor a candidate as she is for the role she wants (elite forces officer) the system has spent a lot of effort to prevent her getting in.  It would have been very simple to play the strategy of "just her have a go and fail by herself".  So was this because they did not have faith that she could be failed by any of the internal systems?   Were they just protecting her? (Seem unlikely) Were they protecting the system/institution?  (More likely... as all organisations have some self protection) or were there other considerations?  

The problem is that this woman may not have failed most of the physical challenges and the remaining ones she might have received a "wave through" as has happened for various reasons in military fitness standards.  This would have resulted in her getting the role she wanted. 

So the question still is... where they right to discriminate against her for organisational reasons... even while they did it indirectly? Did the recruiting personnel have good insight into the role and used their instinct to keep her out?  

Having just re-watched moneyball... it makes some interesting points about "selection personnel" that are probably exactly as valid for the military. However, in moneyball, they were not selecting from a general population, they were selecting from already elite players who had "issues".  Very very carefully selecting around the issues.  

In this instance they had a civilian who had "self-selected" as being an elite candidate and was trying to force their selection.  Is this the same or different?  Is there enough wiggle room between the two positions?  

An alternate hypothesis is that the system rejected her (by indirect methods) because of other factors that are not being reported clearly.  My personal take is that the candidate is demonstrating what is called in America a "Type A" personality.... an egomaniac bully.  Perhaps they don't actually want candidates with these personality disorders in positions of extreme responsibility?  Just a thought. 






   


  

Tuesday, April 8, 2025

Burn it all ... up?

 Watching the current tariff shenanigans and listening to superficially rational people panic is both startling and a bit sad.  I realise that there is going to be a lot of people take injury from the convulsions and I am sympathetic to their distress.

This is human nature at play and there is plenty of learning to be learned. 

Firstly, all the media and talking heads who are busy crying (or expressing glee) about the stock market movements... are treating it like its the centre of the world.  When on any other day, they want to pretend that its just not that interesting.  
Are they just trend following (some) are they disingenuous (many) are they just pointing slackjawed as something exciting happenes that they don't really have any idea about (lots of them too).  Mostly they are just fools spectating on something that they think is a trainwreck... and yelling everything they know about trains.  

Watching the politicians wriggle on the hook is more interesting.  So many of them want to say alot of nothing domestically... while keeping their heads down internationally.  

The irony is that very little of this will directly effect anyone... except the doomsayser.  They are having a field day. 

I have come across a couple of "Analysts" who are trying to "rules-lawyer" their ways out of this and argue about the minutia and "prove" that its wrong and how it should be wound back immediately.  


So far, the more predictable things have happened... there has been a panic on the stockmarkets as all the usual chickens run around looking for the next "sure thing". The biggest correction has been about 10% which is just a normal fuckup day for most stocks.  This is the sort of thing you see when market news comes out that a CEO has been caught with their hand in the cookies again.... I think its reflective of the retail share holders panic and dumping the stock.  Usually this would be the time to pick up a bargain. 

But the fundamentals have not really changed except for the US domestic market.  People are still going to buy stuff tomorrow shops are going to pass costs on... etc etc.  The normal rules of economics will still happen.   These corrections are going to ripple for a while as different supply chains figure out what's happening and contracts get renewed... and then they will all get back to business.  There will be winners and losers... as there always is. Retail investors will pick new "winners" and try to inflate their value by talking them up... the great cycle continues. 

I was amused to see the don come out and try to reassure the US domestic markets this morning.  I don't think he was really ready for the amount of crying and hand wringing from all the voices in the US.  But he did a good job and said nothing to make it worse. 

The truly fascinating part of this is that having a second run at the presidency has given his team a lot of time to learn from their mistakes the first time.  They had four years to see the consequences of their actions and all the holes and this time they have done a blanket system.  So it will be interesting to see if this actually gets a result without all the holes to wriggle through. 

Fundamentally, this is an attempt to force all the US companies that have off-shored their manufacturing to bring it back on-shore.  However, four years is not going to be long enough to up-skill and re-build all the capacity that the US once had.  So its a start... but will it start a trend?  Only time will tell.  I think this is probably the last roll of the dice for the US middle class to recapture dominance of manufacturing.  The problem will be with all their domestic policies on wages and standard of living etc that force up the cost... the only way out will be robotics.  Which ends up at the same place... not enough labour involved in the market. 

The other interesting possibility is that all the seeding of capacity that has gone on in other countries blooms into new production of products that are not US owned.  That will be the truly wonderful outcome of this change.  

Hopefully there will be a bunch of other countries that play the trade barrier game and shatter the "free market" because while its been an interesting experiment... really has completed all the outcomes that the policy could achieve.  The winners and losers in that game have been decided and now its just static.  There needs to be a new game, with new opportunities... and lots of new players.  And this could be it.  All the incumbents are going to cry and try to maintain their monopolies, but this is the best chance to shake up the order and create new opportunities.  






Zero sum Woke

 There is a common pattern in the hobby takeover, pop culture IP takeovers and political takeovers by the woke/SJW/genderist/minority rights  movements. 

The pattern that I keep noticing is this idea that the existing audience/demographic has to "leave" so the preferred mob can "occupy" the conceptual space. 

Superficially, this seems to be about power.  But that does not hold up to much scrutiny.  Because by pushing out the existing audience, the replacements will only have power over themselves.  Which they already had in their own echo chambers. 

The next is that its about forcing "The Message" down the throats of the existing audience.  Again, same problem.  If the audience is forced out, then they will not consume the message embedded in the media.  And the message morphs and changes constantly.  So its hard to know what the observer should take from it apart from the fact that its "different" and "inserted".

Finally, we get back to spite/revenge/punishment.  They want to take something away from you that you love.  This is the same pattern as the mean, petty sibling stealing a toy just to wound.   This is immature and stunted mindset that is all about the "now" and redressing some score board that they have in their head.  There is no concept of the future, of having to live with the consequences.  Perhaps there is no concept of consequences?  The righteous seeker of "justice" for their imagined slights.   Its all about righting the wrongs of their "past", evening up the scoreboard. 

Anyway, this is the pattern.  The spiteful child who seeks to wound for redress of imagined slights. 

There is a slightly more malicious spin on this mindset that develops once the child sees that their initial action has not had the desired effect, which is to double down.  Take even more.  Or to destroy the toy infront of the powerless other sibling.  This is the pattern being played out where pop culture IP's are being systematically corrupted and "changed" into something that is the antithesis of what they once were.  The systematic despoiling of a loved story or universe just to see someone cry.  And once they get addicted to the thrill of the crying... its going to be hard to stop.  This is the "uglification" movement... taking away nice things... even when that nice thing is their own physical body.  

This is what a bitter angry adult does when they cannot get their way and just want to burn it all down and see the pain in someone else's eyes.  They start looking for more eyes to get the same rush.