More from pcloadletter
I saw a cool version of the Monty Hall game here recently: https://monty.donk.systems. This is really cool! But I had an itch I wanted to scratch: rather than manually test out the probabilities, I wanted to run two games side-by-side: one where a switch happened and one where a switch didn't happen. Then, running those over and over, we should see the overall win percentages converge to 66.7% for switching and 33.3% for not switching. So I coded up a simulation here to scratch my itch! Controls # To control the simulation, you can start or stop here. You can also adjust the speed. Speed (between 1-30): Score # Cumulative stats as the games go on. Scenario Plays Wins Win Percent Switch 0 0 - No switch 0 0 - Switch simulation # If we switch cards after the first goat reveal. +---+ +---+ +---+ | | | | | | +---+ +---+ +---+ No switch simulation # If we don't switch. +---+ +---+ +---+ | | | | | | +---+ +---+ +---+ { playBtn.setAttribute('disabled', 'true'); setTimeout(() => { playBtn.removeAttribute('disabled'); }, 3000); started = !started; playBtn.innerHTML = started ? "Stop simulation" : "Start simulation"; play(true); play(false); }) let playCount = 0; let switchWinCount = 0; let nsPlayCount = 0; let noSwitchWinCount = 0; const playCountDisplay = document.querySelector('#plays'); const winCountDisplay = document.querySelector('#wins'); const winPctDisplay = document.querySelector('#win-pct'); const nsPlayCountDisplay = document.querySelector('#ns-plays'); const nsWinCountDisplay = document.querySelector('#ns-wins'); const nsWinPctDisplay = document.querySelector('#ns-win-pct'); const getRandomIndex = () => { return Math.floor(Math.random() * 3); } const boardDoors = (isSwitch) => document.querySelectorAll(`#${isSwitch ? '' : 'no-'}switch-board span.card`); const boardGuesses = (isSwitch) => document.querySelectorAll(`#${isSwitch ? '' : 'no-'}switch-board span.guess`); const clearBoard = (isSwitch) => { for (let i = 0; i { speed = parseInt(e.target.value); }) const delay = (seconds) => { return new Promise(res => { setTimeout(res, seconds * 1000 / speed) }); } const doorIndices = [0, 1, 2]; const setStatus = (isSwitch, text) => { const statusArea = document.querySelector(`#${isSwitch ? '' : 'no-'}switch-board section`); statusArea.innerHTML = text; } async function play(isSwitch) { if (!started) return; setStatus(isSwitch, " "); clearBoard(isSwitch); // Start with all goats const doors = new Array(3).fill("G"); // Add prize randomly const winIndex = getRandomIndex(); doors[winIndex] = "C"; await delay(0.5); setStatus(isSwitch, "Initial guess") await delay(0.5); // Select random spot for guess let guessIndex = getRandomIndex(); boardGuesses(isSwitch)[guessIndex].innerHTML = "✔" await delay(0.5); setStatus(isSwitch, "Revealing a goat") await delay(0.5); // Reveal a goat const doorsThatCanBeRevealed = doorIndices.filter(el => { return el !== guessIndex && el !== winIndex }) const revealIndex = Math.floor(Math.random() * doorsThatCanBeRevealed.length); const doorToReveal = doorsThatCanBeRevealed[revealIndex]; boardDoors(isSwitch)[doorToReveal].innerHTML = "G" await delay(0.5); setStatus(isSwitch, isSwitch ? "Switching choice" : "Not switching choice"); await delay(0.5); if (isSwitch) { boardGuesses(isSwitch)[guessIndex].innerHTML = " "; guessIndex = doorIndices.filter(el => { return el !== guessIndex && el !== doorToReveal })[0]; boardGuesses(isSwitch)[guessIndex].innerHTML = "✔" } await delay(0.5); setStatus(isSwitch, "Reveal") await delay(0.5); // Reveal for (let i = 0; i
One concern I have heard from AI naysayers is that AI slop will make code reviews nearly impossible. AI churns out so much code, documentation, etc. that it's just impossible for any reviewer to keep up with it... right? Wrong! If you have good PR review processes, then reviewing AI-assisted code shouldn't be any more onerous than reviewing any other code. Here are some concerns I have heard and my response. AI generates tons of code # It's true that AI can sometimes generate tons of code—but your PR process shouldn't allow for massive PRs in the first place! If I get a 100 file PR today, I wouldn't review that. I'd respectfully ask the author to break the PR down into smaller, atomic pieces of work that can be reviewed more carefully. I'd ask this whether or not AI helped generate the code. As an aside, AI can actually generate small, digestible diffs! You just need to prompt in a way to do so. I have found being more methodical in walking AI through the problem step-by-step not only results in more digestible diffs, but also results in higher-quality code. AI generates low quality code # I don't quite know what to say to this one! If you're not reviewing PRs for quality in the first place, then that's a problem. Just apply your regular level of vetting to AI-assisted code as you would regular code. If you don't currently review PRs closely, then the problem isn't the quality of the code—it's that you're phoning it in during PR reviews. People just accept whatever AI outputs without understanding it # I tend to review PRs pretty closely and ask questions about anything I don't understand or think may be wrong. If you author a PR and are unable to answer the questions I have about your code, then it's not making it into the codebase. Again, this is as true today as it was 10 years ago. AI or not, I am going to make sure your code makes sense! AI can use outdated/vulnerable dependencies # If you add third-party dependencies in a PR, that should be considered a "bigger deal" than some folks treat it today (I'm looking at you, node ecosystem). Your PR review process should include evaluating what new dependencies are being added and a review of the installed version. Ideally, there should also be some consideration of whether an external dependency is even needed. Outside of the PR review process, you should ideally have automated dependency scanning (sonarqube, dependabot, etc.) that will detect vulnerable dependencies. Conclusion # If you're worried about AI "slop" making its way into your codebase, consider how your prevent human "slop" from making its way into your codebase. PR reviews are a critical tool for this—and should remain one as we explore this new AI-assisted world.
I'm kind of writing this to "past" me, who I assume is "current" you for a number of folks out there. For the rest of you, this might just sound like ramblings of an old fogey super late to the party. Yes, AI is over-hyped. LLMs will not solve every problem under the sun but, like with any hot new tech, companies are going to say it will solve every problem out there, especially problems in the domain space of the company. Startups who used to be "uber for farmers" are now "AI-powered uber for farmers." You can't get away from it. It's exhausting. I let the hype exhaustion get the best of me for a while and eschewed the tech entirely. Well, I was wrong to do so. This became clear when my company bought Cursor licenses for all software developers in the company and strongly encouraged us to use it. I reluctantly started experimenting. The first thing I noticed is that LLM-powered autocomplete was wildly accurate. It seemed like it "knew" what I wanted to do next at every turn. Due to my discomfort with AI, I just stuck with autocomplete for a while. And, honestly, if I stuck with just using autocomplete it would still have been a massive level up. I remember having a few false starts with the agent panel in Cursor. I felt totally out of control when it was making changes to all sorts of files when I asked it a simple question. I have since figured out how to ask more directed questions, provide constraints, and supply markdown files in the codebase with general instructions. I now find the agent panel really helpful. I use it to help understand parts of a codebase, scaffold entirely new services or unit tests, and track down bugs. As a former skeptic, I am a wildly more productive developer with AI tooling. I let my aversion to the hype train cause me to miss out on those productivity gains for too long. I hope you don't make the same mistake.
Here we go again: I'm so tired of crypto web3 LLMs. I'm positive there are wonderful applications for LLMs. The ChatGPT web UI seems great for summarizing information from various online sources (as long as you're willing to verify the things that you learn). But a lot fo the "AI businesses" coming out right now are just lightweight wrappers around ChatGPT. It's lazy and unhelpful. Probably the worst offenders are in the content marketing space. We didn't know how lucky we were back in the "This one weird trick for saving money" days. Now, rather than a human writing that junk, we have every article sounding like the writing voice equivalent of the dad from Cocomelon. Here's an approximate technical diagram of how these businesses work: Part 1 is what I like to call the "bilking process." Basically, you put up a flashy landing page promising content generation in exchange for a monthly subscription fee (or discounted annual fee, of course!). No more paying pesky writers! Once the husk of a company has secured the bag, part 2, the "bullshit process," kicks in. Customers provide their niches and the service happily passes queries over to the ChatGPT (or similar) API. Customers are rewarded with stinky garbage articles that sound like they're being narrated by HAL on Prozac in return. Success! I suppose we should have expected as much. With every new tech trend comes a deluge of tech investors trying to find the next great thing. And when this happens, it's a gold rush every time. I will say I'm more optimistic about "AI" (aka machine learning, aka statistics). There are going to be some pretty cool applications of this tech eventually—but your ChatGPT wrapper ain't it.
More in science
Long is the way, and hard, that out of hell leads up to light.
If you saw the headline “AI writes poetry from scratch”, you would expect you were going to read a new poem that did not previously exist. But if that poem was 98% the same words in the same order as Samuel Taylor Coleridge’s “Rime of the Ancient Mariner”, you'd be a lot less impressed!
The economist Thomas Sowell wrote in his 1987 book, “There are no solutions. There are only trade-offs.” In the world of politics and economics, I think this is profoundly true and is a great guiding principle. It is not strictly true in all contexts – in the worlds of science, engineering, medicine and others, sometimes there are genuine solutions, or solutions with only insignificant trade-offs. There is a related piece of social wisdom by Larry David – “A good compromise is when both parties are dissatisfied.” A great example of both of these ideas is the recent Bipartisan American Affordability and Jobs Act, or BAAJA. This was crafted in the Senate by two Republicans and two Democrats, and passed 62 to 33. It just passed the House with the Republicans split 202 for and 11 against, and the Democrats 46 for and 165 against. It now heads to Trump’s desk, and he is expected to sign it. Major bipartisan legislation has been rare in Washington recently. Without getting too deep in the weeds here, this is likely due to the closely contested nature of current politics. Both sides figure there is no upside to working with the other side. The minority party would rather sabotage the majority and then wait until they are in power to pass partisan bills. Congress is also more partisan and extremist (more so than the public they represent), perhaps due to extreme gerrymandering and the current primary system. Perhaps the mood has shifted a bit after the recent midterms. The public seems fed-up and just wants some action, which in divided government (which we will soon have) requires bipartisanship. Despite passing, the bill is controversial, reflecting many of the trade-offs I have been discussing in the context of infrastructure in the US. The bill is essentially about permitting reform, and aims to make it easier to get permits for major infrastructure projects. It is a big and complex bill, and some of the features were not very controversial. For example, it will allow simultaneous review at the state and federal level to speed up the process. This is just a gain in efficiency without much downside. But there are major components that involve serious trade-offs. The bill waters down the ability of environmental and public groups to slow down permitting through lawsuits. It also narrows and speeds up reviews necessary to protect native and culturally sensitive lands. Some environmental groups opposed the bill due to fear it would lead to environmental harm. On the positive side the bill will make it easier, quicker, and less expensive to complete big infrastructure projects. That is the fundamental trade-off – speed vs environmental protection. But the other reason that Democrats and environmental groups were split about the bill is because those infrastructure projects include many green-energy initiatives – upgrading the grid, adding grid storage, building wind farms and solar arrays. The very laws that were designed to slow down the fossil fuel industry are now slowing down renewable energy projects. BAAJA will be a boon to fossil fuel projects and green energy projects alike. If you are a staunch environmentalist, it’s a genuine dilemma. Trade-offs are often about balance, and proponents of the bill were essentially arguing that the balance of protection vs efficiency were way off and needed to be recalibrated, which this bill does. Opponents argue that it goes too far. Some Democrats were also seduced by the notion that they should kill the bill then draft their own in two years if they capture the White House – again arguably locking us into a partisan doom cycle that gets little done. I am personally conflicted about the bill for all the reasons stated, but I think passing it was probably for the best. The devil will be in the details, and specifically how it is enforced going forward. In the hands of an administration like Trump’s, who thinks that global warming is a hoax and essentially told the fossil fuel industry he would do whatever they want if they supported his campaign, loosening the reigns is concerning. But he will not be in power forever, and is already a lame duck. The Democrats will likely have their chance to push green infrastructure projects before too long. I do think that renewable energy and battery storage now have an advantage in the market, and that advantage will only increase. Trump right now is distorting the market by forcing, for example, coal-fired power plants to remain open when market forces want them to shutter. So I see BAAJA as one component to a suite of strategies to meet our growing energy demands with increasing green energy. We need to free up the market so that it can build and change. We also need to make sure that companies are not allowed to distort the market by massively externalizing the environmental costs of their industry. And we should invest in critical infrastructure. From this perspective, BAAJA can be a step in the right direction. But it also reflects another principle of politics that many people forget – the battle is never over. There are no permanent wins because democracy is a continuous process. BAAJA is therefore not the end of this issue, it is just one step along an endless path, and should be seen that way. That is also my message for many of the voters who are happy with the midterm results. I am hearing a lot of – we the voters did our job, now it’s time for politician to do their job. I think this is misguided. Your job (the voters) is not done. It is never done. And nothing happens quickly in Washington. I would even argue that Democratic voters failed to do their job in 2024, and have now only partially corrected their catastrophic error. It will take many election cycles to undo the damage. But regardless – if you want positive change in Washington, that does not come from one election, no matter how dramatic the results. It results from paying attention, and showing up for every election, especially the primaries and off-year elections where your vote has the highest impact. And this never ever ends. The post New Environmental Regulations Controversy first appeared on NeuroLogica Blog.
There’s a lot more $1M claims, and a lot of ways you can slice that risk