Practical Necromancy for Beginners

image via user 'photos_ frompasttofuture' unsplash

Agenda

  • we're going through repositories right now to offer feedback.
  • a follow-up on networks: space syntax
  • machine learning vs genAI
  • neural networks trained to 'see' 
  • interrogating genAI from an archaeological perspective
  • some ways to use genAI to explore patterns - cogs, not interns, not gods
    • knowing more about how these things work (the archaeological approach) helps you see how these things work at a political level
    • and thus decide for yourself what/how you might/mightn't engage with them.

You can expand your overview by:

 

 

If you want to actually get anything out of your overviews, you have to do the work.

- making a note of what you read; what the author's goal was, their methods, their intended audience (not, 'other academics', but e.g.,, 'researchers engaged in an argument over what an 'assemblage' really means and how to identify the _meaningful_ relationships therein)

 

- drawing connections between what you read and what you heard in the lecture

 

- drawing connections between what the exercise does and the things you've read and heard, ie, he's giving me this exercise: why? what does the exercise do? where are the moments where my decisions about definitions and questions and so on matter?

Quick word on Repos

A brief word on space syntax

- associated with the work of Hillier & Hanson at the Bartlett School of Architecture

- an elaboration of network analysis, but for built space

- architects have found that certain measures hold implications for how a building might affect/promote/change social relationships within the space

- archaeologists say, 'if that's the case for buildings now, then that's likely for buildings in the past; therefore we might argue it is a method that lets us understand built space even in the absence of other archaeological data'

  • spaces can be represented as graphs based on principles of intervisibility
  • isovist - what can be seen from any particular point
  • axial space - straight line visibility
  • integration - uses a version of 'shortest path', the number of steps from the street to all other street segments (or rooms in a building). Illustration shows integration map for Brasilia.
  • integration is a bit like figuring out 'closeness' in a social network.
  • choice is a bit like measureing flow betweeness - take a value, choose a starting point, and divide that value as you move to adjoining steps. When you're out of value, you've gone as far as you can; what parts are connected up?
  • depth - pick a point, measure steps to all other points. Repeat for all points. Streets/room with lowest overall values shows you their 'depth' within the graph

Okay cool show me the software.

Most of it is proprietary. There are some plugins for QGIS

There is a lot of dead software, which shows there are fashions in digital archaeology same as anything else.

But this paper shows you how to do things by hand, on a small scale

Space = node

Door = edge

 

Begin by moving from a generic 'outside' node.

n = 6

MD = count the depth from one room to another:

 

outside12345
outside01
110
2210
3210
4320
5320

Deblauwe walks you through the math. It is a matter of adding up columns and calculating column and row averages. 

Note how one difference makes for a completely different experience of space! That's what these numbers capture.

so what?

- this is a way of finding and categorizing similar building or city plans: similarity implies similar ways of living or being

 

- this is a way of finding similar clusters of similar spaces within buildings or cities

- these are also movement models (see eg Laurence on Pompeii)

- sometimes, a city/building plan is all we've got in terms of archaeological evidence. Space Syntax is a set of theoretical statements that allow us to derive a method that then lets us ground an interpretation using what data we have

- such similarities can then be correlated or compared with other kinds of archaeological evidence

So, just to recap:

Networks can represent the past

Networks are present in archaeological materials

Networks can be a substrate for further simulation

Networks can problem solve

 

Neural Networks

a potted history

Dash Khatami via unsplash

Good ol' Wikipedia! https://en.wikipedia.org/wiki/Neural_network  https://en.wikipedia.org/wiki/Perceptron. Rosenblatt 1958 figures out how to take the math of Warren McCulloch and Walter Pitts, itself based on the work of 19thc and early 20thc biologists

A complex neural network

(one small slice of mouse)

https://en.wikipedia.org/wiki/Perceptron; Charles Wightman adjusting the machine

Workable ways of (re)training neural networks in a reasonable amount of time, with a reasonable amount of data*

*terms and conditions apply

Now for the main event.

What happens if we use the ability of networks to represent relationships as the substrate for computation?

 

One answer: agent based models. 

Another answer: neural networks that learn patterns.

 

(and these patterns involved imagery, at first, but any data can work)

Machine Learning vs 'AI'

LLM are a subset of machine learning.

Machine learning - learning of patterns - is enormously useful in archaeology.

There are patterns in data; finding recurrent patterns over time/space is something machines can do

Supervised vs. Unsupervised

Supervised: here are 1000 examples from class 1, here are 1000 examples from class 2, apply this set of rules (ie, an algorithm) to decide which category a new unlabeled example belongs to.

- A really good explainer for one such algorithm https://mlu-explain.github.io/decision-tree/

- classification - dealing with categories (ie: dressel-24)

- regression - dealing with values (ie, no labels: weight) (see https://mlu-explain.github.io/ for a variety of algorithm explainers)

 

Unsupervised: deploys various algorithms to find clusters of 'similar' data points, but susceptible to noise; messy data (like in archaeology) usually screws everything up.

...and what used to be difficult is now something you can do in a webpage...

- using machine learning to visualize / categorize patterns: very commonplace in archaeology

- but much depends on the quality of your data. 

- Vesuvius Challenge represents a moment when many different kinds of machine learning techniques are brought to bear

Some ways we used 

convolutional neural networks

in our study on the

human remains trade

Researchers working on machine translation would take parallel texts and try to classify words/sentences/ideas in one language by reference to another (like pictures of cats and the textual label 'cat'). Another approach was to mask out key words and then predict the missing word based on the words around it.

 

My dog has fleas.

 

Then they figured out a way to improve the results through some very clever math.

 

The consequence of that improvement: hey, if we don't tell it to stop, it will actually generate new text that follows along!  

 

Machine Translation

Thus was born generativeAI

...there's a reason these things are called 'language models'.

 

But some argue they're actually models of culture.

My first excavation involved a vampire...

Text

Colton Sturgeon, Unsplash

You're now going to get 10 weeks of my hist4805 class compressed into a single oracular presentation.

 

(by the way you can see the class at hist4805.netlify.app)

  • Who is 'I'?
  • On what basis do they have the right to make this call?
  • How do they know netlogo? And Roman history? What data?
  • This ghost-in-the-machine assumes the driver's seat - and there is no appeal.
  • Can't teach how to 'use' such a thing: Must teach how to subvert.

So I wanted to build a simulation...

Łukasz Łada, Unsplash

Nuggan

Clacks

Where do the shadows come from?

The result of that class:

sometimes, you see something so perfect it stops you dead

if they are models of culture, then there can be an archaeology of generative AI perhaps.

 

Layers of dead data, pattern detection throughout

 

so, some observations if we look at LLMs from an archaeological perspective....

We become ghosts through decomposition

datasets & ghosts

DH: analyzes an image to say this is a 'red figure kantharos'

GenAI says: here are the conventions that align with the idea of a kantharos rendered as pixel data

Generative AI is digital humanities run in reverse.... AI becomes a system for producing approximations of human media that align with all the data swept together to describe that media.

Sam Barber via unsplash

h/t to Steven Johnson for a piece connecting Molaison & Context Length

The cost of training

 

  • GPT-3: Up to 2048 tokens ~ 1500 words
  • Mistral 7B: Up to 8192 tokens ~6100 words
  • GPT-4o: From 60K to 128K tokens in some configurations
  • Claude 3.5: Up to 100K tokens
  • LLama 3.1: Up to 128K tokens
  • Gemini 1.5 Pro: Up to 1M tokens

https://datanorth.ai/blog/context-length

"The computational cost scales quadratically with the length of the context window, meaning a model with a context length of 4096 tokens requires 64 times more computational resources than a model with a context length of 1024 tokens."

and we're not even talking

here about the cost(s) of siphoning

all the content in the world to get the

necessary data

...the materiality of digital archaeology...

ChatGPT & The Eliza Effect

Isi Parente Unsplash

How are we affected by LLMs?

function ELIZA GENERATOR(user sentence) returns response
   Let w be the word in sentence that has the highest keyword rank
   if w exists
       Let r be the highest ranked rule for w that matches sentence
       response ← Apply the transform in r to sentence
       if w = 'my'
           future ← Apply a transformation from the ‘memory’ rule list to sentence
           Push future onto the memory queue
       else (no keyword applies)
           Either
               response ← Apply the transform for the NONE keyword to sentence
           Or
               response ← Pop the oldest response from the memory queue
   Return response

- who was Eliza

- what is the Eliza effect? I'll interact with it, then you tell me.

 

- the human tendency to see intentionality behind text; the Turing test and 'passing'

The TESCREAL Bundle

link

  • Techno-solutionism
  • Eschatological beliefs
  • "AGI will save us"
  • Religious fervor

sounds like religion to me.

Dr. Graham's Patented Semantic Spectrum Analyzer

 

https://shawngraham.github.io/homecooked-history/sentence-analyzer/

 

This toy lets you define a direction in semantic space and then visualize sentence fragments along that direction. Uses a language model but *not* a generative one

 

Give it a try on any AI pronouncement; define a spectrum capturing 'religiosity'. What do you spot?

link

Gods
Interns

Cogs

see Drew Breunig: The 3 AI Use Cases

God - Intern - Cog

Two Kinds of Necromancy

Impractical Necromancy

  • Large Language Models
  • Chatbots
  • Reverse DH polarity
  • Easy but destructive
  • Gods, Interns
  • Sycophantic / Mentalist

Practical Necromancy

  • Small, targeted models
  • Curated datasets
  • Ethical sourcing
  • Specific questions
  • Sweep behaviour space
  • Cogs and Widgets

No gods, no interns. Only cogs.

(which would mean way less money/power for techbro oligarchs/klept)

Three Notebooks

necromancy for good instead of evil

Homework!

now we're going to surface some ghosts in the training data

A Seance

with

Flinders Petrie

but we've already encountered Petrie, right? What might we learn by conversing with his ghostly 'nugannitic' echoes?

 

Fire up colab, go to file, open, and give it this URL in the github option:

 

https://github.com/shawngraham/hist3000-f26/blob/main/assets/notebooks/practical-necromancy.ipynb

We'll take what Petrie wrote, and fill in the gaps with an LLM.... just like those scientists at Jurassic Park filled in the gaps in dino dna with amphibian DNA.

 

And that worked out ok.

Right? ... Right...?

(we're using GPT2, a 'completion' model that can have additional layers of training added to it. By playing with this we dispel some of the Eliza effect)

You'd think this would be difficult to do.  Nope.

(and now there's a small industry of academic papers on 'digital necromancy' meaning all this)

An example I've used in other classes. Generate 1000 images from the exact same prompt. (notebook here, 1.2.1)

 

what 'attractors' for 'archaeological excavation' do we see?

Explore here.

 

We're using a slight modification to Salvaggio's method for

How To Read An AI Image

Ghosts in Text Generation?

  1. generate text with the same prompt and same settings; only thing that changes is the initial random noise
  2. text analysis to surface the 'attractors' that pull the text one way or the other
  3. simulate conversation between models and examine the discourses

(Code is in the previous repo, exercise 1.3)

Wrapping Up

same principle - different scale

https://www.youtube.com/watch?v=bxXdGBSDCHQ

DIY run-of-stream hydro electricity rig

https://en.wikipedia.org/wiki/File:Hoover_dam_from_air.jpg

genAI 

- we can study it from an archaeological perspective

- as a kind of pattern matcher, there can be times when it can be deployed for archaeological purposes

- but if pattern matching is what we're after, then we'd be better off using actual:

machine learning

- uses similar underlying architectures, but is never promoted as having some kind of 'consciousness'

 

most/a lot of genAI hype is for political purposes towards the goal of decreasing wages; the eugenics is just a 'nice' bonus

Bonus: Personal Image Search

https://github.com/shawngraham/personal-image-search-engine

 

LLM are no good for specific information retrieval; the ghosts push towards the mean, the average, so you get plausible text, not correct text.

 

This same property does permit searching by 'similarity'

hist3000 wk8

By Shawn Graham