v0.1.2: Reality and Perception

Download v0.1.2 for:

Discuss on HN

Reality and Perception

ZAMM now shows the exact contents of API calls made to ChatGPT. You can also finally continue a past conversation by restoring it from an API call.

សួស្ដីឆ្នាំថ្មី, happy Khmer New Year! I’ve also added custom Khmer fonts as a less noticeable change. I was encouraged by initial successes with ChatGPT being able to find the right Khmer word for me to use. You see, the current Khmer textbook I’m studying was written for people who haven’t learned the script yet, and so it spells out Khmer words in an Anglicized fashion. For example, the book tells me that the Khmer word for “instead” is “jum-neurh.” But using the Latin alphabet to represent Khmer words makes it hard for me to know exactly what sounds are expected in the pronunciation, and makes it impossible for me to recognize the word when I read it in a piece of Khmer text.

Sometimes, as in the case of “jum-neurh”, my usual online dictionaries at dict.antkh.com and dictionary.tovnah.com won’t list the specific word I’m looking for as a translation of “instead.” ChatGPT, on the other hand, was indeed able to guess that the word was ជំនួស:

Word for "instead" in Khmer

But then it was unable to figure out that “bee-jayng” for MSG in Khmer is actually ប៊ីចេង:

Word for "MSG" in Khmer

(ប៊ីចេង does not appear on either antkh or tovnah. These online dictionaries do have somewhat spotty coverage of Khmer words.)

Whenever I correct ChatGPT on its Khmer, it always responds as if it knew that all along. “Ah, yes, it is indeed commonly used in this manner!” I was curious how true this actually was:

See if ChatGPT actually understands "ប៊ីចេង" in Khmer

Okay, so it actually has no clue whatsoever. Oh well. Khmer fonts are added anyways, even if it looks like I won’t be asking ChatGPT about Khmer for a while.

There’s also other small tweaks, like getting the settings page columns to look neat and aligned, and to show the dedication upfront rather than waiting until the credits finish scrolling:

Credits screen

Behind the scenes, I started using SSIM for test screenshot comparisons to cut down on test flakiness, because WebKit somehow doesn’t render text with the same exact kerning every single time. As such, I suppose I’m not technically alerted anymore if a single pixel changes, but I should be alerted if enough pixels change for a screenshot to look noticeably different.

Meanwhile, to implement the list of API calls, I had to create a page that lists out all the API calls for the user to click on:

API calls screen

To do that properly, I had to make the list scrollable. I could’ve just fallen back on the browser default of having the whole page be scrollable instead, but that doesn’t fit my desired aesthetics.

To do that properly, I should reuse the scrollable implementation I made for the chat component. But that implementation was baked directly into the chat code, so I had to refactor out that scrollable code to make it usable across different components. (Refactoring refers to the process of reorganizing and decluttering your code so that new parts can be added without too much hassle. In this case, refactoring meant extricating code that was enmeshed with one component, so that the same code could now be reused across different components in the app.) For what it’s worth, I did find out about Melt UI afterwards — although even if I had used it, I would’ve still had to implement scroll shadows and infinite scroll callbacks myself.

To do that conveniently, it seemed best to upgrade to SvelteKit 2, which allows for non-module exports from child components. Fortunately, this one went off without a hitch. The battery of tests I have accumulated over time really paid off by giving me high confidence that all was well despite the unusually silent upgrade.

This sort of cascade of problems happens to me quite frequently while coding, and I am slightly embarassed to say that I sometimes approach real life problems this way as well. Two years ago, I was living in Phnom Penh in an apartment that had poor air conditioning. The room would feel warm even with the AC at full blast. The landlord of course said that there’s nothing wrong with the AC, that this is simply as good as it gets in the building. This being the first time I’ve encountered such a problem, I thought the best solution would be to splurge on a second portable AC to add to the room. Lo and behold, the AC hose came up just short of the window:

AC with short hose

Returns in Cambodia aren’t really a thing, especially once you’ve opened the box. So I went back to the store, and they told me that while they don’t have any longer hoses, they could sell a second hose of the same length to me. I bought that second hose, but there didn’t seem to be a good way to connect both hoses together, so I just duct-taped them. This setup technically worked, but because the hose is so fat, the window had to be opened wide. Now there’s so much warm air coming in from outside that the AC isn’t really making much of a difference.

To deal with that, I ordered a window seal that’s designed to solve exactly this problem for portable ACs. I also ordered a tube end that minimizes the amount the window needs to be open by. The result did finally turn out to give me a more tolerable temperature inside the room on hot days:

Final AC configuration

Unfortunately I don’t have a picture of the entire final contraption, but it looked janky as hell. Next time this situation crops up, I wager I’ll just get myself a large fan.

Outside of coding, I’ve fully settled into my new life in Siem Reap. Unlike Australia, it took all of two days to find and sign a lease for an apartment I liked, and all I had to do was to provide my passport and payment for the bond + first month’s rent. I got a one year self-employment business visa here, which again unlike Australia took only two weeks, my passport, and the visa processing fee. I don’t know why this society is so implicitly trusting in this particular way, without even so much as a background check on me, but I don’t personally mind it of course.

After I finished procuring the usual essentials for my apartment, I started learning Khmer again, this time at Be Like Khmer. I have to say, I much prefer this school over the IFL that I studied at two years ago. It’s not that the IFL is bad, it’s just that I didn’t get to learn as much informal daily speak there. I’d learn things like តើអ្នកសុខសប្បាយជាទេ? (the equivalent of “How do you do today, sir?”) rather than បងសុខសប្បាយ? (the equivalent of “How are ya dude?”). Okay, I exaggerate slightly — they didn’t actually teach us to use the តើ there, although they did teach us to use it in other questions. Also, as a proper university, they’re perhaps more concerned about preparing you for business meetings than preparing you to hang out with randos on the street.

I’m proud to say that my progress is finally paying off somewhat. I successfully conversed enough in Khmer to know that I didn’t want to buy a motorbike from one particular shop, then to get the motorbike I did buy fixed, and finally to schedule an appointment with the cleaning lady. It’s not much, but at least I no longer feel completely helpless when talking to someone who doesn’t know English. It’s more common here in Siem Reap than in Phnom Penh, which I actually kind of enjoy as someone trying to learn the language, because back in Phnom Penh the person I’m talking to would usually switch to English as soon as I hit any difficulty talking in Khmer, and I would also be too diffident to insist on talking in broken Khmer. I feel this unspoken social pressure to use the easiest mode of communication available. But when the easiest mode of communication is conversing in Khmer, as difficult as that might be for both of us, I no longer feel as if I have to choose between practicing Khmer or making things harder on the other person.

Speaking of motorcycle shops, I did end up buying my first motorbike, a used 50cc Honda Giorno. It’s perhaps a bit concerning that the one time I took a motorcycle course back when I lived in Seattle, I failed it. In my defense, 80% of my class failed too. In the instructor’s defense, he usually has a 97% pass rate, and was also perplexed at why our batch in particular did so poorly. Anyways, I’ve been practicing riding a lot, and have gotten much more comfortable with casual rides to nearby spots in the neighborhood. April is the hottest month in Cambodia, and this year temperatures have been regularly reaching 40C and above, with humidity making it feel like 45C and above. Riding a scooter instead of walking has been a major improvement in my quality of life. And of course, it’s fitting for ZAMM to include motorcycles, although I clearly have yet to actually learn any motorcycle maintenance.

I also did my taxes for 2023. Even back when I was a high earner, I never really minded paying my taxes because my family used to be poor enough that I got free healthcare as a sickly child from Medicaid for children, and I got free college from a combination of federal and state aid that was actually enough to cover all of my tuition, rent, and food. In a way, I’m perhaps a poster child for how government investment into public welfare programs can pay for itself many times over in the long run, and I do wish most Americans could also get the free education and healthcare that I was so fortunate to receive. So I don’t mind paying my taxes, but I do hate the process of having to scrounge up all the different tax documents from each financial institution I’ve interacted with over the last year, and I do hate that at least some of the difficulties around tax preparation come from lobbying efforts by TurboTax and H&R Block.

(Also, when I had trouble accessing certain details about my past year’s return, TurboTax’s customer service hotline nonchalantly explained to me that “all bets are off” if I’m trying to access my account from overseas. Seriously, billions in revenue every year, and you can’t even be arsed to support overseas access? Needless to say, I did my taxes with a small accounting business this year.)

At this point, this blog is starting to also become a personal chronicle of how I’ve spent my time and effort outside of ZAMM. But the original impetus for that was due to a lack of validation from visible progress on the project. Writing about life outside of ZAMM is a way of reminding myself that I have actually been quite productive in life overall, in ways that I absolutely do care about. From my time in the tech industry, I’m quite familiar with the need for performance visibility — the idea that it’s not just the work you do that matters, it’s also how your contributions come across to others. In a sense, you’re not hired to be a productive employee, you’re casted to play the role of a productive employee. A great way to play that role is to actually be productive, of course, but part of the job is also making sure that you’re being perceived as productive.

This may seem like such corporate bullshit — and it is — but think about it from the boss’s perspective too. None of us have raw direct access to reality. Reality is always filtered through our perceptions, and we are forced to make decisions based on these flawed perceptions. We don’t live in external reality, we live in an internal reality reconstructed from our biased perception filters — and so in a sense, perception is reality for us. Even if you have an honest boss, when it comes time for them to recommend someone for a promotion, they can only go off of how good of an employee they perceive you to be, not how good of an employee you actually are. (What does it even mean to say how good you “actually” are, when you yourself also have a flawed perception of how good of an employee you are to the organization?)

A good, skilled boss may be better at perceiving than an unskilled boss, but “better” is never going to be perfect. A less cynical view of managing your performance visibility is that you’re helping to shore up your boss’s inevitable shortcomings in perceptive abilities. But of course, the more cynical interpretation is that this is now just an adversarial signalling game to be played. You try your best to send signals that you’re an excellent employee, and your boss does their best to determine whether you actually are the excellent employee you present yourself as, or whether you are just better at playing the game than others. (This assumes that the boss even cares about who is best at doing their job, as opposed to who is best at currying favors with the boss, which I’ve heard is common for Cambodian government officials.) Game theoretic incentives means that others are likely to defect to play the signaling game too, and you opt out at your own detriment.

This gets worse the further up the hierarchy you go. Your manager may spend a lot of time around you, but his manager? And their manager? Imagine yourself as the entire organization itself. (An organization is just another cybernetic system, with its own feedback loops, environmental perceptions and actions, survival, and death.) Just as we humans don’t know anything about ourselves by default (a lot of ancient people thought the heart was the source of cognition), an organization doesn’t know anything about its members by default. There is a need for legibility. As introduced in Seeing Like A State, this is a need to reduce complicated reality down to a few bits of information that are simple enough for the bureaucracy to act on.

Legibility is the means by which the organization perceives reality. If the organization wants to perceive more, then reality may have to be warped to meet the organization’s perception needs. Do your peasants have a complicated system of land sharing that works for them? No matter, reduce all the peasants’ informal agreements down to a proper one-to-many mapping of people to property. The State needs to collect its taxes; how can it do so effectively if it is unable to perceive who is or isn’t rich enough to pay up more? And how can it perceive if the arrangements are too messy for the state’s limited bureaucratic manpower to deal with?

Do your employees generally do honest work in ways that help progress the organization’s goals? No matter, make everyone spend multiple days (multiple weeks if they want a promotion) writing essays on their own accomplishments as well as those of their peers. The Company needs to know exactly how much to reward or nudge each employee; how can it do so effectively if it is unable to perceive who is or isn’t being productive? How can it do so objectively, so as to avoid giving undue influence to one’s direct manager, if it is unable to perceive an employee’s productivity from multiple perspectives? (Google has in fact recently streamlined its performance review process somewhat, so perhaps there wasn’t such a strong need for such comprehensive reporting after all. Even “needs” can potentially be falsely perceived as such.)

But perceiving reality is a slippery business. Act on your perceptions, and those responsible for your perceptions react to you. Goodhart’s law comes into play: “When a measure becomes a target, it ceases to be a good measure.” As soon as a metric becomes the name of the game, everyone tries to game that very metric into uselessness. The dictator’s trap is perhaps a more individual version of this, wherein an extreme of concentration power acts like a black hole that bends and warps all the information flowing into it, causing the dictator to live in a fantasy reality and make decisions that are only coherent within that fantastical inner reality.

I’ve been aware of this sort of phenomenon for some time now, but I didn’t expect it to crop up for myself when I’m dealing with just myself. I know myself and the work I’ve done better than anyone else, and yet when I look at what I really care about from ZAMM — which is what I can personally use ZAMM for — I see that very little has budged. In writing about all that’s gone on under the hood, and all that’s gone on beyond the confines of this project, I make the rest of everything else much more legible to myself. It reminds me that there is a whole lot going on in life, and perhaps I needn’t be concerned or despondent over the fact that a couple of hours spent on ZAMM per day results in slow visible progress. It’s probably worth examining why I feel the need to maintain an internal narrative of personal progress in the first place, but 1) that’s a subject for another blog post, and 2) so long as I do feel such a need, it feels worthwhile to challenge the misperception of stagnation.