Silence, Please

Presenting the Virtual Librarian

Laerke
HCAI@AU
6 min readMay 23, 2024

--

Front page of the Virtual Librarian.

In today’s Denmark, our libraries are often unmanned for hours, but still open. But it takes a lot for each individual to find the correct books or find new books. In this post, I will describe an AI helper for this situation. It is called a Virtual Librarian.

As a part of the project, I interviewed local librarians to find out what they can do and what my AI needs to be able to do. They said they had four main areas at work: First, library patrons come and ask where they can find specific books. Second, they ask for new book recommendations, for which through a couple of questions, the librarian can find which book might be good for the specific patron thanks to their great knowledge of books. Third, librarians help students find literature for school assignments. This part requires a lot of critical thinking and know-how. This could be either books on specific topics or good articles that are not filled with a lot of conspiracy theories. And the last task is to help users navigate the Danish bureaucracy, especially the online part with so many websites and forms to fill out. This can be strange to older people and newcomers.

Photo by Alexei Maridashvili on Unsplash

Looking at these four things I have chosen to focus on the first two. The critical thinking is not really the strong side of AI’s today so we leave that part for the real librarians for the time being. And the Danish bureaucracy is not something for any AI, or human for that matter. Here there are also the question of security; do you really want an AI help you log on to your bank? Can you be sure that it doesn’t save your credentials somewhere?

The Virtual Librarian is a AI system that can do mainly two things that a real librarian does: The first thing is recommend books based on a brief conversation with the user. The user will be asked to mention another book that they have read and liked, and from there on the AI will look at some of the themes in the book and ask questions until it can determine what book might also fall in the interest of the user. The second thing is that when asked for a book, it can show the user where that book is on a map on the page. This way it can guide the user to find the book they are looking for without the user having to look up the book in the libraries webpage and figure out how all the shelf numbers works. This last part is especially good for people who are not used to the library and how to use the current library software.

Photo by Clément Hélardot on Unsplash

To make this happen I have used a local AI: Llama 2 from Meta. This is implemented in a web app that can be used offline in any library. It can be connected to the local library database. From here the AI can get all the information it needs to connect with the users and give them the best and correct information. As you can see in the video below the user interacts with the AI through a chat interface. What you cannot see in the video is that the user’s prompt goes through some preprocessing before it is sent to the AI. Here we find out loosely what the request is about, is this about finding a book on the shelves or recommending a book? If the question is about placement the program has to send some extra information along to change the map to show the correct shelf.

Demo of the Virtual Librarian

To make the AI behave like a librarian I have “fine-tuned” it. This is a very technical term but it just means that I have trained it to act in a specific way. Here below is an example of some of the things I have given my AI. The idea is that you feed the AI with a lot of statements like these and it then sees what I would like it to answer to questions. I ask the AI to go through all my statements and learn to behave like this. It takes a whole night but then the AI is more like a librarian.

When working with AI there are a lot of things that go before it can run as the “expert” we want it to be. This is just part of it.

{
...
"Instruction": "Help my find a book to read.",
"Output": "What books have you read before?",
"Instruction": "Can you recommend a book to me?",
"Output": "Yes, what book have you read that you like",
...
}

There are some limitations with this program as well. As mentioned it is a local AI. This is a good thing as it can run offline. The downside is that my computer is not very powerful, so each prompt takes 5 minutes to handle. This is not so great in terms of usability, but this it is an implementation problem that can be solved by using a different LLM or a stronger computer.

Another limitation is that it needs a big database with a lot of metadata. I have not been able to work with a real library database, so I created a dummy database with a few books and some metadata. This limits how long the conversation can be as the AI fast reaches a point where it has “the best” recommendation from the data available from the database. Take a look at the example below. The user liked The Chronicles of Narnia, and when asked what they liked they said the characters, this leads to only one book in the database that matches this. And that is The Lord of the Rings. So that would be the recommendation for the user.

In terms of human-centered AI, we need to look at the relation between the human and the AI. The AI is supposed to be a help — a “lightweight” librarian. This means that the decision for which book to recommend should be transparent. The user should be able to go back through the conversation with the AI and see what choices they made that led to the conclusion.

The user should be able to walk into a completely new library not knowing where anything is or knowing how the current software works and still be able to use the library even without the real librarians present. This can empower new users to use the library. We want as many people as possible to be able to use the resources available. This is also people who usually would not walk up to a librarian and ask due to social or language-related issues.

This project has tried to investigate the possibility of making an AI librarian. I have made some good progress and the idea is differently possible.

--

--