Revelation: Using AI (Embeddings) To Study the Bible

John Bowling
5 min readFeb 20, 2024

--

Using embeddings for retrieval-augmented generation has become one of the more popular use cases for AI recently. These embeddings can sometimes provide other interesting insights (or confirmations of long-standing insights).

Revelation is commonly acknowledged to have strong connections to Old Testament books like Daniel, Isaiah, and Ezekiel. G. K. Beale’s remarks are typical in this regard:

The OT in general plays such a major role that a proper understanding of its use is necessary for an adequate view of the Apocalypse as a whole.

— The Book of Revelation: A Commentary on the Greek text. p 77

In theory, by creating embeddings of every pericope in the Bible and then looking at the cosine similarity between pericopes in Revelation and those in the Old Testament, we should be able to get a mathematical representation of which OT books are most heavily alluded to in Revelation. But this method is far from perfect.

Several caveats should be kept in mind. First, I’m assuming the adequacy of the embedding model. Specifically, I used text-embedding-3-large to create the embeddings. Second, there’s another layer of abstraction insofar as I’m using an English translation for the text. Third, there’s no universally agreed upon designation of pericopes. This presents the biggest problem for taking this method too seriously.

If we consider Revelation 1, the CSB divides this into two pericopes:

(The 2nd pericope continues to the rest of the chapter). But if we used the ESV sections as a guide, we would have 3 pericopes:

(Again, the last section continues to the end of the chapter.) Obviously, these different ways of reckoning a pericope will affect how similar one passage is to another. We could create embeddings for both (and more) and then examine the difference, but trying to determine which is best would be daunting, and in many cases there may not be a “best” choice for beginning a new section. For now, I’ve gone with the CSB’s sections as my marker for a pericope.

Caveats in mind, if we look at each pericope in Revelation and find the pericope with the highest cosine similarity in the OT, what do we find? In terms of books:

And in terms of the pericopes themselves:

As a sanity check, here’s G. K. Beale:

past attempts to tally the total number [of OT references in Revelation] have varied because of the different criteria employed to determine the validity of an OT reference and the inclusion by some authors of “echoes” and parallels of a very general nature. The range of OT usage includes the Pentateuch, Judges, 1–2 Samuel, 1–2 Kings, Psalms, Proverbs, Song of Solomon, Job, and the major and the minor prophets. Roughly more than half the references are from the Psalms, Isaiah, Ezekiel, and Daniel, and in proportion to its length Daniel yields the most.

The evaluation of Daniel as most influential is supported by recent study. Among the allusions to Daniel, the greatest number are from Daniel 7. Ezekiel ranks as the second most used OT book, although in terms of actual number of allusions Isaiah is first, followed by Ezekiel, Daniel, and Psalms, though statistics differ. There is more agreement that Ezekiel exerts greater influence in Revelation than Daniel (on which see below).

— ibid

The limitations of the CSB pericope reckoning can be seen by looking at something Beale says later when discussing Revelation 1:19 as “an interpretative key to the book”:

1:19 is the most important of a series of verses in Revelation that allude to Dan. 2:28–29, 45. That it is based on and shares a common context with Dan. 2:28–29, 45 can be demonstrated by showing the overt influence of Daniel 2 in three other critical verses: 1:1; 4:1; and 22:6. Since these key texts allude to Daniel, it is likely that 1:19, perhaps the most critical verse of all, does also.

— ibid, 152

If we look at the cosine similarity of Daniel 2:28–29, 45 with all the pericopes in the Bible, the most similar (outside of other pericopes in Daniel) is Revelation 17:7–18 (0.48). And if we look at the cosine similarity of Revelation 1:19 with all the pericopes in the Bible, the most similar (outside of the New Testament) is Ezekiel 43:1–12 (0.38). [Edit: In an earlier version I mistakenly listed Daniel 7:9–14 — a confusion from looking at notes where I was testing Beale’s claim for 1:1, 4:1, and 22:6. Daniel 7:9–14 is the most similar for 1:1 (0.38) for those curious.]

Why the discrepancy? It’s not hard to take an educated guess if we take a look at the pericope in which we find Daniel 2:28–29, 45. There is no single pericope! The CSB counts vv. 28–29 as part of a section spanning 2:1–30 and v. 45 occurs in a section spanning 2:31–45. So given how I’ve marked out pericopes, the meaning of Daniel 2:28–29 is going to be wrapped up as part of the meaning of section with quite a lot of diversity. For instance, it’s going to be wrapped up with Daniel 2:4, among others:

The Chaldeans spoke to the king (Aramaic begins here): “May the king live forever. Tell your servants the dream, and we will give the interpretation.”

One solution might be to just look at the cosine similarity of Daniel 2:28–29, 45 and Revelation 1:19 and see if its greater than that of the former and, say, Revelation 17:7–18 (0.48)? Programmatically, I’ve got an easy way to create embeddings for some arbitrary passage or text and compare it to embeddings I’ve already added to a database. This is why I can look at all pericopes and Daniel 2:28–29, 45 or all pericopes and Revelation 1:19. But currently I don’t have any way to compare two or more arbitrary passages together. Lord willing, tomorrow I’ll write some code for that and update the results.

Update: the cosine similarity between Revelation 1:19 and Daniel 2:28–29, 45 is 0.32. If we consider just the phrases picked out by Beale (“What things must take place in the latter days” and “what is about to take place after these things”) the cosine similarity is 0.57. If we compare the phrase Beale picks out in Revelation 1:19 (“what is about to take place after these things”) with every other pericope in the Bible, the highest matches are the apocalyptic narratives in the gospels — though none rank as high as the phrases in Daniel (“The coming of the Son of Man” pericopes in Luke and Matthew — 0.42 and 0.41 — and “The Lesson of the Fig Tree” in Mark, 0.41).

--

--

John Bowling

Throwing half-baked ideas against the wall and seeing what sticks.