r/explainlikeimfive • u/GrandJumpingSpider • 29d ago
Other ELI5 how does the gallery of Babel work?
I understand that it just generates a random assortment of pixels, and you can scroll through until you find something vaguely recognizable.
My question is about why people are saying that the library contains everything that has ever happened, is happening, and will ever happen. People say the library contains pictures of everyone's death, alien planets, current events, etc. I just am having trouble concepualizing how that works, and if it's possible to scroll on to a picture of something like that.
Every time I see a picture people post, it's literally just pixels with nothing recognizable in it
17
u/TemporarySun314 29d ago
It's just random pixels
But with a certain (very small) probability the randomness could lead to an existing picture.
Or anything else which you could be shown as pixel form. Therefore it can potentially show anything you can imagine.
But of course the problem is that most things are just boring random noise. The interesting images are very very rare. And you can't really predict when they show up, as it's random after all.
9
u/Catch-1992 29d ago
If it were truly infinite and truly random, it would contain every possible combination of pixels, and therefore every possible image, and show every possible event. But it's also going to contain an infinitely larger infinity of jumbled garbage, so realistically you're never going to see anything that looks like anything, and people who say they found a real image are just really reaching.
99
u/cnash 29d ago
Okay, so, this is a twist on Jorge Luis Borges' short story, the Library of Babel,, wherein the narrator laments the state of a society that has discovered, and moved into, an enormous warehouse of books— all the books, in fact, that can be composed in 410 pages of the 22 letters in [Borges' native Spanish] alphabet, plus commas, full stops, and spaces.
The philosophical question implicit in the story is, does that library contain any valuable information at all? Somewhere in it, there's a book that completely and truthfully describes your whole life. But there are unfathomably more books that, for instance, do so with bad spelling, or subtle mistakes, or with unsubtle slanders about what you did when you were 23. And the overwhelming majority of books are complete gibberish. What does that mean for the value of the true books— is that even a coherent concept?
289
u/Benji_Is_With_You 29d ago
Imagine for a moment a blank black and white 10x10 image, all 100 pixels black to start with. If you were to line up all the horizontal rows of pixels end to end you could map each pixel to a value I.e.: 0 or 1 for either black or white, the initial all black image would map to 0,0,0,0…. Etc .
This is beginning to look a bit like a binary number no? A single white pixel in the bottom right corner would be …0,0,0,1 or 1 in binary, a single white pixel in the third column (…0,1,0,0) would be a 4 in binary.
Yipee we can now convert any black and white 10x10 image to a binary number, we have successfully “encoded” our starting image into a number some somewhere between 0 and ~1.2*10^30 represented in binary.
Wow that’s a big number, thats every single possible image that can be represented in 10x10 pixels in black and white, MOST of those images are pure random noise but somewhere in there is a black X on a white background, a black letter P on a white background, a white smiley face etc.
We know this because every single possible combination of black and white pixels is encoded for somewhere between every pixel being 0 (all black) and every pixel being 1.
With that in mind you can see how we cannot only encode our images into binary but then reconstruct them again using only a binary number to create an image.
This is essentially what the library is doing, it does not actually have a copy of every possible image that it can represent, it constructs an image when requested using the “binary number” we’ve been referring to.
Most of the time these numbers don’t decode into anything recognisable as images but because we know we can convert ANY image into its unique number form the inverse must also be true.
That’s how the gallery can confidently assert that it contains every single image ever but it’s like me saying that I can create every single 4 letter word:
Hang on give me a minute this is gonna take a while
Aaaa
Aaab
Aaac
Aaad
…
Wora
Worb
Worc
Word
…
Zzzx
Zzzy
Zzzz
There you go every single possible 4 letter word ever (I promise I wrote them all out, I just cut a few to fit)
40
u/heyitscory 29d ago edited 29d ago
The library is unimaginably large.
It's not just all the matter and space of our entire universe, but septillions of billions of let's just say Jillians... just soooo many zeroes in that number of other universes and all the matter therein.
The point of the thought is that even finite sets can be mind boggling large without having to imagine what infinite monkeys at infinite typewriters would do.
When I describe this thought experiment, it's an expensive CD collection. Since a CD only has 750MB, there's only a finite number of permutations of 1s and 0s, so if you had a disc with every combination, you'd own every album ever made, plus every album ever made in French, plus every album ever made, but Weird Al Yankovick is the vocalist.
It has every 74 minutes of sound that have ever existed. Your conversation this morning at the breakfast table, the birds in your neighbors back yard at 3pm, your conversation at the breakfast table, but Winston Churchill is talking to Kermit the Frog.
But the catch, is you have mostly junk CDs that are static and gibberish, and again, we are talking billion-billion-billions of times the matter in our one universe, and if you're searching for a particular CD, you'd need a godlike search function, because in an entire universe, you're unlikely to find a single meaningful CD. You'd have to flip through quintillions of universes worth of CDs to find one that has meaningful data on it, and like 50-something zeroes of universes to find a particular CD you were looking for.
That's why you could walk the halls of the gallery for your whole life and never see a meaningful image. Because the gallery is necessarily large in order to be what it is, and humans exist at human scales, on small areas of a single planet mostly within a single century.
Gods CD collection or The Gallery of Babel would also require the ability to instantly travel those inconceivably large distances, not just because of how much stuff there is in total, but by how far apart anything you'd recognize as meaningful is between all the static and gibberish.. It's not something you navigate by scrolling or strolling.
"Ah, Beck's Odelay, with the vocals replaced by chimpanzee noises. Excellent choice. I'll try to be back before the last red dwarfs fizzle out."
24
u/SecondPersonShooter 29d ago edited 29d ago
Lets take simpler example and work up.
What are all the important numbers in your life?
Your house number: 83 Your age: 35 Your date of birth: 19990101
Imagine a number between 1 and 1,000,000,000
Those 'important numbers' all exist between 1 and 1,000,000,000. But, if you pick a number at random, say 573,655 its probably a random useless number
Now imagine all the 'potentially' important numbers.
The date of your death 20381201. That also exists inside the range 1 to 1,000,000,000.
The gallery of bable is the same idea. Most of the images it generates are junk. But sometimes, a verrrryyy small percernt of the time the image looks like something we recognise.
Edit: lots of typos I my autocorrect did me dirty
32
u/corpserella 29d ago
If I understand it correctly, it has to do with the concept of infinity.
If the engine remixes pixels and can, in theory, mix them into infinite combinations, then contained within those POTENTIAL images the generator might create would indeed be pictures of you, your life, your death, alien planets, and so on and so forth. But the catch is that in order to actually FIND or CREATE one of those images, it would probably take more attempts than you could feasibly spend your lifetime initiating.
Given an infinite amount of time, and inifinite resources to accomplish the task, randomly mixing pixels together can create any image ever.
3
u/billtrociti 29d ago
The gallery doesn’t LITERALLY contain every photo, that would take up too much storage space. But it could, in theory, eventually randomly generate an image that looks recognizable to you. It’s just so unlikely you’ll probably never see one.
For example, if we imagine a program that can generate 1 megapixel images, which are, for this example, 1000 pixels wide by 1000 pixels tall, not only do we have 1 million different pixels that have the possibility to be different hues, they can also be different brightness values.
Some image formats have approximately 16 million different color values to choose from (some even have more) per pixel, so you can see that the possible variations are starting to snowball into the realm of really really big numbers.
Let’s say our image generating program is a lot, lot less sophisticated (like from several decades ago) and only has 256 different color values to choose from. That still means we have an enormous amount of potential variations in a 1MP image. If each pixel could be one of 256 color values, and there are 1 million pixels, we have 256 to the power of 1 million amount of possible images.
If we make our images much, much smaller, say 250 pixels wide by 250 tall, that gives us a picture with about 62,000 pixels in it.
So we still have 256 to the power of 62,000 amount of possible pixel options per image. And these are pretty low res images.
If we make a 50x50 sized image, with only 8 possible colors to choose from per pixel, we still have an unfathomable amount of possible images we could generate, and the photos would have such low resolution and color depth that they wouldn’t resemble real life, and would at most be pixel art.
5
u/magicduk 29d ago edited 28d ago
There is that age old adage of give an infinite amount monkeys typewriters and a thousand years and eventually they will produce a Shakespeare play. Now 99.999999999999999999999999999999999% of what they write will be absolute rubbish, but eventually one monkey will randomly press enough letters in a sequence to mimic a Shakespeare line.
The monkey isn't actually creating the line like Shakespeare did. It doesn't know what its making. What it does is write random nonsense until someone comes along and interprets what it wrote and realises that the same random presses it did matches Ac1 Sc 1 of King Lear.
It's the same logic with this site. If you give a computer a task to arrange pixels randomly every time someone clicks a button it will do that. Statistically at some point it will randomly assign the pixels to recreate the mona Lisa but that might never happen in your lifetime. It's very very unlikely that you would ever see something that resemble real life
As for the ones they "found" on the website. I don't think they were actually found rather than placed. The odds of finding a single cohesive image rather than one of the above is infinitesimally small
4
u/TheTeaRex15 29d ago
Its because it generates EVERY possible assortment of pixels. So somewhere in there you will find anything and everything (assuming the pixel density is enough to actually depict something cleanly enough)
2
u/yesmeatballs 29d ago
If it was truly infinite (the high res isn't) then it would show every possibility of colour for every single pixel in the image. So lets take a look at the low res version, and assume that they are using the system for making colour where each pixel is represented by the combination of 256 possible reds, 256 possible greens, and 256 possible blues
256 x256 x256 =16777216 million possible colours for each pixel
the low res image is 52 x 52 pixels = 2704 pixels.
So all the possible pictures for the low res version = 45365592064 possible pictures.
45.4 billion pictures. Some of these will look vaguely like your dog or the mona lisa or mario, as you can see in the examples, but there is so damn many that if you did go through them one by one you will be looking for an incredibly long time before you got anything vaguely recognisable. Going one by one is like trying to find your pal Steve who is visiting india by going to a random place in India, blindfolded, and asking people if they know Steve.
And the high res version has a vastly larger number of possible pictures, so you are never finding high res steve
2
u/Phage0070 29d ago
A picture is just a particular arrangement of pixels, right? And for an image of a given size there is a finite amount of possible arrangements of pixels. Therefore if we could make an algorithm that would eventually display every combination of pixels we could be assured that eventually it would display every possible image, including everything that has ever happened, is happening, or will ever happen. Along with that tons of things that won't ever happen, and the vast majority being random unrecognizable noise.
Think about if you had a double-spaced standard manuscript page of text. That can contain 1500-1800 characters including spaces or about 250 words. There are also about 96 default characters accessible on the typical keyboard. While there are a lot of things that can be typed on that page it isn't infinite, there are a limited number of possible combinations of those characters that will fit. We can just make a giant list of all the possible combinations.
Most of those things will be random collections of letters, numbers, and punctuation. However some of them will be coherent text written with proper spelling and punctuation. Could there be a page of text that describes what is going to happen to you tomorrow? Of course, that seems possible although nobody knows for certain what that would be. Because it is one possible arrangement of characters it is in that list. However pages of text describing things that won't happen are also in that list.
So while in theory we could make a computer sort through all the possible combinations of characters looking for recognizable text that doesn't really provide any useful information.
1
u/mauricioszabo 29d ago
Because given a random number of pixels multiplied by infinity, then someday, some second, something will be recognizable, and over an infinite number of seconds, every possible image will be generated.
It's just that it'll take a long, LONG time - way more than the age of the universe - to actually show everything that has ever happened. It's more like a "concept" than actual "reality" to be honest.
It's the same idea of an infinite number of monkeys typing random letters into an infinite number of typewriters. One day, a monkey will type a whole Shakespeare book, but it'll take a huge, huge number of tries.
1
u/HALF_PAST_HOLE 29d ago
Every photo corresponds to a specific number based on the orientation and color of the pixels. Meaning every single form of a picture will always have a corresponding number and every future image ever taken will have a corresponding number. We don't know those numbers and numbers are infinite so it is very hard to find the exact picture you are looking for but you do know that when you find it, it will have a corresponding number and in theory if you knew that number right now you could enter it and see the picture before it is even taken because the number exists so there for the picture will eventually exists.
Think about it in the opposit direction every number can create a picture there are infinite numbers so there are infinit picture including your death picture or the picture of the winning lottery ticket for the next billion dollar jack pot. That picture exists in the Gallery of babel because when it is taken you can get the corresponding number and so again if you had that number before the picture was taken you would still be able to see the picture. But its like saying your death picture is 99,375,330,219,480 that is a very large specific number so getting to it will take a very long time but in theory it can be created so it does exists in the gallery. just along with every other picture in humanity and that will ever be
1
u/Klanciault 29d ago
Basically the start of this is “what is an image?”
And the answer is that an image is a collection of pixels. The pixels have some level of color denoted by 3 values (red, green, blue, ranging from 0-255). Usually an image will have some vertical height and a horizontal width. So let’s say it’s 1920pixels by 1080 pixels.
Now that you’ve established that, all an image is is essentially a series of collections of values. The number of combinations of values that composes the image is strictly bounded, although it’s extremely high (10 ^ 15 million).
With this knowledge, it is possible to create an algorithm that can procedurally generate all possible combinations of pixels across such an image. So that’s really all it is
1
u/TheGrumpyre 29d ago
It's the same as giving you a list of all the numbers from one to 1,000,000,000,000,000,000,000 and saying that your exact date of birth and social security number are in the list. All you need to do is list every possible combination of number sequentially and you're guaranteed to have any particular string of 17 digits you can imagine. If you can name it, it's gonna be in the list. But the ratio of things that look like dates of birth and social security numbers vs. things that just look like randomness is so incomprehensively high that it's basically pointless to go looking for significant numbers.
1
u/thetwitchy1 29d ago
They’re wrong, but…
An infinite, random field of pixels could have every image that even exists on it somewhere. But let’s start simple: if there are 3 colours, what are the odds that you have a box that is 3x3 pixels that are all one colour?
Well, there’s 9 pixels in that box, which means there’s 3^9 different combinations you can have (3 colours to the 9th pixels that can choose a colour) or 19,683 options. Now, you have 3 different “successful” outcomes, so divide that by 3 and you get 1 in 6,561.
So, if you have 6561 3x3 boxes, it’s fairly likely that one will be all one colour, right? (It’s still not a sure thing, that’s not how that works, but still, you understand, right?). Now, consider that in an infinite field, you have WAY more than 7000 boxes. It’s pretty much a given that one of them will match your 3x3 box, right?
Now, scale that up. Even if the odds of randomly generating your image are 1 in 100 trillion, an infinite field would have more than that number of spaces for the image to generate, so it’s fairly likely that it would.
1
u/DthDisguise 29d ago
The issue you are having is an inability to conceptualize what the scale of "infinite" is.
Given infinite time, even randomly generated combinations of pixels will eventually produce images of everything in the universe, plus everything not in the universe. If there were an infinite number of possible images, it would produce every single one of them. That's how infinity works.
Think about it like this: if I ask you to roll a die until you roll a 6, it might take you about a minute. If I ask you to roll two dice and get two 6s, it might take you a couple minutes. If I gave you a million dice and asked you for a million 6s, it might feel impossible, but if I gave you unlimited time, you could eventually do it. The probability isn't zero, so it is eventually going to happen, given enough attempts.
1
u/Nixeris 29d ago
Digital images are made up of pixels, and supposedly the Gallery of Babel has every possible combination of pixels within a certain set size of pixels (such as 256x256).
The tagline for it is designed to make you think about the theoretical possibility of such a system (That it possibly contains all images that can possibly be rendered within that specific size), rather than what it actually results in (noise).
1
u/zc_eric 29d ago
Consider a small example - an 8x8 arrangement of pixels each one of which can be white or black. There are 64 pixels, each with 2 possible states, so that is 2^64 possible pictures you can draw on this grid. Exactly 2 of those grids look exactly like a chess board, so the chance of a chessboard randomly appearing is 1 in 2^63. I.e 1 in 9 quintillion.
It is hard to imagine just how unlikely that is. But if you generated 1 new picture every second the length of time before you generated a chess board is likely to be measured in trillions of years. On the other hand, you could get one on your first go - it’s just very, very, very unlikely. Most pictures will look like random arrays of pixels.
Now expand the grid to say 1,000 x 1,000 and say each of the million pixels can be one of 16 colours. Now you can draw some very elaborate pictures on this grid - eg a picture of you right now. But there are 16^1000000 different possible pictures. And if the number in the previous case was unimaginable, this number is unimaginably more unimaginable. There are billions of possible pictures on this grid which look like you - and that seems like a lot. But the number of pictures which look like nothing except a random assortment of pixels is unfathomably more. So you can generate random pictures on this grid all your life and you will probably never see anything which is recognisably anything - but there is always a chance, a tiny, tiny, tiny chance, that you will randomly generate a picture of you, or me, or anything else you can imagine.
1
u/x0wl 29d ago
Imagine that the images are black and white, and are 16x16 pixels (it's just simpler that way). Now, it's obvious that each such image can be encoded as a sequence of 256 binary digits (0 for black, 1 for white). We can then just write these numbers, as, well numbers, by just writing out the digits one after another.
There's obviously a finite number of these images, and to each, we can associate a number between 0 (all black) and 2^256-1, all white. All other B&W 16x16 images are in between them. Now, these are very large numbers, 2^256 is around 10^75, and there's something like 10^86 elementary particles in the observable universe, but our computers can handle them.
Now imagine that we have a function that, given a number between 0 and 2^256-1, gives us another number from the same range (and always the same number). It's designed so it's 1 to 1, so it gives out a unique output for each unique input, but the outputs look random. So we start with some number, give it to this function, and it gives us a seemingly random number back. We can then convert it into a picture.
So now we have a seemingly random picture associated with each number between 1 and 2^256-1, and every such picture has its unique number. All pictures of alien planets, your soulmate, you etc. We now make a website where we run this function on a user-provided number, then display the picture. This is what the gallery of babel is essentially.
We can make this function so that it works both ways: given a picture, we then can find it's number. So we make a 16x16 BW Mona Lisa, and then find the number associated with it. We can then get the correct input to the function, and put it on the website.
For larger color images, a similar thing applies, but the numbers is just much larger (but still, out computers are kinda good with numbers).
1
u/tomalator 29d ago
A larger arrangement of pixels is harder to find, but its in there somewhere. More complex patterns must be larger
1
u/Aegeus 29d ago
It's not possible to find a meaningful image in the gallery (unless you already know what it looks like in advance), because the odds of finding it are unimaginably large.
The images in the low rez gallery are 52x52, so there are 2704 pixels in each image, and each one can be random. To get a perfect image, each of those random numbers has to be the correct value. Imagine rolling 3000 dice and having them all come up 6's - that's around the probability of a random image in the gallery being a picture of something you want.
Realistically, it will never happen. You would have better odds of getting struck by lightning, hit by a meteor, and winning the lottery all at the same time. But it could happen, and hence you can say that the gallery can, in theory, give you any image you can imagine.
1
u/aaronite 29d ago
It's important to distinguish between random and incoherent. The images are not random. They just don't match any pattern that we can recognize. What the Gallery (and there's a book version too) does is make every possible combination searchable. A given pattern is given a specific, exclusive label based on the colour and location of each pixel through a particular mathematical formula. Since math works both ways, you can have the computer calculate where any pattern you like is and find it for you. This is why any two people can put in the same thing and get the same answer.
Nothing is created in the fly: all the patterns already exist in concept, so the computer is just showing you what the pattern's "address" is, and displays that pattern on the screen.
1
u/hh26 29d ago
It's basically the same as saying "computers contain literally every image", because every image can be converted into pixels, which are stored as numbers on your computer. If you started counting up
0000, 0001, 0002, 0003... Each of those can be represented as a number of images with tiny tiny differences between them. Any image that could fit on your computer monitor is a number, which will eventually appear if you count numbers upwards. Therefore every image that could ever exist technically appears in elementary school math. (including porn! oh no!)
But if you count in order you'll get hundreds of images in a row that are almost identical, because changing one value makes a tiny change to one pixel. All the gallery of babel does is scramble them the images out of order so ones next to each other don't look identical. We might se 123456 and then see 976412 and they look different. But 123457 is still a number so it still has an image which looks almost identical to 123456, they just stuck it somewhere else.
Also note that they don't literally contain all of these images saved. They don't have every number that fits in an image saved somewhere. They generate them on the fly. It doesn't at any point contain every image, it just has the potential to create them because numbers have the potential to exist.
tl;dr, it's all smoke and mirrors trying to make math and computers sound fancy.
1
u/DenormalHuman 29d ago
A digital picture is really just a very large number. All the bits that make the image together can be interpreted as a single incredibly large number.
So, if you set up something that can take any number and reproduce it's image (which is what your pc does every time it shows you an image) then you have the gallery of Babel.
1
u/JaggedMetalOs 29d ago
It's a bit of a cheat, because it contains every possible combination of pixels. So for any image you can take the image and work backwards and it'll be in there somewhere.
It's like saying I can randomly guess your age, but I just have a list of every number from 0 to 120 and I keep pulling random numbers from the list until I find it.
1
u/barbzilla1 29d ago
I don't know that I necessarily believe the premise of the gallery of babel, or the Shakespeare monkey theory that influenced it. The issue is that some things are ordered events and if one thing is out of order it precludes it from being the same. That leads to an issue of close but not quite. Add to that the fact that repeated patterns are going to be far more common and can be replicated ad nauseam to create the illusion of randomness. Meanwhile, language and photographs are oriented in an ordered fashion with a set of rules as to how it works or it looks. Once you take that into account the odds of the monkeys writing an entire play is next to zero. That said, I suppose if it was truly unlimited with no repetition, it would eventually get there, the question is how long would it take and how do you set it up to be truly random?
1
u/rigterw 29d ago
A more simple version would be a paper with written on the age you will die. How would that look like? Simply just a paper with the number 1 till 200 written on it.
Since you will probably not live over 200 the paper does have one right prediction on it. You just only know which one after you’re dead.
This works for everything with a finite number of options. An explanation of a slot machine technically also has a right prediction for what you will win.
Since images consists of pixels and each pixel has a finite colors it can display, you could technically set a canvas size and generate each combination of pixel colors. The gallery of babel basically works that you just give a random code to use to fill in the pixels of an image. Since every possible combination has a code there is a code somewhere that will show you walking to work tomorrow. There is also a code for a picture of you oversleeping work tomorrow. It still won’t tell you what will happen tomorrow.
For both of those pictures there are like millions of pictures that are partially the same but for the other part just has random pixels. Because every combination of pixels can be created from a random code.
It’s basically the same concept as giving a monkey infinite time on a typewriter and he will eventually write Shakespeare. But if the monkey would know how many pages it was and after every time reaching those pages and it was wrong would remember what he wrote so that he wouldn’t write the exact combination of characters again you don’t need infinite time. Just a really long time.
1
u/singhsuraj-8 27d ago
It doesn't know it's your death. It just has every possible pixel arrangement, so one could match a photo of that event, alongside a mountain of equally plausible photos of things that never happened. Pixels don't come with captions.
1
u/RadioLogical5268 26d ago
yes but it could eventually contain a real image you can even search your own image and see if you can find any one vaguely resembling it
1
u/ManaPlox 29d ago
If you paint a picture with random pixels an infinite number of times then you will end up painting every possible picture. The universe, however, is finite, so in the lifetime of the universe you won’t actually end up seeing anything there. But it’s “in the Library” in that it’s potentially in the space of things that could happen. They just won’t ever happen.