Categories
Tech: Best Practices

In the Age of AI, What Should Be Human-Verified?

As AI has taken the tech and engineering worlds by storm, it seems a common question has arisen: what do we hand off to AI, and what do we verify as humans?

A tenet of the AI for math movement is that formal verification can allow us to be confident in AI’s outputs, in fact even more than the human-built systems from before. In many respects, this is true. However, we may need to exert caution in applying this idea indiscriminately, since this fundamentally depends on the ability to translate informal expectations into formal specifications with high fidelity. I’m not sure whether this will be something that sufficiently advanced AI can take care of, or a problem that fundamentally can never go away or leave the realm of humans.

A particularly notable requirement of such translation would be not just to capture expectations that are explicit, but also implicit ones too. Lists of rules often capture everything that the person who wrote them down thought of at that point, but not necessarily possible new scenarios that, even if they have “obvious” answers for them, just didn’t think to write down. For example, the written rules for public tennis courts often talk about acceptable hours of usage, maybe giving up the space after a period of time, etc., but they usually don’t explicitly ban attacking someone, though obviously it is intended for that to be banned too. Generally, if we look at the history of law, there have always been loopholes that people have exploited against the original intent, precisely because the lawmakers just didn’t think of everything to account for. A sufficiently high-fidelity formal specification should take into account not just the explicit expectations but implicit ones too, and if AI moves significantly faster than humans can even audit, if there is ever an error in such translation, it could propagate and potentially lead to unacceptable issues, especially if we become more dependent on AI to take advantage of its benefits.

Applying this to applications of AI for math, a major promise of this movement is that acceleration of developments in math can have knock-on effects through the pipeline of science, engineering, and technology, to produce better tech that enhances our lives. I in fact am a major proponent of this idea and wrote as much in a blog post discussing my thoughts on AI for math. One of my main points was that we should parallelize acceptance of AI-generated results and human understanding of them, especially as the results are used in applications e.g. to develop better technology. While I very much still believe this, in light of the current discussion a clarification should be made: we should accept the math result as stated, but I don’t think we should simply write down evals, have AI manage the whole process from math to finished product, and then use that product as usual. Because evals often won’t capture all the important requirements (precisely because there would be so many implicit expectations), humans need to understand every step in the process for a physical product that we plan to use. This is not as vital for knowledge itself, but it is for physical products, especially in those critical areas where AI could have the greatest benefits but also the greatest risks (for example, think of immunology, or power grids, or vehicles like airplanes that could be made more efficient.)

In general, we should be thoughtful about what we handoff to AI and what we set aside for manual verification/understanding, and for the salient example today of AI for math, we should parallelize knowledge itself while requiring human understanding first for any physical products.

Categories
Tech: Best Practices

Services vs Local Functions

I have been recently revisiting concepts that I have been working with for a while now as a software engineer, more deeply questioning them to formulate better best practices for them. One such concept is that of a service vs a local function. Let’s list the various features of both:

  • Remote runnability: only services support this. Both services and local functions support local.
  • Concurrency: I used to think only services support this, but local functions do too with threads. (To address a misconception here: concurrency is only tough with shared resources, and services are already written presuming no access to local resources; if the same code were transplanted onto a local function running in a thread, it would basically be the same result, assuming sufficient info about the thread scheduler and other relevant lower-level systems.)
  • Access: for a service, anyone can call, choice of who to respond to is implemented in the service’s logic (e.g., return 403 error.) For a local function, who can call depends on the programming language and what it enforces (e.g. Java public vs protected vs private.) For some languages (e.g. compiled ones), only code compiled with it can call it (no one else can call it once it is an executable), but for other languages if it is say part of a DLL then it could be called by other local programs even if it has already been compiled into an executable. For practical purposes, we can consider “importing as a package” and “linking as a DLL” to be semantically similar actions (a programmer just needs to “include it and get it working”), and in a sufficiently expressive language where the local function is exposed sufficiently (e.g. as part of a package) then whether or not it’s already an executable doesn’t really matter and in that case we can say a local function can be called by any local program. Choice of who to respond to depends on the language’s expressiveness, e.g. reflection features that give information about the caller, or if possible business-logic encoding of “who the caller is”; otherwise, a local function always has to respond.
  • Resource overhead: services have noticeably more overhead than local functions, involving network stacks and the like.

Similar to innovations like Scala’s mix-ins that have evolved to replace inheritance in most cases (not just be another feature with trade-offs), after writing this comparison I think it’s possible to eliminate what I view here as a false trade-off (services have more flexibility but also more overhead) with one primitive. It seems plausible that we could develop a language/framework where any function call could be auto-exposed but also get enough information about its caller that it can choose who to respond to, and the “engine” of the language could allow any function to be called remotely (again with choice of who to respond to) but also have the optimization of eliminating the network stack when the function is called locally. Generally, with “hand-coded” architecture, developers manually made decisions about programming languages, exposure of various local functions, services, etc., presumably introducing many spots of inefficiency (which also led to a lot of boilerplate, e.g. in the case of Java.) However, such a framework could automate this decision making, eliminating the inefficiency and empowering developers to focus on more differentiated and interesting business logic.

Categories
Tech: Best Practices

Customer Support and Data Privacy

One “natural” good intention that can end up undermining data privacy is enabling customer support. For example, say a website was built so that its website owners could not access passwords even if they wanted to (no “master users” or “superusers” of the database.) This would seem to be a great design decision from the perspective of security and privacy. But if a customer forgot their password and wanted to get back into their account, without such “superuser” access this could technically be impossible (depending on the technical architecture of the website.) So companies do end up introducing such “database superusers” since users end up making mistakes in this vein or wanting to undo their actions. To aid customer support personnel further, they often introduce “God Mode” tools that allow them to perform any actions on behalf of any user. But the problem is that such tools then get abused by employees, far beyond the purpose they were created for, for example to stalk users. This is further exacerbated by smaller companies de-prioritizing proper controls on such tools because of pressure to deliver quickly, and even for companies that do have such controls, I believe those may not be enough; for example, some companies do auditing and after-the-fact disciplining, but I would argue that by that time the damage is already done. Scandals connected to this have in fact happened in major companies like Uber.

Also, from a development perspective, developers would like to test and analyze their apps in environments that are as close to the “real world” as possible (how users would actually use them.) It is well-known that even with developers’ best efforts to guess all the scenarios of possible usage patterns, they can fall short of the breadth of what happens in reality when the app is released. This means that developers would like test data to be as close to real user data as possible, even possibly a small randomized sample of actual user data. Also, when troubleshooting real customer issues, the more information developers have to work with, the more effective they can be in helping out. This leads to incentivizing the hoarding of user data, with the reasoning that “it could be used later to make the user experience better and help users more.” But such troves of data that are amassed are then attractive targets for hackers and bad actors, and in companies that store even more data, the potential for subsequent damage from any hack is far greater. And as a company operates for longer and longer, the probability that they could slip up gets higher, especially with the necessity of continual maintenance of their systems.

Companies usually address this with internal data privilege enforcement systems, where only certain employees are specially authorized to deal with user data, and only the data that they specifically need for a legitimate business purpose. Use of “God Mode” tools is tracked, producing detailed audit trails, and the price of any misuse is severe disciplinary action, including termination. However, while this is well-intentioned as a setup, it still doesn’t feel adequate to me: after-the-fact disciplinary action is not enough when the damage is already done, and there does not usually seem to be much external transparency into who internally is granted access to user data internally for what purpose — this is all owned within the company, and for the purpose of a smoother customer experience it is supposed to be invisible to the customer (as if it is something they shouldn’t need to worry about.) A more robust system towards the requirement of providing the transparency that customers deserve would be one that externally exposes and audits these internal data privilege grants better.

I also have a few general points on communication and discussion of this issue. First, I think too much of the discussion is symptoms-focused rather than root cause-focused. It’s easy to criticize a certain company for having data privacy violations, but the more interesting and important question to me is what incentives led to those violations happening, especially if such incentives could apply to anyone and redirect them, even those who started with good intentions. This especially applies to companies that were once hailed as privacy supporters, and then in sudden heel turns (often derived from one or a few news articles) condemned as privacy saboteurs. This point can also be generalized beyond data privacy to many other issues people often criticize the tech industry on today.

That said, I think there is too much pressure rampant throughout the industry to deliver quickly, and while some of that pressure is a good thing, it cannot be to the point that it crosses certain fundamental boundaries, especially for example those concerning security and privacy. I do believe these boundaries can be crossed too often sometimes these days, and while this doesn’t necessarily happen with malicious intentions (“We’ll fix it later”), regardless it is not acceptable, and we should be much stricter in upholding those boundaries, no matter what.

In companies that do have proper controls (what I described with an internal grant system and a thoroughly audited God Mode tool), I wonder if a “God Mode” tool could be built that has customer consent technically baked in. At first glance, this seems to not make much sense — say for example that such a tool was built, where a customer support agent technically could not access it without a customer’s consent. How would the customer provide that consent, and how would their provision of it be technically verified? After all, if the customer is the one who forgot the very thing that allows them to access their account (e.g. their password), then from the perspective of the website, how can it know that they are who they claim they are, and therefore that the consent was valid? And if they are able to prove that, then they could just access the website directly using that proof without any customer support in the loop. In fact, this would essentially just be the same as logging into the app directly, possibly with a “forgot password” flow that still requires some other authentication. With a robust enough “forgot password” flow (which must be secure in requiring enough alternative proof but also covering enough cases of what users could forget — this seems actually to be a tricky problem that we’re glossing over here), this could presumably work for many cases, but for those customers where that flow doesn’t work, they would never be able to get back into their account again, no matter how much a human tried to help. Maybe some partial technical verification of consent could be possible: for example, the system could use voice parsing via AI to check whether the customer agent is speaking to the intended user, and if so then grant consent; but with AI today this could also potentially be faked, and this would also require storing user voice data in order to perform the comparison. In general, any alternative authentication mechanism would require storing user data along the lines of that authentication method in order to perform such a comparison.

I’m not sure what a better solution here could be. But external auditing of internal data privilege grants would be a start, and in general more external transparency around how these systems are built and why the tradeoffs exist would be important to provide customers with the fundamental knowledge that they should have when navigating technology.

Categories
Tech: Best Practices

Is Asymptotic Analysis Still Valuable?

Many software engineers who have been in the industry seem to view asymptotic analysis (“big-O”) as not as effective or relevant to their work. Yet it is still fundamentally emphasized in academic computer science programs, forming a major part of standard algorithms and data structures courses. Is there still some value in asymptotic analysis, or is it better to evolve away from it going forward?

Categories
Tech: Best Practices

Writing Effective Unit Tests

You’re patting yourself on the back, proud of the code you’ve just written for a cool new feature. You’re itching to add it to your organization’s repository and see customers use it as soon as possible, but you can’t. You now need to write a bunch of unit tests that meet your organization-mandated “code coverage” level. You begrudgingly sit down and start to hammer out the tests, thinking, why? “I’ve already written the code, why do I have to go through this bureaucracy?”

In this post, I’ll discuss what unit tests are useful for, why they can seem so annoying to write, and how to write them more effectively.