MARCmin · Shelf-taught AI

Smaller models that read can beat bigger models that memorize

Most AI progress has meant bigger models, trained on more text, running on bigger hardware. This site argues for the opposite bet: find the smallest model that can improve itself by reading, and give it the map libraries have spent a century building.

Small models, big stacks. MARCmin: MARC, the format library catalogs are written in, plus min, the smallest model that can read them well enough to learn.

Raw MARC
Real Library of Congress recordLoC record
01

Scale is the expensive path

Frontier models try to hold what they know in their weights. That takes data centers to train and run, and the knowledge freezes on the day training ends.[1]

02

Libraries already built the map

Catalog records, subject headings and classification organize recorded knowledge into a structure a machine can navigate. Most AI search ignores it.

03

Reading beats remembering

A model that finds the right book and reads the right passage answers from sources it can cite. Its knowledge grows as the collection grows, without retraining.[2, 3]

04

So search for the minimum

The question is not how big a model you can afford. It is how small a model can be and still read well enough to learn.[4]

Before the chapters · Fits your library

Works with the catalog you already have

Nothing here asks a library to change its systems. MARCmin reads the records your system already exports, builds its own search index beside them, and can run without an internet connection.

Keep MARC

Meet the data where it is

Most library systems store and export MARC21 records. Decades of cataloging live in that format, and libraries share records in it every day. Even the Library of Congress, which now catalogs in BIBFRAME, converts its records to MARC to share them.[5]

BIBFRAME, the linked-data successor, is arriving slowly, and vendors now support hybrid setups.[6] If your catalog moves, only the serializer changes. The index and model stay.

Run in parallel

Beside your ILS, not instead of it

It reads a regular MARC export, the same kind libraries send to discovery layers and union catalogs. It never writes back.

Circulation, holds and cataloging carry on unchanged. A nightly or weekly export keeps it current, and only changed records need re-encoding. Switch it off and nothing breaks.

Run offline

One device, no network

Once the catalog is encoded, search needs no connection. The index, a small embedding model and the question all live on one machine. 100,000 records take about 38 MB as 8-bit vectors (Chapter 2).

That suits a branch with weak internet, a bookmobile or a kiosk. Patron questions never leave the building, as library privacy guidance asks.[7, 8]

What it doesn't do

  • It doesn't replace the ILS or its public catalog. Live status, such as whether a copy is on the shelf, still comes from the ILS.
  • Offline search is only as current as the last export.
  • Reading full text offline (Chapters 3 and 4) needs those texts on the device too. Catalog search does not.

Chapter 1 · A readable map

When does MARC need a pre-encoder?

Before a small model can use the catalog as its map, the map has to be readable. Embedding models were trained on prose. A MARC21 record is tags, indicators, subfield codes and fixed-position codes, with the meaning tucked in between. A pre-encoder is whatever you put between the two. This page lets you try three kinds on real-looking records and then decide whether you need one.

–of the characters in the record shown are tags, indicators, subfield codes or coded values

Three kinds of pre-encoder, from cheapest to most expensive:

1. Serializer. Rules that turn a record into labeled, readable text: "Title: …", "Subjects: …", with codes like spa spelled out as "Spanish". How structured data is turned into text measurably changes model results.[9]

2. Field-aware encoding. Separate vectors for title, author, subjects and summary, weighted at query time.

3. Domain-tuned encoder. An embedding model fine-tuned on bibliographic data and real library queries. Small tuned models have beaten large hosted ones on metadata search and subject headings.[10, 11]

A record as an embedding model would see it


    
TagIndicatorsSubfield codeControl / coded data

The serializer: try it

Pick a record and switch the rules on one at a time. Each rule removes something the model would otherwise have to read past, or adds words a person would actually type. The token estimate uses about four characters per token.

Raw MARC (mnemonic view)

Pre-encoded text

Every record, same rules

Each row is one record. The line runs from its raw MARC size to its pre-encoded size under the rules above. Click a row to open that record.

Raw MARC Pre-encoded Estimated tokens
Show as a table
Use your own records (.mrc, MARCXML, or MarcEdit .mrk; UTF-8; read only in your browser)

Or paste one record in mnemonic format:

Field-aware encoding

One vector per record mixes the title with a long summary and a pile of subjects. Field-aware encoding keeps a vector per field and weights them for each query. Known-item searches ("books by Okafor", a remembered title) want title and author weight. Topical searches want subjects and summary.

Weight presets

Field-aware ranking

bar colors show which field matched

    Single vector (whole record)

    same query, for comparison

      Domain-tuned encoder

      Fine-tuning teaches an embedding model library jargon: controlled vocabulary, abbreviations and the gap between how catalogers describe a book and how patrons ask for it. It is the most powerful option and the one most libraries should do last, because a serializer with lookup tables closes much of the same gap for almost nothing.

      Catalog saysPatron typesCheaper fix first
      Fund raising.fundraisingMost embedding models handle this already; check before fixing
      Clothing and dress $x Repairing.how to fix torn jeansReadable subject strings and the 520 summary; an off-the-shelf model usually bridges the rest
      $v Juvenile fiction.kids' storyExpand 008/22 audience and add "Audience: children"
      008/35-37 spain SpanishCode lookup table in the serializer
      $4 nrtnarrated byRelator code table
      LC class QK or Dewey 581plants, botanyAdd the class caption from a schedule lookup
      A local subject or collection namewhatever your community calls itThis is where fine-tuning earns its cost

      You need

      Thousands of real query and record pairs, from search logs with clicks or checkouts, plus a held-out set to measure against.

      It costs

      Training runs, then re-embedding the whole catalog every time the model changes. It also leaves you maintaining a model of your own.

      Worth it when

      You've measured that a well-serialized record with a good off-the-shelf model still misses, at a scale where those misses matter.

      Costs and gotchas

      Your template becomes part of the index. Change a label or a rule and every stored vector is out of date. Version the serializer, store the version with each vector, and re-embed in batches.

      Character encoding. Older records may be in MARC-8, not UTF-8 (leader position 09 is blank instead of a). Convert before serializing or diacritics turn into garbage.

      Local fields. 9XX fields, item data and holdings vary by library. Decide which carry meaning for searchers and leave out the rest.

      Sparse records. Minimal-level and older records often have no summary (520). For those, subject headings and an expanded format line are all the meaning there is, which makes the serializer matter more, not less.

      When you can skip it. If search stays keyword-only in your ILS or discovery layer, those already index MARC by field. If you only hand an LLM a handful of records, it can read MARC directly, though a serializer still saves tokens.

      Decide for your collection

      Answer four questions. The pyramid shows the retrieval tier, from the simplest approach at the bottom to the heaviest at the top; the verdicts say which pre-encoders are worth it.

      How many records?
      What do people search for?
      Is the collection multilingual?
      Do you have logged queries with the records people chose?

        Chapter 2

        Small models on low-power hardware

        On a Raspberry Pi, a library kiosk or an old laptop, a small language model spends much of its time reading the prompt before it writes a word. Its context window is short, and it never learned to read MARC. Here the pre-encoder does the understanding up front, once, so the device doesn't have to.

        The compact template below keeps only what helps a small model match and answer: title, author, subjects, a shortened summary, format, language and year. It puts the meaningful fields first, because whatever comes last is what gets cut.

        Token budget

        averages over the 15 sample records
        TemplateTokens per recordRecords that fitTime to read 5 records

        Reading speed varies widely by device, model size and runtime; time a prompt on your own hardware and enter it. Token counts use four characters per token, which likely flatters raw MARC: codes, digits and diacritics split into more tokens than plain English.

        What a small embedding model actually sees

        text past the limit is dropped before embedding

        Raw MARC

        Compact pre-encoded

        Vector storage on the device

        Vectors only, before index overhead. Smaller formats lose some accuracy; 8-bit usually loses little, and 1-bit works best as a fast first pass with a re-check on the top results. With that re-check, 1-bit vectors keep about 96% of retrieval quality.[12] Keyword search (for example SQLite's built-in full-text index) needs no vectors at all and is the cheapest place to start.

        A low-power recipe

        1. Pre-encode and embed the whole catalog once, on a bigger machine. The device only embeds the patron's question.

        2. Use the compact template, meaning first.

        3. Start with keyword search; add 8-bit vectors only if people search by topic in their own words.

        4. Give the small model only the top 3 to 5 records.

        Chapter 4

        Learn by reading

        Reading before answering improves one answer. To improve over time, the system keeps what it learned as short notes, each tied to the passage it came from. The next question on the topic starts from those notes instead of from scratch. Nothing about the model itself has to change.[16, 17]

        Note 0142
        Claim:    Beaches lose sand when dams trap river
                  sediment, not only from rising seas.
        Source:   Rising water, ch. 3, pp. 61-64
        Checked:  passage supports the claim
        Used in:  3 answers
        Status:   active

        Three rules keep notes from drifting.

        1. Every note links to a specific passage.

        2. Every note is checked against its passage before it is reused. In one agent study, storing every self-written record dropped accuracy to 13%, against 38.5% with strict filtering.[18]

        3. When sources disagree, notes are flagged or retired, not silently overwritten.

        The example note and its source are invented for illustration.

        The honest limit: reading takes some comprehension. Below a certain size, a model picks the wrong passage or misreads the right one, and no amount of library structure fixes that.[15] Finding that floor is one of the main results this research is after.

        How to test the thesis

        Each question below can be answered with an experiment, and each has a result worth publishing whichever way it comes out.

        QuestionHypothesisMeasured by
        1. Readable map. Does pre-encoding MARC improve retrieval?Yes for every model, more for small onesRecall@10, nDCG@10 on a judged test set, against the Library of Congress embedded catalog as the benchmark[19]
        2. Navigation. Does browsing subject structure find better sources than similarity alone?Combining both beats either alone on topical questionsSource relevance judged by catalogers; path length
        3. Notes. Do checked, cited notes improve answers over time?Yes with checking; without it, quality driftsExpert-scored answers on a fixed question set, repeated over time
        4. Minimum viable model. How small can a model be and still match a large model answering from memory?Much smaller than expected, above a comprehension floorAnswer quality per watt, per dollar and per second, across model sizes

        What would prove it wrong

        Small models can't read reliably at any size cheap enough to matter. Navigation adds cost without finding better sources. Notes drift even with checking. Any of these is a useful finding.

        Where this fits

        Retrieval already lets far smaller models match larger ones on knowledge tasks, especially for less popular facts.[1, 2, 3] Libraries have started applying AI to their catalogs. The Library of Congress embedded about 20 million records in 2026, and new benchmarks test subject-heading assignment.[19, 11, 20] None of these yet measures patron search over MARC across model sizes. That is the gap this project fills, in the spirit of the "collections as data" movement.[21]

        Roadmap

        Phase 1, about 4 months: build an open test set of real MARC records and real questions with expert judgments, and run the pre-encoder study. The benchmark to match or beat is the Library of Congress embedded catalog.[19] This site's Chapter 1 tools become its demo, rerun on real data.

        Phase 2, about 6 to 9 months: start from the Library of Congress embeddings and build the navigating agent, testing it at several model sizes, reading from public-domain and licensed full text.

        Phase 3, about 6 months: add the notes loop and run the minimum-viable-model comparison across model sizes and hardware.

        Looking for: a partner library for catalog data and questions, catalogers to judge results, and faculty in information science who work on retrieval or digital libraries.

        The full plan is in the research proposal, and ways to help are on the Get involved page.

        Starter code

        A minimal serializer in Python with pymarc (version 5 or later). It reads UTF-8 and older MARC-8 files alike. Extend the label and code tables to match your own catalog.

        Tested with pymarc 5.4 on Library of Congress records and on a MARC-8 test record.

        import re
        
        from pymarc import MARCReader
        
        LABELS = {
            "245": "Title", "100": "Author", "700": "Contributor",
            "264": "Published", "300": "Description", "490": "Series",
            "650": "Subject", "651": "Place", "655": "Genre",
            "520": "Summary", "504": "Note", "546": "Language note",
        }
        LANG = {"eng": "English", "spa": "Spanish", "fre": "French",
                "chi": "Chinese", "vie": "Vietnamese", "kor": "Korean"}
        SKIP = {"0", "1", "2", "4", "6", "8"}   # URIs, sources, relator codes, linkage
        ABBR = {r"\bp\.": "pages", r"\bill\.": "illustrations",
                r"\bcol\.": "color", r"\bed\.": "edition"}
        
        
        def clean(value):
            for pattern, word in ABBR.items():
                value = re.sub(pattern, word, value)
            return value.strip().rstrip(" /:;,=").rstrip(".")
        
        
        def field_text(field):
            if field.tag == "245":   # title and subtitle; skip $c, authors come from 1XX/7XX
                parts = [clean(sf.value) for sf in field.subfields if sf.code in "abnp"]
                return ": ".join(p for p in parts if p)
            roles = [clean(sf.value) for sf in field.subfields if sf.code == "e"]
            parts = [clean(sf.value) for sf in field.subfields
                     if sf.code not in SKIP and sf.code != "e"]
            sep = " — " if field.tag.startswith("6") else " "
            text = sep.join(p for p in parts if p)
            return f"{text} ({', '.join(roles)})" if roles else text
        
        
        def pre_encode(record):
            lines = []
            for field in record.get_fields(*LABELS):
                line = f"{LABELS[field.tag]}: {field_text(field)}"
                if line not in lines:   # same heading from LCSH and FAST
                    lines.append(line)
        
            f008 = record.get_fields("008")
            lang = f008[0].data[35:38] if f008 else ""
            if lang in LANG:
                lines.append(f"Language: {LANG[lang]}")
            return "\n".join(lines)
        
        
        # to_unicode converts MARC-8 records (leader/09 blank) as well as UTF-8 ones
        with open("records.mrc", "rb") as fh:
            for record in MARCReader(fh, to_unicode=True):
                if record:
                    print(pre_encode(record), end="\n\n")

        Sources

        Numbers in the text link here. Several 2026 papers are preprints that have not yet been peer reviewed.

        1. Borgeaud, S., et al. (2022). Improving Language Models by Retrieving from Trillions of Tokens. ICML 2022. arxiv.org/abs/2112.04426
        2. Izacard, G., et al. (2023). Atlas: Few-shot Learning with Retrieval Augmented Language Models. JMLR 24(251). arxiv.org/abs/2208.03299
        3. Mallen, A., et al. (2023). When Not to Trust Language Models: Investigating Effectiveness of Parametric and Non-Parametric Memories. ACL 2023. aclanthology.org/2023.acl-long.546
        4. Abdin, M., et al. (2024). Phi-3 Technical Report: A Highly Capable Language Model Locally on Your Phone. arXiv:2404.14219. arxiv.org/abs/2404.14219
        5. Library of Congress (2026). Modern MARC (March 2026). www.loc.gov/marc/ModernMARC-March2026.pdf
        6. Library of Congress (2026). BIBFRAME Update Forum, February 9, 2026. www.loc.gov/bibframe/news/bibframe-update-feb2026.html
        7. American Library Association. Privacy: An Interpretation of the Library Bill of Rights. www.ala.org/sites/default/files/aboutala/content/B.2.1.17%20Privacy%20.pdf
        8. American Library Association (2026). Guidance on the Use of Artificial Intelligence in Libraries. www.ala.org/tools/standards-and-guidelines/guidance-use-artificial-intelligence-libraries
        9. Sui, Y., et al. (2024). Table Meets LLM: Can Large Language Models Understand Structured Table Data? WSDM 2024. arxiv.org/abs/2305.13062
        10. Solatorio, A. V., Dupriez, O., & Macalaba, R. (2026). Field Order Should Not Matter: Permutation-Invariant Embedding Model Fine-Tuning for Structured Metadata Retrieval. arXiv:2606.30473. arxiv.org/abs/2606.30473
        11. Tang, K. L. (2026). LCSHBench: A Multilingual, Consensus-Grounded Benchmark for Library of Congress Subject Heading Assignment. arXiv:2606.04382. arxiv.org/abs/2606.04382
        12. Hugging Face (2024). Binary and Scalar Embedding Quantization for Significantly Faster and Cheaper Retrieval. huggingface.co/blog/embedding-quantization
        13. Sun, Y., Wei, P., & Hsieh, L. B. (2026). Corpus2Skill: Distilling Enterprise Knowledge into Navigable Agent Skills for QA and RAG. EMNLP 2026 Findings. arxiv.org/abs/2604.14572
        14. Duraj, J., Khan, I., Merkelbach, K., & Elyasi, M. (2025). A Chain-of-Thought Approach to Semantic Query Categorization in e-Commerce Taxonomies. SIGIR eCom 2025. arxiv.org/abs/2601.00510
        15. Chen, H., Pasunuru, R., Weston, J., & Celikyilmaz, A. (2023). Walking Down the Memory Maze: Beyond Context Limit through Interactive Reading. arXiv:2310.05029. arxiv.org/abs/2310.05029
        16. Shinn, N., et al. (2023). Reflexion: Language Agents with Verbal Reinforcement Learning. NeurIPS 2023. arxiv.org/abs/2303.11366
        17. Park, J. S., et al. (2023). Generative Agents: Interactive Simulacra of Human Behavior. UIST 2023. arxiv.org/abs/2304.03442
        18. Xiong, Z., et al. (2025). How Memory Management Impacts LLM Agents: An Empirical Study of Experience-Following Behavior. arXiv:2505.16067. arxiv.org/abs/2505.16067
        19. Miller, M. (2026). AI Sandbox Series: The Embedded Catalog. The Signal, Library of Congress. blogs.loc.gov/thesignal/2026/10/ai-sandbox-series-embedded-catalog
        20. Bommarito, M. J. (2026). SHELF: A Synthetic Harness for Multi-Task Bibliographic Benchmarking. arXiv:2609.03047. arxiv.org/abs/2609.03047
        21. Padilla, T., Allen, L., Frost, H., Potvin, S., Russey Roke, E., & Varner, S. (2017). The Santa Barbara Statement on Collections as Data. collectionsasdata.github.io/statement

        Research proposal

        Catalog-Guided Reading Agents

        The plan to test this thesis on real data: four research questions, three phases, the data and rights involved, and how results will be measured.

        Looking for a partner library, catalogers, information-science faculty and funders.