Building A Dependency-Free GPT On A Custom OS

The construction of a large language model (LLM) depends on many things: banks of GPUs, vast reams of training data, massive amounts of power, and matrix manipulation libraries like Numpy. For models with lower requirements though, it’s possible to do away with all of that, including the software dependencies. As someone who’d already built a full operating system as a C learning project, [Ethan Zhang] was no stranger to intimidating projects, and as an exercise in minimalism, he decided to build a generative pre-trained transformer (GPT) model in the kernel space of his operating system.

As with a number of other small demonstration LLMs, this was inspired by [Andrej Karpathy]’s MicroGPT, specifically by its lack of external dependencies. The first step was to strip away every unnecessary element from MooseOS, the operating system [Ethan] had previously written, including the GUI, most drivers, and the filesystem. All that’s left is the kernel, and KernelGPT runs on this. To get around the lack of a filesystem, the training data was converted into a header to keep it in memory — at only 32,000 words, this was no problem. Like the original MicroGPT, this is trained on a list of names, and predicts new names. Due to some hardware issues, [Ethan] hasn’t yet been able to test this on a physical computer, but it does work in QEMU.

It’s quite impressive to see such a complex piece of software written solely in C, running directly on hardware; for a project which takes the same starting point and goes in the opposite direction, check out this browser-based implementation of MicroGPT. For more on the math behind GPTs, check out this visualization.

Continue reading “Building A Dependency-Free GPT On A Custom OS”

A cylindrical neodymium-iron-boron magnet in shown on a grey background. A white line of boiling liquid surrounds the top edge of the magnet, and a cloud of condensing vapor hangs over it.

Homemade Liquid Oxygen Demonstrates Paramagnetism

Liquid nitrogen isn’t exactly an everyday material, but it’s acquired conveniently enough to be used in extreme overclocking experiments, classroom demonstrations, chemistry and physics experiments, and a number of other niche applications. Liquid oxygen, by contrast, is dangerous enough that it’s only really used in rocket engines. Nevertheless, [Electron Impressions] made some of his own, and beyond the obvious pyrotechnic experimentation, demonstrated its unusual magnetic properties. Check out the video, below.

The oxygen in this case was produced by electrolysis through a proton-exchange membrane, which vented the hydrogen into the atmosphere and routed the oxygen into a Dewar flask mounted at the cold end of a Stirling cryo-cooler. The cooler had enough power to produce about 30 to 40 milliliters of liquid oxygen per hour, enough to build up an appreciable amount in short order. As expected, the pale blue liquid caused burning paper to disappear in a violent flame, and a piece of paper soaked in it almost exploded when ignited.

Continue reading “Homemade Liquid Oxygen Demonstrates Paramagnetism”

A brass and steel mechanism is shown, with a series of rotary dials on the front. Each dial is made out of a brass ring around the stone center. A man’s hand is behind the mechanism, turning a handle.

Interplanetary Clock Keeps Time Across The Solar System

There are some clocks, mostly in or around international airports, which have multiple faces to show the time at various cities around the world. Taking more a forward-looking approach is [Chronova Engineering], who built a clock to display the time on four different planets: Earth, Mars, Jupiter, and Saturn.

The clock doesn’t have any hands, but it uses rotating dials to represent a top-down view of each planet from it’s north pole. The dials have degree markings to represent rotation relative to each planet’s prime meridian; for the gas giants, rotation is measured by the rotation of the planet’s core. Each dial’s center is made out of a circular stone tile with patterns similar to those seen on the planet; Earth, for example, is represented with sodalite. Three pointers mounted around the dial indicate the longitudes which are currently experiencing sunrise, noon, and sunset. The mechanism can be turned with a handle or a knob, and a mechanical counter keeps track of the number of Earth days that have passed.

Continue reading “Interplanetary Clock Keeps Time Across The Solar System”

An animated set of circles and lines are drawn on a black screen. Meanwhile, in a smaller window in the lower right corner, the boot screen of a Game Boy is displayed.

Running Pokémon With A Compass And Straightedge

The ancient question of whether or not it’s possible to construct a circle with the same area as a given square using only a drawing compass and straightedge was finally answered in 1882, where it was proved that pi is a transcendental number, meaning it cannot be accurately represented in a compass-and-straightedge system. This inability to accurately represent pi is just one of the ways in which these systems resemble a computer, a similarity that [0x0mer] explored in CasNum.

The core of the program represents operations with a drawing compass and unmarked straightedge. There are only a few operations that can be used for calculation: constructing a line through two points, constructing a circle centered at one point and intersecting another point, and constructing the intersection(s) of two lines, a line and a circle, or two circles. An optional viewer visualizes these operations. Another class builds on top of this basic environment to perform arithmetic and logical operations, representing numbers as points in the Cartesian plane. To add two numbers, for example, it constructs the midpoint between them, then doubles the distance from the origin.

There are some examples available, including the RSA algorithm. [0x0mer] also altered a Game Boy emulator to implement the ALU instructions using compass and straightedge operations. In testing, it took about fifteen minutes to boot, and runs at a “totally almost playable” speed, near one FPS. This is after extensive caching has been applied to minimize computation time; the performance here is impressive, but in a more qualitative than quantitative sense.

Being virtual, this system is discrete, but a physical compass and straightedge form a simple analog computer capable of dealing with continuous values.

A marketing image of a Dash educational robot is shown. It is made of a triangle pyramid of four plastic spheres. Two of the base spheres house wheels, and the top sphere houses a speaker, lights, and sensors.

Reverse Engineering A Dash Robot With Ghidra

One of the joys of browsing secondhand shops is the possibility of finding old, perhaps restorable or hackable, electronics at low prices. Admittedly, they usually seem to be old flat-screen TVs, cheap speakers, and Blu-ray players, but sometimes you find something like the Dash, an educational toy robot. When [Jonathan] came across one of these, he decided to use it as a turtle robot. However, he found the available Python libraries insufficient, and improving on them required some reverse-engineering.

Continue reading “Reverse Engineering A Dash Robot With Ghidra”

A diagram of a radar system is shown. A pair of antennas is shown on the left, with beams illuminating a number of electronic devices, labelled as "Concealed Targets."

Harmonic Radar Finds Hidden Electronics

For as long as small, hidden radio transmitters have existed, people have wanted a technology to detect them. One of the more effective ways to find hidden electronics is the nonlinear junction detector, which illuminates the area under investigation with high-frequency radio waves. Any P-N semiconductor junctions in the area will emit radio waves at harmonic frequencies of the original wave, due to their non-linear electronic response. If, however, you suspect that the electronics might be connected to a dangerous device, you’ll want a way to detect them from a distance. One solution is harmonic radar (also known as nonlinear radar), such as this phased-array system, which detects and localizes the harmonic response to a radio wave.

One basic problem is that semiconductor devices are very rarely connected to antennas optimized for the transmission of whatever harmonic you’re looking for, so the amount of electromagnetic radiation they emit is extremely low. To generate a detectable signal, a high-power transmitter and a very high-gain receiver are necessary. Since semiconductor junctions emit stronger lower harmonics, this system transmits in the 3-3.2 GHz range and only receives the 6-6.4 GHz second harmonic; to avoid false positives, the transmitter provides 28.8 decibels of self-generated harmonic suppression. To localize a stronger illumination signal to a particular point, both the transmit and receive channels use beam-steering antenna arrays.

In testing, the system was able to easily detect several cameras, an infrared sensor, a drone, a walkie-talkie, and a touch sensor, all while they were completely unpowered, at a range up to about ten meters. Concealing the devices in a desk drawer increased the ranging error, but only by about ten percent. Even in the worst-case scenario, when the system was detecting multiple devices in the same scene, the ranging error never got worse than about 0.7 meters, and the angular error was never worse than about one degree.

For a refresher on the principles of the technology, we’ve covered nonlinear junction detectors before. While the complexity of this system seems to put it beyond the reach of amateurs, we’ve seen some equally impressive homemade radar systems before.

A small piece of brown plastic is held in two pairs of tweezers under a heat gun, and is being twisted.

A New And Strangely Strong Kind Of Plastic

As anyone who extrudes plastic noodles knows, the glass transition temperature of a material is a bit misleading; polymers gradually transition between a glass and a liquid across a range of temperatures, and calling any particular point in that range the glass transition temperature is a bit arbitrary. As a general rule, the shorter the glass transition range is, the weaker it is in the glassy state, and vice-versa. A surprising demonstration of this is provided by compleximers, a class of polymers recently discovered by researchers from Wageningen University, and the first organic polymers known to form strong ionic glasses (open-access article).

When a material transforms from a glass — a hard, non-ordered solid — to a liquid, it goes through various relaxation processes. Alpha relaxations are molecular rearrangements, and are the main relaxation process involved in melting. The progress of alpha relaxation can be described by the Kohlrausch-Williams-Watts equation, which can be exponential or non-exponential. The closer the formula for a given material is to being exponential, the more uniformly its molecules relax, which leads to a gradual glass transition and a strong glass. In this case, however, the ionic compleximers were highly non-exponential, but nevertheless had long transition ranges and formed strong glasses.

The compleximers themselves are based on acrylate and methacrylate backbones modified with ionic groups. To prevent water from infiltrating the structure and altering its properties, it was also modified with hydrophobic groups. The final glass was solvent-resistant and easy to process, with a glass transition range of more than 60 °C, but was still strong at room temperature. As the researchers demonstrated, it can be softened with a hot air gun and reshaped, after which it cools into a hard, non-malleable solid.

The authors note that these are the first known organic molecules to form strong glasses stabilized by ionic interactions, and it’s still not clear what uses there may be for such materials, though they hope that compleximers could be used to make more easily-repairable objects. The interesting glass-transition process of compleximers makes us wonder whether their material aging may be reversible.