Contents

Close

ESEN

← Lab

Salt where the sugar should be

Closed · Started , updated

A laptop with no internet, 242 documents of my own and a small AI model, put to the test as a plan B for a long power cut and closed with a verdict that fits in one sentence.

Fig. 1Emergency store

Drag to turn it.

Each query brings up the 8 sheets that fit on the desk, and once the shelves fill up a wrong one slips in among them without the answer changing its tone.

At the end of October I was nagged by a very modern curiosity, whether it is true that some artificial intelligence models fit on a USB stick. They do, because an open, compressed model takes up between 2 and 10 GB, and from there the question soon drifted towards something more practical. If one day there is a long power cut and the internet goes out along with the lights, can my laptop give me good answers about a library of my own documents, such as how to make a home oral rehydration drink, what to do about an allergy or how to put a particular appliance together, and also tell me which document each answer came from?

Long tasks I ruled out early, because a small model gets lost as soon as a job has several steps, and the brief shrank to something far more modest. As this is a plan B in case one day there’s no internet, I only need it to search locally. I also thought about buying a device dedicated to AI and let the idea go once I saw that below about €1,700 to €2,000 there was nothing clearly better than my laptop, and that those machines had almost doubled in price in a year because of the memory shortage, so the laptop got the job without sitting an interview.

6 GB in charge

The laptop is a gaming one, with 32 GB of ordinary memory, the RAM, and a graphics card with another 6 GB of its own, the VRAM, and of the two figures the small one is in charge. To write each word (strictly speaking, each fragment of a word), a language model has to do sums with all of its parameters, the numbers it adjusted during training and which hold everything it knows, and a graphics card is built for that, for doing an enormous number of multiplications at once on data it keeps close at hand. If the model fits completely in those 6 GB, each word comes out in an instant, and if part of it stays in the RAM, the sums for that part are done by the processor, which is many times slower at this kind of work, and since every word has to pass through the whole model, everything moves at the pace of the slow part.

That is why every megabyte on the card counted, and the first stocktake brought a surprise, because the desktop, with nothing open, was already taking about 1 GB of the 6, which is a lot for a model already short of room. Laptops like this one carry 2 graphics chips, a small one inside the processor, which uses little power and is quite enough to draw windows, and the dedicated card, the powerful one, and in hybrid mode the desktop is drawn by the small chip while the dedicated card stays free for the heavy work. Mine was drawing the whole desktop and the setting to change it was nowhere in the menu every guide pointed to, so the cause had to lie elsewhere, and it lay in the screens’ cable, plugged into a USB-C port that was not its own. On machines like these some video outputs are often wired straight to the dedicated card, which then has to draw whatever goes out through them, and moving the cable to another port was enough to bring the card down to 0.3 GB at rest.

Even with the card cleared, a model will not fit as it comes out of training, because a freshly trained model stores each parameter in 16 bits, so one with 9 billion parameters takes up about 18 GB, 3 times the card, and the way out is quantisation, which means storing each number with less precision, rounded off, the way someone writes 3.14 instead of 3.14159 because it is more than enough for the job in hand. The parameters are grouped into small blocks, each block keeps its own scale factor, and each number in the block is written down with only 4 or 5 bits, choosing among 16 or 32 steps, in the versions known in the trade as Q4 and Q5. On a back-of-the-envelope sum, at about 4.5 bits per number, the model with 9 billion parameters comes down to a little over 5 GB and fits on the card. All of that travels in a single file in GGUF format, which holds the rounded numbers, their scales and the description of the model, ready to be loaded by a program such as LM Studio, which is what I used to run it.

What you lose by rounding is precision, and it shows less than you might think, because a model is full of redundancy and no single parameter decides anything, so at 4 or 5 bits it writes practically as well as before, and it is below 4 that it starts to slip on things it used to get right. The trade pays off because the other way to make a model fit is to take parameters away, and what rounding costs is small next to what you lose with a model 3 times smaller.

A newly arrived librarian

To choose a model I compared 5 of them with 30 questions about this very website, which I know well and which therefore gives away any invention straight off. Of the 5, 3 had between 8 and 9 billion parameters, Qwen3.5-9B, Granite 4.2 8B and Qwen3-8B, and all 3 got 28 out of 30, though the job went to Qwen3.5-9B, which made nothing up and cited every source correctly. One of the candidates managed to cite the site with an extra e, probablementeelucas.com, which is a very original way of not finding me.

The other 2, Gemma 4 26B A4B and Qwen3.6-35B-A3B, belong to another family, the mixture-of-experts models, MoE for short. Instead of a single network that every word passes through in full, they have many specialised sub-networks, the experts, and a small component, the router, which picks a few of them for each word and leaves the rest idle. Their names say as much, since the Gemma model holds 26 billion parameters and activates about 4 billion per word, and the Qwen model holds 35 billion and activates about 3 billion. In theory this is the way to squeeze a big model onto modest hardware, because the parts that work all the time stay on the graphics card and the experts are parked in the RAM, and since only a few wake up for each word, the processor can handle their sums at a reasonable speed. Here the theory ran into the RAM, because the experts of a model like that take up many gigabytes even rounded to 4 bits, and the laptop’s 32 GB were shared with other open programs, so they did not fit and I played it safe with the model that sat completely on the card.

Qwen3.5-9B reads whatever you put in front of it very well and knows few facts by heart, because 9 billion numbers cannot hold that much of the world, so asking it cold comes down to inviting it to improvise. So a search engine sits in front of the model, and this way of working, searching the documents first and then answering with what was found in front of you, goes by the name of RAG in the trade. The whole set-up works like a newly arrived librarian, bright and quick, who for each query can only carry 8 sheets up to the desk. Before opening to the public, every document is cut into pieces the size of a sheet and every sheet gets a label summing up its meaning, so when a question arrives the librarian looks for the sheets whose labels resemble it most, carries the top 8 up and answers by reading only those, with a note of where they come from.

A new document is available the moment it goes on the shelf, without retraining anything, and that is its advantage over the other route, retraining the model on the documents, which takes a great deal of computing every time one changes, blends what it learns with what it already knew and afterwards cannot say which page it got it from.

With small, tidy shelves the librarian gets it right almost every time, and with hundreds of similar manuals they sometimes carry up the wrong sheets and answer just as calmly, because from the desk they cannot see what stayed on the shelves. For the same reason, when they say they cannot find something you should not take it entirely at face value, and in one of the tests the fact was on one of the sheets already lying on the desk and the answer was still that it could not be found.

The emergency store

Next to the librarian I set up an offline encyclopaedia with Kiwix, a free reader for downloaded collections, which I loaded with the Spanish Wikipedia, the medical Wikipedia, Wikibooks and the Mathematics and Physics forums of Stack Exchange, about 23 GB in all, of which the medical Wikipedia, pictures and all, takes up less than half a gigabyte. The collections come as ZIM files, a format that stores the articles compressed together with a full-text index, the list of which articles each word appears in, and thanks to that index Kiwix finds what you ask for in a moment without any AI inside, simply showing what is written and making nothing up. The complete Wikipedia did not go into the model’s search engine, because cutting up those 23 GB and working out a label for every sheet on the laptop would have taken days.

My own documents went into what I christened the emergency store, a folder with 6 categories (work, survival, science, engineering, personal and training), and for chatting with them I used AnythingLLM, which acts as the librarian’s front desk, since it keeps the documents, cuts them up, searches and passes what it finds to the model. Each category is a separate search space, with its own pieces and its own labels, so a question about allergies only competes with the personal documents, and the hundreds of scientific papers, which by sheer numbers would always have some paragraph with similar words, stay on their own shelves. In survival and personal I set a strict rule, that doses, allergies and procedures are copied word for word with their source and never inferred or rounded.

The heavy lifting happens beforehand, while there is still internet, and a large model does it, so the small one only has to find and read. From each document it extracts clean text, free of the layout debris PDFs drag along with them, runs the scanned ones through text recognition (OCR), since in a PDF a scan is a set of photos of pages without a single letter to search for, recovers the formulae, which tend to turn into a jumble of symbols when converted to text, and writes an index card for each document with its summary, its keywords, the synonyms someone might use to ask about the same thing and the questions the document answers. The synonyms and the questions are there for the search engine, because someone searching in the dark for a “home rehydration drink” does not use the manual’s wording, which talks of “oral rehydration solution”, and with the card in place both routes lead to the same spot. The preparation is incremental, so when a new document comes in or an old one changes, only that one is processed and the rest stays as it was.

All night cutting paper

This part is the engine room, for anyone who wants to know what happens between the question and the answer, and anyone here for the story can skip ahead to the recipe carrying a single idea, that the accuracy is decided above all by which sheets reach the desk.

It all starts with cutting. A whole document does not fit on the desk, and even if it did, its label would blend so many things that it would resemble no particular question, so it gets cut up, and the way you cut matters more than it seems. Cutting every so many words splits a table or a procedure down the middle and leaves pieces that begin mid-sentence, so I cut by sections, following the document’s own headings, and every piece carries the document’s title, its section heading and its place in the original. That way the piece makes sense on its own, without knowing what came before, and the citation points to the precise page and section.

Each sheet’s label is what is technically called an embedding, a list of 1,024 numbers that sums up what the piece is about. Those numbers work like coordinates on a map of meanings, where texts about the same thing sit close together even when they use different words, so “dehydration in children” lands next to “oral rehydration” and a long way from “strength of materials”. They are worked out by a small model trained only for that, Qwen3-Embedding-0.6B, with 600 million parameters, and when a question arrives its coordinates are calculated with the same model and the search looks for the pieces that sit closest. Closeness is measured by the angle between the 2 lists of numbers, known as cosine similarity, which is 1 when both texts point the same way and drops towards 0 when they have nothing to do with each other.

That model runs on the processor, to leave the whole graphics card to the main one. It was no faster on the card either, about 2.4 seconds per piece in both cases, because the bottleneck was elsewhere, and what brought it down to about 0.8 seconds was sending it the pieces 8 at a time.

Between the map and the desk there are 2 more filters. The first is a similarity threshold, a minimum score below which a piece is thrown out even if it is among the closest, meant to keep the model’s desk free of sheets that have no business there. It came set at 0.5 by default, and the first exams came back with 7 to 9 wrong answers, because a short question and the long piece that answers it score only a modest similarity even when they are about the same thing, and with this model that score can fall below 0.5, so a filter like that throws out precisely the good sheets. I lowered it to 0, which amounts to always letting the closest ones through, and the wrong answers in that exam came down to 1 or 2, at the price of taking twice as long to answer, because without the filter the model always receives every sheet that fits, and a model takes longer the more text it has to read before answering.

The second is the reranker, a second pass that takes the candidates the search engine has brought back and sorts them again more carefully. The search engine compares coordinates worked out separately, the question’s on one side and each piece’s on the other, which is very fast and somewhat crude, whereas the reranker reads the question and each candidate together and scores how well one answers the other, which is much slower and so is only done for the few that survived the first cut. The one that came with the program had been trained in English, and with questions and documents in Spanish its contribution went unmeasured.

I set the main model’s temperature to 0.1. At each step the model has a list of candidate words, each with its probability, and the temperature decides how much risk it takes in choosing, so with a high temperature it now and then picks a less likely word, which is what gives a poem its variety, and close to 0 it sticks to the most likely one, with steadier and less creative answers, which is what you want when a dose has to be copied out.

To know whether all this gets things right you need exams, and mine had 3 questions per document with known answers. The laptop’s model answers as it would in the middle of an emergency, and another model, a large one with the right answer in front of it, acts as the judge, which is what the trade calls LLM-as-a-judge (LLM being the usual abbreviation for a large language model). The judge classes each answer as right, wrong or invented, the last meaning the model stated something that is in no document at all, and it also checks that the citation points to the place the fact comes from. It marks with the same criteria from the first question to the last, though it is a model too and occasionally gets things wrong, which is why an exam run only once does not support conclusions about 1 or 2 points, since they fall within what would shift if it were run again.

On 1 November I tried the store with 17 sample documents, prepared for the occasion, and with those small shelves it got 43 of 45 questions right, the same in all 3 runs and without making anything up. Then I filled it with 242 public documents, downloaded legally with their origin and their licence, and the laptop spent the night cutting them up and working out the coordinates of more than 16,000 pieces. In the small hours I went over to see how things were going, without much hope of finding it finished. It’s 5 in the morning and it’s still working. I’ve certainly given it some work, eh? In the morning, with everything in place at last, I gave it the big exam, 726 questions on the 242 documents.

A recipe with its columns crossed

With 6 sheets per query it got 69% of the questions right, and letting 8 up to the desk took it to 76%, about 3 in 4, because with more sheets on the desk the right one is more likely to get in even when the search engine did not rank it first. Raising it without end does not help either, because everything the model reads has to fit in its context window, the number of word fragments it can hold in front of it at once, and that window also lives on the graphics card, where every extra fragment takes up room, so with the 6 GB shared between the model and the desk each extra sheet is paid for in memory and in time, and beyond a certain number the sheets you add are increasingly doubtful and give the model more chances to get confused.

By category, accuracy ran from 82% in work to 64% in science, with survival at 69%, and none reached 90%. The drop in science makes sense, because scientific papers are dense, full of formulae and of terms a small embedding model struggles to tell apart, and since hundreds of them use the same words for different things, on shelves like those it is easier for the search engine to carry up the neighbouring sheet instead of the right one. The librarian’s shelves had been filled with similar manuals, and they went on answering with the same composure as with the small shelves, except that now a wrong sheet came up every so often. As for actually making things up, it did so in 11 answers, and in none on survival.

Among the wrong answers was the one about the home oral rehydration drink, the mix of water, salt and sugar given for dehydration, and in it the model put the salt where the sugar should be. The document was fine, and the swap came from earlier, when the PDF was turned into text. A PDF stores where each letter goes on the page, though not always the order in which it should be read, because it was designed so that a page prints identically on any printer, and the program that converts it to text has to work out that order from the positions. With one column it usually gets it right, and with 2 columns it may read each line from one edge of the page to the other, jumping from one column into the next, which is what happened to that page, like a photocopied recipe where the lines of one column run into the other and each ingredient ends up next to its neighbour’s quantity. The model read what was on the desk and cited its source, which was a correct document.

With an assembly manual a swapped quantity costs you an afternoon, and with a drink for someone who is dehydrated it can cost a great deal more, so in an emergency a dose gets checked in the original, and the right quantities are in the official health guidelines.

Underneath all the adjustments lies the real ceiling, which is the size of the model. With 9 billion parameters, the model reads what it is given well and summarises it fluently, and while the shelves are small its scant knowledge of its own hardly matters, because the right sheet is usually on the desk. As the collection grows, more and more similar but wrong sheets arrive, the recipe for a different drink, the dose for a different body weight or the procedure for another version of the appliance, and spotting that one does not fit would take some prior knowledge of the subject, which is what a small model lacks, so it reads the wrong sheet with the same confidence as the right one. A much larger model, with more of the world inside it, would notice more often that something jars, and that model does not fit in 6 GB.

A few days before the experiment closed, Survival LLM came out, a third-party tool with the same idea, an emergency library that works offline and cites the source of every answer. In its own 22-question tests, a model of a similar size to the one I used got the essentials right in 14, and a smaller one went as far as advising against a tourniquet on an arm and recommending standing back from a fallen power line less than a tenth of the distance the official guidance asks for. By another route its tests ended up in the same place as my exams, and that same morning, when I proposed a change of approach, I compared it with that tool.

In the end, all I want is to be able to ask it things about those documents and have it answer correctly. The set-up did its job and the ceiling was the size of model that fits in a laptop, a model that finds where the answer is well enough and that, when it comes to giving it with the reliability an emergency calls for, still falls short. For a plan B without internet, the reliable part is a good set of well-organised documents and an offline encyclopaedia, and the model brings the convenience, which is no small thing, because it saves me rummaging by hand through 242 documents and tells me where to look, and with a torch in one hand that is welcome. So I closed the experiment, since the local model solution isn’t good because of a technical limitation, and deleted everything I had installed for it from the laptop.

The organised documents, their index cards and their exams would serve just as well with a better model, and that ceiling moves with every generation of models. For next time I have another way in mind of giving the model what it needs, with the knowledge already digested into a sort of wiki of short cards and pages by topic, and the originals untouched alongside.

Log

  1. · closed

    Verdict

    With the big exam marked, I close the experiment and leave the laptop as it was.

  2. · done

    Small hours

    The laptop spends the small hours cutting the whole collection into sheets and labelling them.

  3. · done

    The store, filled

    First exam on the small shelves and, afterwards, the public collection loaded in.

  4. · done

    One model out of 5

    I pick the model and set up the store by category, with Kiwix alongside.

  5. · done

    On this website, 3 out of 3

    First test with the 62 pages of the website as the exam, and the card freed up by moving the cable to another port.

  6. · done

    What there is at home

    A look at what the laptop has inside, and the dedicated device ruled out on price.

  7. · done

    AI on a USB stick

    First sums on what size of model my laptop can take.

Links