Thursday, April 25, 2024

Review: A Brief History of Intelligence

 A Brief History of Intelligence is a surprisingly good book, given that its title purported to also be about AI. Rather than being even a little bit about AI, the book is actually an evolutionary approach to 

intelligence, and it covers its topic really well, even innovatively. The approach is to discuss the rise of human-like intelligence by following the taxonomy and evolutionary history, and the approach is particularly good.

For instance, the rise of brains is tied to an organism's ability to steer and move:

The first brain and the bilaterian body share the same initial evolutionary purpose: They enable animals to navigate by steering. (kindle loc 1046)

Surprisingly, he notes modern ailments of depression can be observed even in relatively primitive intelligences such as a nematode:

 If a nematode is exposed to thirty minutes of a negative stimulus (such as dangerous heat, freezing cold, or toxic chemicals), at first it will exhibit the hallmarks of the acute stress response—it will try to escape, and stress hormones will pause bodily functions. But after just two minutes of no relief from this inescapable stressor, nematodes do something surprising: they give up. The worm stops moving; it stops trying to escape and just lies there. This surprising behavior is, in fact, quite clever: spending energy escaping is worth the cost only if the stimulus is in fact escapable. Otherwise, the worm is more likely to survive if it conserves energy by waiting. Evolution embedded an ancient biochemical failsafe to ensure that an organism did not waste energy trying to escape something that was inescapable; this failsafe was the early seed of chronic stress and depression. (kindle loc 1046)

Then there's the rise of reinforcement learning, and the problem of temporal credit assignment when it comes to learning. When something succeeds, how do you know which of the things you did in the past was what gave rise to the success! It turns out that reinforcement learning, where you co-evolve both an actor and a critic, is what allows temporal credit assignment to make learning possible in animals:

 Dopamine is not a signal for reward but for reinforcement. As Sutton found, reinforcement and reward must be decoupled for reinforcement learning to work. To solve the temporal credit assignment problem, brains must reinforce behaviors based on changes in predicted future rewards, not actual rewards. This is why animals get addicted to dopamine-releasing behaviors despite it not being pleasurable, and this is why dopamine responses quickly shift their activations to the moments when animals predict upcoming reward and away from rewards themselves. (kindle loc 1619)

 Then the author (Max Bennett) explores how memory evolved as part of being able to simulate the world as a brain develop, and why human memory is so famously unreliable. In effect, when you're remembering something, you're projecting into the past and recreating the environment you remember you were in. The problem is that you're using generative algorithms to re-create those memories, and the same hallucinations you might have encountered in AI systems are also responsible for creating those false memories. Your memories of the past and your ability to project into the future and create plans are both sides of the same coin, and in many ways equally unreliable!

Once you have a memory system and a way to simulate the world, then you're able to spatially map the world and gain useful data. In an open ended environment (Benett points to a paper using Montezuma's Revenge as an example), it turns out that you need to evolve a new instinct in order to solve extremely complicated problems:

 The approach is to make AI systems explicitly curious, to reward them for exploring new places and doing new things, to make surprise itself reinforcing. The greater the novelty, the larger the compulsion to explore it. When AI systems playing Montezuma’s Revenge were given this intrinsic motivation to explore new things, they behaved very differently—indeed, more like a human player. They became motivated to explore areas, go to new rooms, and expand throughout the map. But instead of exploring through random actions, they explored deliberately; they specifically wanted to go to new places and to do new things...The importance of curiosity in reinforcement learning algorithms suggests that a brain designed to learn through reinforcement, such as the brain of early vertebrates, should also exhibit curiosity. And indeed, evidence suggests that it was early vertebrates who first became curious. Curiosity is seen across all vertebrates, from fish to mice to monkeys to human infants. In vertebrates, surprise itself triggers the release of dopamine, even if there is no “real” reward. And yet, most invertebrates do not exhibit curiosity; only the most advanced invertebrates, such as insects and cephalopods, show curiosity, a trick that evolved independently and wasn’t present in early bilaterians. (kindle loc 2058-2065)

One interesting thing is that the way learning works is that both actor and critic reinforce each other, but must ultimately be guided by real senses and real world results. When you no longer get real input, the entire system is capable of hallucinating:

 People whose eyes stop sending signals to their neocortex, whether due to optic-nerve damage or retinal damage, often get something called Charles Bonnet syndrome. You would think that when someone’s eyes are disconnected from their brain, they would no longer see. But the opposite happens—for several months after going blind, people start seeing a lot. They begin to hallucinate. This phenomenon is consistent with a generative model: cutting off sensory input to the neocortex makes it unstable. It gets stuck in a drifting generative process in which visual scenes are simulated without being constrained to actual sensory input—thus you hallucinate. (kindle loc 2545)

 Similarly, this explains also the presence of activities such as dreaming. The evolution of imagination is also important, and points to the fact that both generation and recognition occupy the same circuits in brains and cannot be done simultaneously:

The most obvious feature of imagination is that you cannot imagine things and recognize things simultaneously. You cannot read a book and imagine yourself having breakfast at the same time—the process of imagining is inherently at odds with the process of experiencing actual sensory data. In fact, you can tell when someone is imagining something by looking at that person’s pupils—when people are imagining things, their pupils dilate as their brains stop processing actual visual data. People become pseudo-blind. As in a generative model, generation and recognition cannot be performed simultaneously. (kindle loc 2569)

 The book goes on to explain autism and human social behavior and language. There's too much going on there in order to quickly summarize in a review, but essentially, one more layer of the cortex can be devoted to monitoring the brain itself. This might not seem to be useful, but is in fact, what's necessary in highly social primate groups in order to develop theory of mind to maintain social status. This need then gives rise to consciousness and self-awareness (you need all that to simulate the perspective of other brains), and the need to do so also gives rise to language.

The book contains lots of interesting ideas and is well worth reading. I highly recommend it!


Thursday, April 18, 2024

Re-read: Zen and the Art of Motorcycle Mainteneance

 I last read Zen and the Art of Motorcycle Mainteneance in 2013, and this might turn out to be a book I should re-read every 10 years or so, as the meaning of the book keeps changing for me over the decades. On this re-read, I found myself rediscovering how much the book influenced me. For instance, on this time around, I highlighted the argument about a degreeless, gradeless college:

he would come back to our degreeless and gradeless school, but with a difference. He’d no longer be a grade-motivated person. He’d be a knowledge-motivated person. He would need no external pushing to learn. His push would come from inside. He’d be a free man. He wouldn’t need a lot of discipline to shape him up. In fact, if the instructors assigned him were slacking on the job he would be likely to shape them up by asking rude questions. He’d be there to learn something, would be paying to learn something and they’d better come up with it. Motivation of this sort, once it catches hold, is a ferocious force, and in the gradeless, degreeless institution where our student would find himself, he wouldn’t stop with rote engineering information. Physics and mathematics were going to come within his sphere of interest because he’d see he needed them. Metallurgy and electrical engineering would come up for attention. And, in the process of intellectual maturing that these abstract studies gave him, he would be likely to branch out into other theoretical areas that weren’t directly related to machines but had become a part of a newer larger goal. This larger goal wouldn’t be the imitation of education in Universities today, glossed over and concealed by grades and degrees that give the appearance of something happening when, in fact, almost nothing is going on. It would be the real thing. (pg 189)

I realized now that I was that student in college. I was the guy working two jobs while going to school full time, and I was intentional about learning, as opposed to being there for the degree. I had another student once asking me why I was working so hard on a class I was taking Pass/Fail (where grades didn't count). My reply at the time is that I'm taking the class because I was actually interested in the topic, and taking it pass fail so that I really could concentrated on learning instead of grades. That answer completely mystified the other student. I did get pissed when classes were moving slower and covering less material than I'd hoped. It also led to a total lack of empathy with other students --- when your parents are paying for college you might have a different attitude from the guy living on ramen and trying to scrape by. And by the way, this is why I got so pissed at Republicans claiming that those of us on Pell grants and financial aid were there looking for a handout and less deserving than those who were living on what us poverty-line types called "F&M scholarships" --- father and mother scholarships.

Recently, Vermont was telling me about asking one of the other engineers to slow down, and pay more attention to detail and care rather than rushing through trying to close jira tickets as quickly as possible. This book has such a strong echo with Vermont's exhortations:

Impatience is best handled by allowing an indefinite time for the job, particularly new jobs that require unfamiliar techniques; by doubling the allotted time when circumstances force time planning; and by scaling down the scope of what you want to do. Overall goals must be scaled down in importance and immediate goals must be scaled up. This requires value flexibility, and the value shift is usually accompanied by some loss of gumption, but it’s a sacrifice that must be made. It’s nothing like the loss of gumption that will occur if a Big Mistake caused by impatience occurs.

It’s the way you live that predisposes you to avoid the traps and see the right facts. You want to know how to paint a perfect painting? It’s easy. Make yourself perfect and then just paint naturally. That’s the way all the experts do it. The making of a painting or the fixing of a motorcycle isn’t separate from the rest of your existence. If you’re a sloppy thinker the six days of the week you aren’t working on your machine, what trap avoidances, what gimmicks, can make you all of a sudden sharp on the seventh? It all goes together. (pg. 309, 316)

This is such a great book. All engineering managers should have to read this book, and probably should recommend it to their direct reports. And if you need motivation to become a better mechanic:

A person who knows how to fix motorcycles—with Quality—is less likely to run short of friends than one who doesn’t. And they aren’t going to see him as some kind of object either. (pg. 349)

I bought this book 11 years ago. It's still worth reading, and I get new stuff out of it every time I read it. You can't get more highly recommended than that. 

Thursday, April 11, 2024

Kirby Cove Campground Trip

Whenever I visit recreation.gov, I always find that there's one campground that looks super-appealing, and that's Kirby Cove Campground. Of course, every time I tried to book it, it was booked up, especially since those of us who are working stiffs with kids in school can't afford to do anything other than a weekend trip. Then during the New Year's Eve Wildcat Campground trip, Daniel told me the secret trick to booking the site.  Armed with that secret trick, it took me only 2 weeks to book campsite #1 at Kirby Cove for the first weekend of April.

Booking that far out is always risky, but fortunately, the rain that was supposed to land on both Thursday and Friday got revised out to only Thursday night, so we were assured of dry weather during the weekend. Both kids and Xiaoqin had caught some sort of viral infection but we decided to do the trip anyway, given how hard it had been to book it.

When you book 2 nights at the campground, surprisingly few people will come for both nights. Each campsite can hold 10 people, so we invited friends, including Stephan, his dad, and his son Otto and some neighbors for Friday, and Mickey and Kevin's families for Saturday. I had a full weekend of hikes planned as well.

Arriving at 4:00pm at the campground we followed the instructions to unlock the gate and drove down to the campground, stunned by how nice it was. Campsite #1 was amazing, with 2 tent pads with views of the golden gate, and its own private swing! We pitched a tent and then went out to eat --- in retrospect we should have bought take out just to enjoy how nice the campground was! It was windy when we arrived, but the campground itself was sheltered so putting up the tent was much easier than expected.

Stephan and Allan's family showed up much later but they were no less impressed. The cold made sleep difficult, but the view in the morning was more than worth ti.

Breakfast with a view of the golden gate is amazing. 


We then convoyed up to Trojan point to start the classic hike on Matt Davis trail and then return on Steep Ravine.


The views and greenery was amazing, with flowers starting to bloom. The forest flowers were by far the highlight, since they'd gotten so much water that the growth was verdant.
We visited Stintson beach and had lunch there, and with some difficulty peeled the kids away from the beach for the hike back up to the Pantoll Ranger Station.

Steep Ravine was nothing short of amazing, with the creek sounding like jet engines roaring, and the stream demonstrating multiple cascades, including some which we hadn't seen before because the recent rains had been so heavy.

We finished the hike in great spirits, returning to the campground to find Kevin already there. We got a chance to explore the beach, including the tunnel, the caves, and then Mickey showed up with a portable grill and made burgers for everyone!
Saturday at Kirby Cove was much different than Sunday, with lots of day trippers and visitors who would walk down the dirt road for access and take pictures, sit on the beach, or just explore.


When dinner was over we'd sit and watch the sunset and watched the city lights turned on slowly. It was magical.

On Sunday morning, we packed everything up slowly after breakfast and then went for my second day's plan. I was going to go for a bigger hike but most people looked pretty tired so opted to start everyone at the morning sun trailhead.

The SCA trail + morning sun combination is the easiest hike with most scenery for the buck you can get in the Bay Area. The views are stunning, and best of all, the non-enthusiastic hikers can treat it as a one way hike to the parking area while those who can't get enough can double back and fetch the car and pick them up.


Wildflowers were blooming and we stopped to take photos so often people asked us why it was taking us so long to walk back to the car!

When the hike and pick up was over, all the other families were done but it was just 12:30pm which was perfect timing for visiting Point Bonitas Lighthouse while it was still open, something I've never achieved because of the narrow 3 hour opening window. So we went down to Sausalito and bought take out Mexican food and then drove through the tunnel again to the lighthouse parking area and ate lunch.

The lighthouse access tunnel was great, and nicely sheltered from the prevailing wind, which was blowing much harder than I expected given what we experienced in the morning. Despite all the signs telling us that access was restricted to 49 people at the lighthouse at a time, it must have been a light traffic day because the rangers and docent who were tasked with counting people never stopped anyone from crossing the suspension bridge and exploring the lighthouse. I noted that there's a guided tour available at sunset for people who want to see the lighthouse turn on.


At the end of the trip I asked Boen if he thought Wildcat Campground was better or Kirby Cove and he said: "Kirby Cove, no contest!" The campground is restricted to 3 nights a year a person so I guess we'll have to return next year if he likes it so much!

Thursday, April 04, 2024

Review: Bryton Gardia R300 Radar

 I use my Garmin radars so much that the batteries on them that their batteries start wearing out after about 3-5 years of use. When the batteries wear out you can call Garmin and they'll give you a 20% discount on a replacement unit (there's no way to replace the battery in them). In February, there was an Amazon lightning sale on the Bryton Gardia R300 Radar where the price was $85 pre-tax, so I bought one at that price to test.

The biggest feature of the Bryton is that it charges using USB-C. That means one less cable tip to have to carry while touring. It also purportedly has better battery life. Pairing with my Garmin Edge 840 was no problem, but the ANT+ light profile doesn't really work --- the light will not turn on or off properly, nor can you set the light mode to flashing or solid from the Edge.

In use, the radar works fine --- I haven't found any false negatives or false positives that wouldn't have happened to the Garmin unit. What does happen is that on occasion the Bryton will disconnect from the head unit and immediately reconnect. That's not a big deal --- the reconnection was so fast that it wouldn't make me concerned about the safety. The fact that the head unit can't control the light mode is a bigger deal to me. Obviously the Bryton also wouldn't get firmware updates via the head unit. You have to manually connect it to your phone and then use the phone app to update it.

At $85 this unit is a steal, with the lower price and USB-C charging more than offsetting the inconvenience of manually having to turn the light on and off.  I wouldn't pay full price for the unit, but even the discounted price of the Garmin is $160, which is still more than the $110 street price the unit typically sells for at Amazon.

Garmin's acquisition of the radar unit and subsequent launch and rollout has been very successful --- that Wahoo didn't support the radar for 2 years caused me to switch head units back to Garmin. That they are only now getting serious competition for the radar light itself means that Garmin has had the time to refine and improve the unit and capture majority market share. If you don't already have a radar unit I would have no hesitation in recommending the Bryton.


Monday, April 01, 2024

Reread: Among Others

 After reflecting upon Days at the Morisaki Bookshop, I went back and re-read Among Others. Most books are worth reading once, but Among Others strikes me as being particularly brilliant (or "brill") upon a second reading. Written as a diary, the book narrates Morwenna Phelps' experience as an alienated mid-teen in a boarding school after surviving an adventure in which she loses a twin, runs away from home, and meets her father for the first time.

Like many nerdy kids, her primary refuge was in books. The book references come early and often, and the nice thing about the kindle edition of the book is that you get direct links to various books in the kindle store. One of the books referenced didn't have a link and I looked it up and to my horror discovered it was Zelazny's The Dream Master, which was selling used for $77.34, and not to be found at the library anywhere.

The book has many elements of an autobiography. Having met Jo Walton, she walks with a limp and of course, her repertoire of science fiction novels and knowledge is unparalleled. But anyone who grew up loving books and science fiction will enjoy the depiction of a reader's first discovery of Robert Silverberg's Dying Inside.

Reading this book made me remember how ephemeral meetings and friendships were in the 1980s and 1990s. People would move and change phone numbers and you'd never see them again. There were no smartphones or location sharing apps, so if someone was late or couldn't make it you wouldn't know if it was because they were in an accident or if they decided to stand you up. And if you wrote someone a letter and they lost your address or just never wrote back you had no idea why.

Most of all, the book is about the need for a social connection. Even the nerdiest of book lovers (like Morwenna Phelps) feels the need to discuss the books they read with like-minded individuals, and back in those days there was no internet (and nowadays maybe there's no internet either, as many online forums have turned into toxic waste dumps). The book reminded me of meeting a classmate for the last time when the semester was over. She saw the book I was reading (Lord of Light) and exclaimed, "You're reading the classics!" We chatted about the books we'd read in class, our lives after graduation, exchanged addresses, and despite exchanging a letter or two, never saw each other again.

Among Others deserves both its Hugo and Nebular awards. I should buy my own copy instead of checking it out from the library every time!

“You’re so lucky,” Wim said, surprisingly. “Lucky? Why?” I blinked. I am not in the habit of thinking I am lucky, even when my leg isn’t strapped to a rack. “Having a rich father who reads SF. Mine thinks it’s childish. He was okay with it when I was twelve, but he thinks reading at all is sissy and reading kid stuff is babyish. He roars at me whenever he catches me reading. My mother reads what she calls nice romances, sometimes, Catherine Cookson and that sort of thing, but only when he isn’t in the house. She doesn’t understand at all. There are no books in our house. I’d give anything for parents who read.” (kindle loc 3501)