<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE TEI.2 PUBLIC "-//TEI P4//DTD Main Document Type//EN"
"http://www.infomotions.com/alex/dtd/tei2.dtd" [
<!ENTITY % TEI.XML         'INCLUDE' >
<!ENTITY % TEI.prose       'INCLUDE' >
<!ENTITY % TEI.linking     'INCLUDE' >
<!ENTITY % TEI.figures     'INCLUDE' >
<!ATTLIST xptr   url CDATA #IMPLIED >
<!ATTLIST xref   url CDATA #IMPLIED >
<!ATTLIST figure url CDATA #IMPLIED >
]> 
<TEI.2>
  <teiHeader>
    <fileDesc>
      <titleStmt>
        <title>Generative-AI Does Zero-Shot Classification</title> 
        <author>Eric Lease Morgan</author>
        <respStmt>
          <resp>converted into TEI-conformant markup by</resp>
          <name>Eric Lease Morgan</name>
        </respStmt>
      </titleStmt>
      <publicationStmt>
        <publisher>Eric Lease Morgan, &#169; Infomotions, LLC</publisher>
        <address>
        	<addrLine>eric_morgan@infomotions.com</addrLine>
        </address>
        <distributor>Available through the Distant Reader at <xptr url='https://distantreader.org/blog/zero-shot-classification/' />.</distributor>
        <idno type='reader'>98</idno>
        <availability status='free'>
          <p>This document is distributed under a GNU Public License.</p>
        </availability>
      </publicationStmt>
      <notesStmt>
       <note type='abstract'>In a simplified way, this blog posting describes show generative-AI does zero-shot classification works.</note>
      </notesStmt>
      <sourceDesc>
        <p>This posting was originally written on June 8, 2026, probably for the Code4Lib mailing list.</p>
      </sourceDesc>
    </fileDesc>
    <profileDesc>
      <creation>
        <date>2026-07-22</date>
      </creation>
      <textClass>
        <keywords>
          <list><item>generative-AI</item><item>zero-shot classification</item></list>
        </keywords>
      </textClass>
    </profileDesc>
    <revisionDesc>
      <change>
<date>2026-07-22</date>
<respStmt>
<name>Eric Lease Morgan</name>
</respStmt>
<item>initial TEI encoding</item>
</change>
    </revisionDesc>
  </teiHeader>
  <text>
    <front>
    </front>
    <body>
      <div>
  <p>One of the coolest things generative-AI does for me to automatic zero-shot classification.</p>

  <p>Zero-shot classification takes a given word and identifies other nearby words in the same vectorized space. These other words can often be associated with themes which can be used to characterize a document (or sets of documents). 'Sounds like library work to me.</p>

  <p>
  <table rend="right">
<row>
<cell rend="center">
<figure url="./cloud-small.png">
<lb/>
<figDesc>
<xref url="./cloud.png">Word cloud</xref>
</figDesc>
</figure>
</cell>
</row>
</table>
For example, I have a collection thirty-eight book-length science fiction stories. Among other things, I counted and tabulated all the nouns in all the documents, and I created a word cloud visualizing the frequencies. In the form of a paragraph, here is a similar, albeit truncated, list of the noun frequencies:</p>

  <quote>time (34); man (31); face (30); eyes (29); hand (29); thought (29); room (28); way (27); good (26); men (25); moment (25); world (25); air (24); feet (23); voice (23); door (21); head (21); earth (20); half (20); left (19); look (19); thing (19); body (18); life (17); light (17); place (17); people (16); ship (16); water (16); stories (15); work (14); red (13); day (11); girl (11); going (11); ray (11); space (11); death (10); doctor (10); sir (10); floor (9); night (9); story (9); bird (8); city (8); house (8); mind (8); moon (8); professor (8); sun (8); away (7); carnes (7); dark (7); come (6); course (6); human (6); know (6); miles (6); power (6); saw (6); years (6); arms (5); big (5); captain (5); dead (5); father (5); god (5); metal (5); old (5); plane (5); right (5); round (5); second (5); speed (5); bell (4); days (4); end (4); george (4); green (4); heart (4); high (4); jim (4); larry (4); lay (4); love (4); mcguire (4); mother (4); science (4); sea (4); set (4); things (4); tommy (4); von (4); wall (4); young (4); anita (3); blue (3); business (3); cage (3); cave (3); chief (3); dalis (3); deck (3); diane (3); fire (3); gens (3); glass (3); grantline (3); great (3); gregg (3); ground (3); gun (3); holroyd (3); home (3); hour (3); hours (3); jungle (3); kind (3); king (3); lady (3); machine (3); magazine (3); master (3); migul (3); miko (3); mrs (3); open (3); sarka (3)</quote>
  
  <p>Now, if I were to ask you to use the nouns to characterized the documents, then what might your response be? How nuanced would be your response, and how much time would it take you to articulate it?</p>

  <p>I submitted my entire list of noun frequencies -- about 700 of them -- to a large language model and said, "Use the given noun frequencies to describe the science fiction collection." The following (long) bulletted list was returned:</p>

  <quote>
    <emph rend="em">
      <p>A walk through the most frequent nouns reveals the genre's preoccupations with striking clarity:</p>

      <list type="bulleted">
        <item>The body in space: man, men, eyes, face, hand, body, head, feet, blood, heart, brain, shoulders, fingers&#x2014;the human figure as the central instrument of perception and action</item>
        <item>The built environment: room, door, wall, floor, window, corridor, chamber, cage, cabin, hall, temple, palace&#x2014;enclosed spaces, often labyrinthine</item>
        <item>The cosmos as setting: world, earth, space, moon, sun, stars, planet, mars, sky, ocean, sea, air&#x2014;a vocabulary of vast, often hostile geography</item>
        <item>The machinery of wonder: ship, machine, metal, engine, motor, tube, switch, generator, dynamo, telescope, robot, craft&#x2014;the apparatus through which the impossible becomes possible</item>
        <item>The apparatus of knowledge: professor, doctor, scientist, laboratory, machines, instruments, apparatus, experiment, discovery</item>
        <item>The vocabularies of dread: monster, creature, beast, devil, tentacles, horror, terror, madness, death, danger</item>
        <item>The languages of power and rule: government, army, navy, captain, commander, colonel, president, officer, police, sergeant, soldiers&#x2014;the genre's persistent entanglement with state, military, and empire</item>
        <item>The materials of the future: metal, steel, gold, silver, copper, brass, bronze, radium, oxygen, diamond&#x2014;a metallic, mineral imagination</item>
      </list>
      
      <p>A few nouns warrant special note. Doctor (1,132) and professor (922) appear with nearly equal frequency, suggesting a science fictional world populated by two distinct classes of expert: the practical healer and the theoretical sage. Robot (275) and robots (132) confirm the genre's growing interest in artificial beings, while monsters (325) and creatures (361) gesture toward the Lovecraftian and Wellsian traditions of biological strangeness. Chapter (467) reminds us how much of this corpus consists of serialized magazine fiction.</p>

    </emph>
  </quote>
  
  <p>I then requested a shorter, paragraph length version of the same:</p>

  <quote>
    <emph rend="em">
      <p>The noun-cloud of the science-fiction carrel sketches a literature overwhelmingly preoccupied with the human body in enclosed illuminated spaces&#x2014;man (10,907), eyes (4,281), face (3,375), hand (3,211), room (3,209), door (1,066), walls (904), corridors (459)&#x2014;set against a planetary backdrop of world (2,331), earth (1,378), sun (636), moon (511), stars (426), space (311), Mars (281), and ocean (385), and populated by a small population of expert agents (professor 922, doctor 1,132, captain 612, commander 149) operating electromechanical apparatus (ship 1,029, machines 792, engine 220, dynamo 75, robots 132) made of metal (256), steel (181), and radium (62), in a constant affective state of fear (459), death (456), and escape (442) that is haunted by older supernatural frameworks (God 63, devil 61, gods 62, ghosts 28, soul 76, miracles 16); the lexeme is unmistakably that of a specific early-twentieth-century moment when the white Anglo-Saxon imagination was projecting itself onto Mars, the moon, the ocean floor, the South American jungle, and the interior of the atom, finding in each new place the same hierarchies, the same apparatus, and the same heroic bodies it had brought with it from the home culture.</p>

    </emph>
  </quote>
  
  <p>And then as a single sentence:</p>

  <quote>
    <emph rend="em">
      <p>The nouns of the science-fiction carrel map a literature of heroic male bodies navigating enclosed, metal-laden interiors and planetary frontiers&#x2014;populated by expert agents wielding electromechanical apparatus against forces of fear, escape, and supernatural dread&#x2014;revealing the lexical fossil of an early-twentieth-century Anglo-American imagination that exported its hierarchies and heroic figures onto every available frontier from Mars to the ocean floor.</p>
    </emph>
  </quote>
  
  <p>LOL and :-D</p>

  <p>How did the large-language model do this work? It did it through automatic zero-shot classification. It saw words like "man", "men", "eyes", "face", "hand", "body", and "head" and associated them with "body". It saw words like "ship", "machine", "metal", "engine", and "motor" and associated them with "machinery". It saw words like "world", "earth", "space", "moon", and "sun" and associated them with "cosmos". It saw words like "government", "army", "navy", "captain", "commander", and "colonel" and associated them with "power" and "government".</p>

  <p>Okay, I do not assert the generated characterizations are completely "true", but then again, what characterizations -- human- or computer-generated -- are? Instead, I assert the characterizations are pointers to truths. I believe the characterizations are more true than they are false. Yet a person still MUST apply information literacy to the result. MUST.</p>

  <p>Finally, this sort of process could be employed in Library Land and in all sorts of ways:</p>

  <list type="bulleted">
    <item>Digitize our cherished special collections. Apply natural langauge processing to the digitized items, and use generative-AI to assist in the interpretation of the result.</item>
    <item>Insist bibliographic index vendors make it easy to download hundreds of citations from their platforms. Apply natural language processing to the bibliographics, and use generative-AI help the student, researcher, or scholar identify the really most important articles; help then summarize, identify outliers, and plot thematic changes over time.</item>
    <item>Do the same with social media posts, newspaper articles, collection of books from the HathiTrust, Project Gutenberg, or the Internet Archive. Etc.</item>
  </list>
  <p>Library technology is evolving.</p>

</div>

    </body>
    <back>
    </back>
  </text>
</TEI.2>
