Showing 9 out of 59 links. See a condensed link blog feed.
Can you prompt LLMs to admit when they don't know the answer? (via) on 06-01-2025 09:11
In this piece, Anthony Shaw talks about his attempts to make LLMs recognise their inability to answer certain questions and how, by default, LLMs will output a response that might look helpful even if it is complete gargabe.
The main example given was that of a game of Set where Anthony and his kid needed help determining whether there was a match or not, given a picture of the game. The LLMs prompted were very keen on creating garbage output, with most (if not all) mentioning cards that weren't even in play in the photo shown.
In the end, Anthony did manage to get better outputs by instructing LLMs to reply with a shrugging emoji in case they could not compute the answer reliably. (There is also a bonus snippet of Python code in the end that looks for matches programmatically. Maybe prompting the LLMs to write such piece of code would've been easier and more reliable.)
Duck Typing in Python (via) on 03-01-2025 17:35
I was preparing a webinar on typing (for the Python Mastery Guild) and I was thinking about duck typing and how to explain it. I had come to the realisation – which is kind of obvious in hindsight – that dunder methods are for duck typing. It's through dunder methods that you add the duck-like behaviours that matter to your own classes. Not surprisingly, Trey's article on duck typing presents the same conclusion in a later section of the article.
Write your Own Virtual Machine (via) on 03-01-2025 17:29
I have come to understand that I really enjoy learning about parses, compilers, VMs, and other things along these lines. For example, I really like implementing parsers. (I'm not sure why, though...)
I have very limited knowledge of C but it looks like the final program is simple and short enough (250 lines of code) that I'd be able to follow the full tutorial and implement it in C. I started reading it and the prose looks quite accessible, so if you're into lower-level stuff, give this a read!
Genuary 2025 (via) on 02-01-2025 13:56
The TL;DR is that this is a friendly challenge to get you to write computer programs that create generative art. They give you a guiding prompt for each day of January – which you are free to ignore – and then you share your creations online. I'm “pinning” it here as something I'd love to do but at the same time I don't consider essential enough to actually carve out the time to do it during January... Maybe I'll get to one or two...
Squared triangular number on 31-12-2024 19:05
With 2025 almost starting, I've seen a number of people talking about the fact that \(2025 = 45^2\), and since \(45\) is a triangular number, that gives rise to two fun formulas to compute \(2025\). First, since \(45\) is a triangular number, you get
\[ 2025 = 45^2 = (1 + 2 + 3 + \cdots + 8 + 9)^2 ~ .\]
The link to the Wikipedia page about squared triangular numbers also gives a beautiful geometrical demonstration that the formula above is equal to the sum of the cubes of the same integers:
\[ 2025 = 1^3 + 2^3 + 3^3 + \cdots + 8^3 + 9^3 ~ .\]
MacOS Setup Guide (via) on 30-12-2024 10:37
I've been using a Macbook for 2 or 3 years and there are things in this guide I'm doing/using already, but there are also other tips that I want to take a better look at and ponder about. In particular, the list of apps recommended and the customisation of iTerm2 look like sections I want to devote some time to.
Bron-Kerbosch algorithm (via) on 24-12-2024 17:39
This year I've been solving Advent of Code consistently and for day 23 I had to implement a small algorithm that finds clicks in a graph. My recursive function isn't particularly clever but stands at 5 lines of code:
def find_clicks(click, nodes, edges):
for idx, node in enumerate(nodes):
if click <= edges[node]:
yield from find_clicks(click | {node}, nodes[idx + 1 :], edges)
yield click
nodes
is a list of all the vertices in the graph and edges
is a mapping from vertex to set of neighoubrs.
Initially, call it with find_clicks(set(), nodes, edges)
.
The generator yields sub-maximal clicks but this was good enough for my purposes.
I was pleasantly surprised (but not too surprised) to find later that there is an algorithm that finds maximal clicks in a graph.
Link blogging with Grav on 24-12-2024 17:22
Keeping in line with the “meta” link blogging, this link should point to a series of interactions I had with ChatGPT to help me set up a new type of page that was suitable for link blogging.
My approach to running a link blog on 24-12-2024 17:14
I enjoy the stuff that Simon writes and in his newsletter he introduced me to a concept I didn't even know: “link blogging”. I decided to give it a try and so I thought it was only fitting to start by blogging about this link of his.
At least for now, I think I'll stick to a simpler workflow to see if I enjoy link blogging and in the future I might extend the way I go about this...