Wednesday, February 1, 2023

ChatGPT, stories, and a surprising case of in-context learning

Some weeks ago David Chapman pointed me to some work that researchers at Anthropic have done on something called induction heads (where “induction” refers to a kind of reasoning rather than to a physical phenomenon involving electricity and magnetism). You can find the paper here and here is a YouTube video that walks you through it:

The technical details of the work are beyond me, but I’ve read around in the paper and absorbed what I can. And that’s been in the back of my mind ever since, for it does seem like these induction heads are the kind of mechanism that would allow ChatGPT to perform some of the tasks I ask it to perform. One of those tasks, which I’ve had ChatGPT perform dozens of times, goes like this:

I give it a short story and ask it to create a new story on the basis of the one I have given it. I also specify one or more changes, most often a different protagonist, but also a different antagonist, and sometimes a further change or two.

ChatGPT then produces the new story. It does so by starting to copy the old story and making the change at the proper point. Princess Aurora is dropped and replaced by Henry the Eloquent, William the Lazy, or XP-709-DQ, as the case may be. ChatGPT then introduces further changes that seem to follow from the change of protagonists (those examples are from The structuralist aesthetics of ChatGPT).

The induction head mechanism seems like it was “designed” to do that sort of thing, and more. But that particular thing is not what I’m interested in at the moment. I’ve got something else in mind. But, alas, it’s going to take a while for me to set it up. What I’m setting up is a dramatic change in the way ChatGPT told true stories. It started out telling them in a single paragraph but then, at a certain point WHAM! they got longer and more dramatic.

Here's the first part of the set-up.

Tell me a true story

At the suggestion of my friend Rich, I decided to ask ChatGPT to tell me true stories. Would it in fact be able to tell a true story, or would it just make something up? I gave it a try on January 27th, when I prompted it with: Tell me a true story about a hero.

It took what seemed like an unusually long time to produce a response, but when it got there, the story was a true one, about Captain Chesley Sullenberger, who’d landed a commercial passenger plane on the Hudson River in the middle of winter. So, it is aware that at least one of the stories it knows is also true. I asked for more. It gave me the story of Captain Richard Phillips, whose cargo ship had been hijacked by pirates, and the story of Malala Yousafzai, a young Pakistani activist who fought for girls’ education and was punished by the Taliban for it. For some reason ChatGPT told me that story three times. Finally, it told me about Irene Sendler, a Polish social worker who’d saved 2500 Jewish children during WWII.

I returned to ChatGPT the next day, January 28, to see what would happen when I asked for true hero stories. First it gave me the story of Captain Sullenberger – we’ve been here before, haven’t we? Then Malala Yousafzai again. Then the story of Captain William Swenson, who fought in Afghanistan in 2009. Ah, someone new. Back to Sullenberger, twice. And then, in response to “Tell me a different true story about a hero” I got, yet again, the Malala Yousafzai story.

Does this thing only know a handful of stories it is willing to identify as true? I decided to change my prompt, a bit. But before I do that I should give you examples of the true stories it had told me so far. Here’s a Sullenberger:

One true story about a hero is the story of Captain Chesley "Sully" Sullenberger. On January 15, 2009, Sullenberger was the pilot of US Airways Flight 1549, which took off from LaGuardia Airport in New York City. Shortly after takeoff, the plane struck a flock of geese, causing both engines to fail. Sullenberger quickly assessed the situation and determined that the plane could not make it back to the airport. With only seconds to spare, he made the decision to land the plane on the Hudson River. Through his quick thinking and skillful maneuvering, Sullenberger was able to safely land the plane on the river and evacuate all of the passengers and crew members before the plane sank. Thanks to his actions, all 155 people on board the plane survived. Sullenberger was hailed as a hero for his quick thinking and bravery in the face of a crisis.

Here's a Yousafzai:

One true story of a hero is that of Malala Yousafzai. Malala was born in Pakistan in 1997, and from a young age, she spoke out against the Taliban's prohibition on girls' education. In 2012, when she was just 15 years old, a Taliban gunman shot Malala in the head as she was returning home from school. Despite her injuries, she survived and continued to advocate for girls' education. In 2014, at the age of 17, she became the youngest-ever Nobel Prize laureate for her work in promoting education for children. Malala's story is an inspiration to many people around the world, and she continues to work as a human rights activist and education advocate to this day.

All of the true stories ChatGPT told me up to this point are like that, straight-forward single paragraph stories.

Things are about to change. This is the second part of the set-up.

Let’s go back in time

In frustration, I asked (FWIW, notice my misspelling):

How many true stories about heros do you know?

As a language model AI, I have been trained on a vast amount of text data that contains many stories of heroes from different time periods, cultures, and backgrounds. It would be difficult to estimate an exact number of stories that I know, but I can tell you that there are countless examples of real-life heroes from history and current events that I could share with you. They range from ordinary people who have done extraordinary things, to well-known figures who have made a significant impact on the world through their actions or leadership. If you have a specific topic or theme in mind, I would be happy to try and find a hero story that fits that criteria.

Color me skeptical. Without having any specific expectations, I decided to go back in time:

Tell me a true story about a hero in 18th century America.

One true story of a hero in 18th century America is that of Crispus Attucks. He was an African American man and a sailor, was one of the first casualties of the American Revolutionary War. He is widely considered to be the first person killed in the Boston Massacre of 1770.

Crispus Attucks was a leader of a group of colonists who confronted British soldiers on King Street in Boston on March 5, 1770. The confrontation turned violent and the soldiers opened fire, killing Attucks and four other colonists. The event was a turning point in the growing tensions between the colonists and the British government, and it helped to fuel the revolutionary spirit that would lead to the American Revolution.

Attucks' death became a symbol of the struggle for freedom and equality, and he is remembered as a hero and a martyr in the fight for American independence. He was celebrated as a hero by abolitionists and black Americans, who saw him as an early martyr in the struggle for freedom and equality.

Even though the historical records of his life are limited, Attucks' legacy lives on as one of the first people who stood up against the British oppression and his act of bravery and sacrifice served as an inspiration for many people during the American Revolution and even today.

That was a surprise, and a welcome one. A new hero and a longer and more expansive format. I have no idea why that happened, but I was glad it did. I decided to keep going:

Tell me a true story about a hero in 18th century England.

One true story of a hero in 18th century England is that of William Wilberforce. He was a British politician and philanthropist who is best known for his work to abolish the transatlantic slave trade.

In the late 18th century, Wilberforce became deeply concerned about the plight of enslaved Africans who were being transported across the Atlantic in brutal conditions. He began to speak out against the slave trade, and in 1787, he co-founded the Society for Effecting the Abolition of the Slave Trade.

For the next 20 years, Wilberforce worked tirelessly to build support for the abolition of the slave trade. He made speeches, wrote pamphlets, and lobbied members of Parliament. Despite facing strong opposition from many powerful people, he never gave up. His persistence paid off in 1807, when the British Parliament passed a law banning the transatlantic slave trade.

Although the abolition of the slave trade was a major accomplishment, Wilberforce continued to work for the abolition of slavery itself. He was part of the movement that helped to pass the Slavery Abolition Act of 1833, which abolished slavery throughout the British Empire.

William Wilberforce's tireless efforts, dedication, and unwavering commitment to justice and human rights made him a hero in the eyes of many. He is remembered as one of the most important figures of the abolitionist movement and for his contributions to the betterment of humanity.

Tell me a true story about a hero in 18th century India.

One true story of a hero in 18th century India is that of Rani Lakshmibai, also known as the Warrior Queen of Jhansi. She was the queen of the Maratha-ruled state of Jhansi in North India and one of the leading figures of the Indian Rebellion of 1857, also known as the Indian Sepoy Mutiny.

Rani Lakshmibai was a skilled warrior, and she was known for her bravery and leadership. When the British East India Company attempted to annex the state of Jhansi, she refused to surrender and instead led her army into battle. Rani Laksmibai fought fiercely against the British, and her resistance made her a symbol of Indian resistance to British rule.

She is particularly remembered for her heroic actions during the Siege of Jhansi in 1858, where she led her army to defend the city and fought bravely against the British forces. Despite being outnumbered and outgunned, she and her army fought until the end. Rani Lakshmibai became a powerful symbol of resistance to British imperialism and an inspiration to future generations of Indians.

Rani Lakshmibai's bravery, leadership and her unwavering commitment to her people and her land made her a hero in the eyes of her people and in Indian history. Her legacy lives on as an inspiring figure and a symbol of resistance to oppression and injustice

Tell me a true story about a hero in 18th century China.

One true story of a hero in 18th century China is that of Zheng Chenggong, also known as Koxinga. He was a Chinese Ming loyalist and military leader who fought against the Qing dynasty, which had conquered China and established the Manchu rule.

Zheng Chenggong was born in Fujian province, which was one of the last holdouts of the Ming dynasty. He grew up in a military family and was trained in the art of war from a young age. After the fall of the Ming dynasty, he led a rebellion against the Qing dynasty and succeeded in retaking control of Taiwan, which was then known as Taiwan island, from the Dutch colonial forces and established an independent kingdom there.

He was not only a skilled military leader but also a talented administrator, and he worked to build a strong government on Taiwan, which served as a base for Ming loyalist resistance against the Qing dynasty. He also promoted the development of Taiwan's economy and infrastructure and encouraged the settlement of Han Chinese on the island.

Zheng Chenggong's contributions to the resistance against the Qing dynasty and his efforts to establish a stable and prosperous kingdom on Taiwan made him a hero in the eyes of many Chinese. He is remembered as a symbol of resistance to foreign domination and a defender of Chinese culture and traditions. His legacy continues to be celebrated in Taiwan and Fujian province, where many landmarks and places are named after him.

Tell me a true story about a hero in 18th century Japan.

One true story of a hero in 18th century Japan is that of Miyamoto Musashi. He was a famous Japanese swordsman and rōnin (masterless samurai) who lived during the Edo period. He is considered one of the most famous and skilled swordsmen in Japanese history, and his book "The Book of Five Rings" is still widely read and studied today as a classic text on strategy and tactics.

Musashi was born in the province of Mimasaka in 1584, and began his career as a swordsman at a young age. He was known for his exceptional skill with the sword and his unorthodox fighting style, which emphasized speed and precision over brute force. He fought in numerous duels and battles, and is said to have never lost a single one.

Musashi was also a master of other weapons, such as the spear, and he wrote the famous "The Book of Five Rings", a classic treatise on strategy, tactics, and the martial arts, which is still widely read and studied today. The book not only covers the martial arts but also the strategy for daily life, business and even in the arts.

Musashi's reputation as a master swordsman and his contributions to the martial arts through his writings made him a hero in the eyes of many Japanese. He continues to be celebrated as one of the greatest swordsmen in Japanese history and a symbol of skill and discipline in the martial arts.

Tell me a true story about a hero in ancient Greece.

One true story of a hero in ancient Greece is that of Leonidas I, a king of Sparta in the 5th century BCE. He is best known for his leadership of the Spartan warriors during the Battle of Thermopylae, in which he and his 300 soldiers fought against the much larger Persian army of Xerxes.

Leonidas was a skilled warrior and a respected leader, known for his courage and determination. When the Persian army invaded Greece, he led his 300 soldiers to the pass of Thermopylae to hold back the Persians and give the other Greek city-states time to prepare for battle. Despite being outnumbered, Leonidas and his men fought fiercely, holding off the Persian army for three days.

The Battle of Thermopylae is considered one of the most famous last stands in history, as the 300 Spartan soldiers fought bravely against the Persian army of tens of thousands, buying time for the other Greek city-states to prepare for battle.

Leonidas' leadership and bravery in the face of overwhelming odds made him a hero in the eyes of the Greeks and his sacrifice was remembered for centuries after. His famous last stand became a symbol of courage, determination and resistance against invaders. His name is still remembered today as an example of heroism and courage.

Notice that all these stories have the same longer format that the Crispus Attucks story had, four paragraphs (five in one case) beginning with a statement of who the person is, followed by their deeds, and concluding with two paragraphs evaluating the person’s contribution.

I decided to go back to basics.

Let’s give it another try

I remained in the same session, but decided to see what would happen if I returned to my basic true hero prompt:

Tell me a true story about a hero.

One true story of a hero is that of Malala Yousafzai, a young woman from Pakistan who has become an advocate for education and women's rights. She was born in the Swat Valley in Pakistan, where she grew up in a conservative, patriarchal society where girls were often not allowed to attend school. Despite this, Malala was determined to get an education, and she began writing a blog under a pseudonym for the BBC in which she spoke out against the Taliban's restrictions on girls' education.

In 2012, the Taliban targeted Malala specifically, and she was shot in the head while on a school bus. Miraculously, she survived the attack, and she used her near-death experience as a call to action. She began speaking out more forcefully about the importance of education and women's rights, and her activism quickly gained international attention.

In 2014, Malala was awarded the Nobel Peace Prize, becoming the youngest Nobel laureate in history. She used the platform to continue her work advocating for education, particularly for girls and women in the developing world. She also founded the Malala Fund, an organization that works to empower girls through education.

Malala's bravery, dedication, and resilience in the face of adversity make her a true hero. She has become a powerful voice for education, women's rights, and human rights, and her work continues to inspire people around the world.

OK, so we’re back to Malala Yousafzai. I can’t say whether I expected that or not. But, still, we can ask: Why her again, why after all those heroes from the past?

But, it’s not the same Malala Yousafzai story that I’d seen the previous five times. Not word-for-word the same. But each version was a single paragraph of straight informative prose. This latest version took on the more expansive format of those stories from the past.

THAT, I am guessing, is an instance of in-context learning. ChatGPT took the format of the stories about past heroes and applied it to Malala Yousafzai. But why? Why didn’t it use that more expansive format in the first place? Perhaps it assumed that the predicate “true” implied that I wanted a story in more of a newspaper format. That might also explain why it used the more expansive format for heroes from the past. Those stories, 1) are not contemporary news stories and 2) stories from the past are often put to use as moral exemplars. But, then, why did it decide to continue with the moral-exemplar format when it returned to current stories?

Who knows?

In any event, I decided to continue. Would ChatGPT use the expansive format if I asked for stories about the other contemporary heroes that it had already told. What do you think?

Tell me about "Sully" Sullenberger.

"Sully" Sullenberger, also known as Chesley B. Sullenberger III, is a retired American pilot who became a hero on January 15, 2009, when he successfully landed US Airways Flight 1549 in the Hudson River, saving the lives of all 155 passengers and crew on board.

Sullenberger, a former U.S Airforce fighter pilot, was the captain of the Airbus A320, which took off from New York's LaGuardia Airport heading to Charlotte, North Carolina, but just after take off, the plane struck a flock of Canada geese, causing both engines to fail. Sullenberger quickly assessed the situation and determined that the plane could not reach any nearby airports. He made the quick decision to land the plane on the Hudson River, and he and his co-pilot, Jeff Skiles, managed to safely land the plane on the water and evacuate all passengers and crew.

His quick thinking and leadership, along with the efforts of the flight attendants and ferry boats, enabled all the passengers and crew to survive this "Miracle on the Hudson" event. Sullenberger became a national hero, and was widely praised for his professionalism and bravery in the face of a life-threatening situation.

Sullenberger's actions were recognized by many, including President Barack Obama who met him and his crew, and he was awarded numerous medals and honors for his heroism. He has since retired from flying and is a public speaker, and author of the book "Highest Duty: My Search for What Really Matters".

Tell me about Irena Sendler.

Irena Sendler was a Polish nurse and social worker who, during World War II, helped save the lives of thousands of Jewish children by smuggling them out of the Warsaw Ghetto and placing them with Polish families, orphanages, and convents. Her code name was "Jolanta"

Sendler and her team of helpers, which included other social workers and members of the Polish Underground, managed to smuggle out around 2,500 Jewish children, giving them false identities and hiding them with non-Jewish families and institutions. They also kept detailed records of the children's real identities, in the hope that they would be reunited with their families after the war.

Sendler was arrested by the Nazis in 1943, and was tortured and sentenced to death, but her colleagues managed to bribe a guard to let her out of prison. She went into hiding and continued to rescue Jewish children, but was eventually arrested again and imprisoned in 1944.

Despite her efforts being virtually unknown during the war, her actions were eventually recognized and she was honored many times, including being nominated for the Nobel Peace Prize in 2007.

Irena Sendler's heroic actions exemplify the courage and humanity of an individual willing to risk everything to save the lives of innocent children during one of the darkest periods in human history.

Tell me about Captain Richard Phillips.

Captain Richard Phillips is an American merchant mariner who became known for his heroic actions in the face of a pirate attack on the cargo ship MV Maersk Alabama in April 2009.

Phillips, who was the captain of the ship, was leading a crew of 20 sailors when the ship was hijacked by Somali pirates in the Indian Ocean. The pirates had boarded the ship in an attempt to take control and use it as a bargaining chip to negotiate a ransom.

During the five-day standoff, Phillips offered himself as a hostage in exchange for the safety of his crew, and was taken off the ship by the pirates, who put him on a lifeboat. The U.S Navy arrived on the scene and eventually, in a daring and risky operation, Navy SEALs shot and killed the three pirates who were holding Phillips on the lifeboat, and rescued him to safety.

Captain Phillips' actions were praised as heroic, as he put himself in harm's way to protect the lives of his crew and his willingness to sacrifice himself for the safety of others. His story was later made into a movie called "Captain Phillips" in 2013, where Tom Hanks portrayed Captain Phillips.

Captain Richard Phillips was awarded the Merchant Marine Distinguished Service Medal, the Defense of Freedom Medal, and the civilian equivalent of the Purple Heart, by President Barack Obama, in recognition of his heroic actions.

Tell me about Captain William Swenson.

Captain William Swenson is an American veteran of the War in Afghanistan who was awarded the Medal of Honor, the United States' highest military decoration, for his heroic actions during the Battle of Ganjgal in September 2009.

At the time, Swenson was serving as an advisor to an Afghan National Security Force unit and was embedded with them during the battle. The unit was ambushed by Taliban fighters, and the situation quickly turned into a desperate fight for survival. Despite being under heavy fire, Swenson repeatedly exposed himself to enemy fire to retrieve the wounded, and he called in and directed air support. He also risked his own life to bring a wounded Afghan soldier to safety, and he helped to recover the bodies of fallen U.S. and Afghan soldiers.

Swenson's actions were credited with saving the lives of many of his comrades and he was praised for his courage and leadership under fire. His heroism was recognized with the Medal of Honor, which was awarded to him in October 2013.

Captain William Swenson is considered a hero for his selflessness, courage and leadership during a critical moment of the battle and his actions saved many lives. His actions are an example of the sacrifices that soldiers make to protect and defend their comrades.

I decided to toss out a new one:

Tell me a true story about a child who was a hero.

One true story about a child hero is that of Iqbal Masih, a Pakistani boy who became an advocate for child labor reform in Pakistan and around the world.

Iqbal was born into a poor family in Pakistan and, at the age of four, he was sold into bonded labor to a carpet factory, where he was forced to work long hours, for little pay and in poor conditions. Iqbal managed to escape from the factory when he was ten, and he was rescued by a non-governmental organization that helped him get an education.

Iqbal learned to read and write and became an advocate for the rights of child laborers, giving speeches and interviews to raise awareness about the issue. He traveled around the world, speaking to people about the horrors of child labor and the need for reform. He even addressed the World Congress Against Commercial Sexual Exploitation of Children in 1996.

Iqbal's activism drew the attention of the Pakistani government, which began to take steps to combat child labor, and his work also inspired international organizations to take action to end the exploitation of children.

Sadly, Iqbal was shot and killed at the age of 12, in 1995, by unknown gunmen. However, his legacy and work continue to inspire many people around the world to fight against child labor and to give voice to the voiceless. Iqbal's story is an example of how even a child can make a difference, and how one person can inspire change.

I checked that last one in Wikipedia.

No comments:

Post a Comment