913 karma · joined September 6, 2023
- Carefully interleaving shared memory loading with computation, and the whole kernel with global memory loading.
- Warp shuffling for softmax.
- Avoiding memory access conflicts in matrix multiplication.
I'm sure the guys at ClosedAI have many more optimizations they've implemented ;). They're probably eventually going to design their own chips or use photonic chips for lower energy costs, but there's still a lot of gains to be made in the software.
I recently played a game with higher-level players. One player was incredibly passive; their bonus would get broken every turn, and rather than doing anything to defend it (and they had enough troops to defend it), they pulled their troops into the middle of the bonus and let everyone else take turns breaking their bonus. This could work fine in a lower-level lobby—eventually the other players might get bored and start hitting each other—but not with better players. Good players realize a couple things about them:
1. They won't retaliate, so I can knock off a few of their troops at no risk to myself.
2. They won't do anything, so any fighting among the rest of the players will effectively be a troop subsidy to them.
Since they're unwilling to help anybody, no one wants to give them free troops, and since they've demonstrated an unwillingness to retaliate, there's really no risk with hitting them over and over. So, naturally, they were the next player to be eliminated.
One thing that's nice about Risk is there's very little to the mechanics. There aren't combos to practice or build orders to memorize, mostly just an understanding of what other people want and how to negotiate. Pretty much everyone rated intermediate and above has the mechanics down: how to move troops around to not block each other, how to choke out other players, what moves are game ending for you or another player, and so on. The thing that sets apart intermediates, experts, masters, and grandmasters is almost entirely their ability to work with other players. However, since many (most?) players are "smashy noobs", lots of people rise up the ranks by just assuming everyone else is a smashy noob, and playing extremely passively to compensate. It works, until they end up in a lobby full of masters.
https://www.youtube.com/watch?v=bZbuKOxH71o
This work is one of those things that feels like the completely obviously right way to do things in retrospect, and why hasn't anyone implemented this before? It helps that the authors explain it very intuitively, slowly building up the tools to run like stars.
Something I don't see mentioned is that this would be pretty useful for training a physics-based model, specifically a neural ODE. Since the mean squared error scales as O(1/N), to converge you need O(1/Loss) evaluations per point. If you were using a grid approach, the cell size would need to be O(sqrt(Loss)) in size, and the running time couldn't be better than O(1/(Loss * log(Loss))) in two dimensions. To be fair, it probably takes O(1/log(Loss)) time for each Monte Carlo simulation, so it's no worse to use the grid. But, if you go up to three or more dimensions, this method still has the same running time while the best grid method takes at least O(# grid cells) = O(1/Loss^(d/2)) time.
- Unable to demonstrate prequisite knowledge, or
- Unable to go to a school further away?
I can get the latter one, which is why I think we shouldn't just have magnet schools, we should have free, government-run magnet boarding schools. Or, alternatively, how much would it really cost to provide a chauffeur service to kids who have demonstrated intelligence and need? If schools can provide personal aides to 1% of their population, I'm sure they have the budget to treat another 1% equitably.
Think about this: you've probably driven a car to get from Point A to Point B before. If you existed in a society where people were constantly making mistakes, in the sense of crashing their cars several orders of magnitude more often, driving a car to get from Point A to Point B is no longer a good strategy. But it usually is a good, if not the best, move you can make right now, because people aren't making mistakes that frequently.
Here's another example: marriage (long-term relationships). Perhaps not all extra-marital affairs are mistakes, but a significant proportion of them are. If too many people are making these mistakes, leading to messy divorces, it's no longer worth it to even consider dating in the first place.
Something sobering to keep in mind is that the vast majority of people have the logical and mathematical capabilities of a good ten-year-old. There are ten-year-old chess grandmasters, USAJMO qualifiers, or to be less extreme, ten-year-olds that have a solid understanding of algebra and an intuition for proofs. Most people do not, and rely on heuristics or intuitions for everything. They do not even realize you can prove something, except with "it feels or seems right". It isn't because they're mentally incapable of learning the skill, it's because they never bothered to, or didn't think it was important.
These exist:
https://arxiv.org/abs/2208.01623
The real issue is trying to backpropagate those nonlinear optics. You need a second nonlinear optical component that matches the derivative of the first nonlinear optical component. In the paper above, they approximate the derivative by slightly changing the parameters, but that means the training time scales linearly with the number of parameters in each layer.
Note: the authors claim it takes O(sqrt N) time, but they're forgetting that the learning rate mu = o(1/sqrt N) if you want to converge to a minimum:
Loss(theta + dtheta) = Loss(theta) + dtheta * dLoss(theta) + O(dtheta^2)
= Loss(theta) + mu * sqrtN * C (assuming Lipschitz continuous)
==> min(Loss) = mu * sqrtN * C/2 free (foss) -> non-profit -> capped-profit -> public benefits corporation -> (you guessed it)Suppose you have n residual layers that look like:
x_0 = input x_{i+1} = x_i + f(x_i) x_n = output
If you replace them with an infinite number of layers, and use "time" t instead of "layer" i, you get
x(t+dt) = x(t) + dt f(x(t)) <=> x'(t) = f(x, t)
so to find the output, you just need to solve an ODE. It gets better! The goal of normalizing flows is to "flow" your probability distribution from a normal distribution to some other (e.g. image) distribution. This is usually done by trying to maximize the probability the training images should show up, according to your model, i.e.
loss(model) = product model^{-1}(training image)
Notice how you need the model to be reversible, which is pretty annoying to implement in the finite-layer case, but with some pretty lenient assumptions is guaranteed to be true for an ODE. Also, when you're inverting the model, the probabilities will change according to the derivative; since you have more than one dimension, this means you need to calculate the determinant of the Jacobian for every layer, which is decently costly in the finite-layer case. There are some tricks that can bring this down to O(layer size^2) (Hutchinson++), but the ODE case is trivial to compute (just exp(trace)).
So, turning the model into an ODE makes it blazing fast, and since you can use any ODE solver, you can train at different levels of precision based on the learning rate (i.e. the real log canonical threshold from singular learning theory). I haven't seen any papers that do this exactly, but it's common to use rougher approximations at the beginning of training. Probably the best example of this is the company Liquid AI.
Finally, this all turns out to be very similar to diffusion models. Someone realized this, and combined the two ideas into flow-matching.
-----
This is one place it's super useful to know numerical methods, but here are a couple others:
1. Weight initialization --> need to know stability analysis
2. Convolutions --> the Winograd algorithm, which is similar to ideas in the FFT and quadrature
Or a Veritasium video here: https://www.youtube.com/watch?v=iSNsgj1OCLA
> The numbers 1–n are randomly placed into n boxes in a line. There are n people who are each able to look into half the boxes. While they are allowed to coordinate who looks into which boxes beforehand, they are taken out one at a time to choose which half of the boxes they will peek at. The goal is for the first person to find the number one, the second person to find the number two, and so on. If any of them fail to find their number, the whole group loses. What is the probability they lose if they use the optimal strategy?
I wonder if there's a connection to regular graphs here.
I really wish they tied this into representation theory, because it looks like the R-tensors are similar to representations of the permutation group, but I don't see exactly how to write them in terms of representations.