Introspection, Memory, Artificial Intelligence

Birrell Walsh
3 min readSep 18, 2021
An abacus resting in computer cables. Photo credit Gael Varoquaux on Visualhunt.com

Introspection and Memory

When we talk about Artificial Intelligence, do we mean intelligence like ours?

Of all the many ways we are aware, there are two that are central — introspection and memory.

It is not that those are the most important. It is that they are the two that tell us what is going on with us, and what has gone on with us. They are the bards of our narrative.

Do computer programs have introspection and memory? Notice I am not asking if the hardware has these characteristics. I am asking if the processes that run on this hardware have them.

- Can they look into themselves in approximately real-time, and get an answer?
- Can they store and recall former answers to the question?

Here are two Python programs that seem to show the answer to each question can be “yes.”

Introspection

# countmylines.py
‘’’ A program to open its own file and count the lines’’’
myname = “./consciousness/countmylines.py”
f = open(myname,”r”) # Open the file,
lines = f.readlines() # make an array of its lines
report = “I have “ + str(len(lines)) + “ lines.”
print(report) # This prints a report of how many lines.
f.close() # This closes the file. Good to be tidy.

This little eight-line program just looks at its own file and counts the lines in it. It makes a report of the answer. That is all it does.

Is this genuinely introspection?
- One could argue that the program is not looking at itself, but at a document about itself. Fair enough. But do we do otherwise when we read last year’s journaling?
- One could argue that this is an incomplete introspection. Again, fair enough. But do we know everything that is going on in us when we introspect? Hmmm, how is my liver?

It seems to me that when we introspect, we get partial answers based on internal representations. The program called “/countmylines.py” has done just that.

Memory

“OK,” someone might reply, “but does the program have a continuing narrative? Does it know what its state was as well as what it is? Surely that is the basis of our subjectivity.”

The program above does not have that ability. But we can build one that will have memory:

# countandremembermy lines.py
‘’’ Introspection and recall’’’
import time
myname = “./countandremembermylines.py”
f = open(myname,”r+”) # This opens the file.
lines = f.readlines() # Make an array of lines.
linecount = len(lines) # Count the lines.
local_time = time.ctime(time.time()) # Get local time.
report = f”As of {local_time} I had {linecount} lines.”
print(report) # This prints that report.
comment_report = “\n# “ + report # Make it a comment.
lines.append(comment_report) # and append it.
f.seek(0) # Go back to the top of file,
f.writelines(lines) # overwrite with new version of lines.
f.truncate() # Clean up any overage of lines.
f.close() # This closes the file.
# As of Sat Sep 18 14:43:31 2021I had 16 lines.
# As of Sat Sep 18 14:43:32 2021 I had 17 lines.
# As of Sat Sep 18 14:43:37 2021 I had 18 lines.
# As of Sat Sep 18 14:43:38 2021 I had 19 lines.

Here we have a program that counts its own lines and writes them into the very file whose lines it is counting. It also records when it made the observation.

The careful experimenter will notice that the program does not record what its current state is — at the end, when it shuts down — but what its state was when it began. Is it not so with us? Do we not always report what was going on a moment ago? About a quarter second ago, if I recall (heh heh) my neurology.

Introspection. Memory.

- One program examines itself in eight lines of code.
- Another introspects, and remember the results of earlier examinations. With 16 lines of code it makes a chronicle of its subjectivity — a simple narrative.

Of all the many features of human awareness, we accepted these two as crucial. Yet here both seem to have been shown in a running Python interpreter.

Prima facie, computers have both inwardness and reminiscence.

--

--

Birrell Walsh

For many years I was at a Public Broadcasting station, and got a doctorate in Religion and Philosophy over a decade. Now, in good company, I cook and write.