PhilipMat

TIL: Single-executable local LLM

Summary

llamafile is a single-file executable format that packages an open LLM’s runtime and weights so the model can run locally with no installation. By combining llama.cpp with Cosmopolitan Libc, a llamafile contains everything needed to execute a model on a user’s machine and aims to make open LLMs more accessible to developers and end users.

Technically, llamafiles add runtime dispatching for multiple CPU microarchitectures and concatenate AMD64 and ARM64 builds so the appropriate binary runs on each system. The format targets six OSes (macOS, Windows, Linux, FreeBSD, OpenBSD, NetBSD) and supports embedding weights via PKZIP in the GGML library for memory-mapped, self-contained distribution. The project provides tooling to create and distribute llamafiles, is an Apache 2.0-licensed project with MIT-licensed changes to llama.cpp, and has recently been adopted by Mozilla.ai, which is soliciting community feedback on modernization plans.

Because it’s a LLM, this is akin to having Wikipedia offline, but you can ask it questions.

Also powered by Cosmopolitan libc, the explanation of which is an amazing work in itself.

Source: TIL: Single-executable local LLM

TIL: lnav - a fast log viewer with remote capabilities

A TUI for log files.

Summary

lnav is a terminal-based log file viewer that lets you merge, tail, search, filter, and query log files without any server or complex setup. It automatically detects file formats, unpacks compressed files on the fly, and provides online help and operation previews to simplify use.

Designed for performance, lnav can outperform standard terminal tools when processing large logs and exposes a SQLite interface for advanced querying. The project includes an introductory video and documentation to help users get started.

The remote-host tailing feature is kind of cool.

When lnav accesses a remote host, it transfers an agent (called the “tailer”) to the host to handle file system requests from lnav. The agent is an αcτµαlly pδrταblε εxεcµταblε that should run on most X86 Operating Systems. The agent will monitor the files of interest and synchronize their contents back to the host machine.

The only setup required is to ensure the machines can be accessed via SSH without any interaction, meaning the host key must have been previously accepted and public key authentication configured.

Source: TIL: lnav - a fast log viewer with remote capabilities

TIL: PR (anti-) patterns in the world of agentic AI

Simon Willison on PR (anti-) patterns in the world of agentic AI

There are some behaviors that are anti-patterns in our weird new world of agentic engineering.

It’s so easy to create AI PR slop in this new world, even on private teams.

If you open a PR with hundreds (or thousands) of lines of code that an agent produced for you, and you haven’t done the work to ensure that code is functional yourself, you are delegating the actual work to other people.

These are good rules for event human-created PRs and these stood out:

The change is small enough to be reviewed efficiently without inflicting too much additional cognitive load on the reviewer. Several small PRs beats one big one […]

The PR includes additional context to help explain the change. What’s the higher level goal that the change serves? […]

Agents write convincing looking pull request descriptions. You need to review these too! It’s rude to expect someone else to read text that you haven’t read and validated yourself.

How long will my Mac’s SSD last? About 3000 erase-write cycles

**Key points** * SSDs wear out differently from hard disks. * Expect modern Mac internal SSDs to wear out after at least 3,000 erase-write cycles. * To monitor wear, measure the total data written to the SSD. * Expect an internal SSD to wear out when that total reaches 3,000 times the total capacity of the SSD. * For a given amount of data written to an SSD, the larger the total capacity of the SSD, the slower it will wear out. * Keep at least 10% of the SSD free at all times, with 15-25% even better. * Ensure your Mac has sufficient memory to never use VM swap space.

hoakley in How long will my Mac’s SSD last?

How to find out where I am in that cycle?

Version 1: use iostat and some math.

$ iostat -Id disk0
              disk0
    KB/t xfrs   MB
   19.02 36987892 686874.89

The MB column is “total number of megabytes transferred” (since the disk was installed).

So 686.87 GB, in my case. My disc is 1TB and that means I’m not even fully through one of those 3k cycles.
This seems low and hurts my developer pride, so let’s try another approach.

Version 2: using smartmontools

smartmontools is an open source project and can be installed using brew install smartmontools.

It installs multiple utilities and the one that’s of interest is smartctl:

$ smartctl -a disk0
...
Available Spare:                    100%
Available Spare Threshold:          99%
Percentage Used:                    1%
Data Units Read:                    217,642,465 [111 TB]
Data Units Written:                 70,672,272 [36.1 TB]
...

Much more “respectable” numbers. The 36.1 TB is about 1% of those 3000 x 1 TB, and it’s also conveniently displayed in the “Percentage Used” column.

“Available Spare” is the percentage of the remaining spare capacity available for use. As the SSD wears down this could see a decrease, although the Disk Utility might continue to report the same size for the disk.

(Thanks MacWorld for the instructions and descriptions.)