Would you like me to debug your math?

post by Gurkenglas · 2021-06-11T10:54:58.018Z · LW · GW · 16 comments

Contents

16 comments

At AI safety camp I noticed that people are bad at math and when I look over their shoulder as they code I notice nested for loops that could have been one matrix multiplication.

Therefore I'll try offering this service to the public: You screenshare as you do your daily tinkering, I watch for algorithmic or theoretical squiggles that cost you compute or accuracy or maintainability.

Maybe some people are less effective pair programming than alone. You choose whether we pretend I'm not there, whether you think out loud, or whether we talk theory instead.

We might learn engineering from each other. I have shown multiple people IDE features such as debuggers, and I still don't know a way as elegant as I feel it should be to, say, spin up a minimal transformer implementation for tinkering in a few minutes.

If your workflow is embarassing, that's fine: You are particularly likely to benefit, and I expect this is actually quite common. Edit: For every person so far, I would prefer one like them scheduling a session to not.

I did Java years ago, Haskell less years ago and Python the last few months. Of course, pseudocode is the real language. Here's examples of me rewriting other people's Haskell code: https://codereview.stackexchange.com/users/84131/gurkenglas

Edit: I got 5 meetings from this post out of ~280 views. I'd like that percentage to be higher! My current criteria for accepting people are: If you've found this post, I'm accepting you.

Schedule here: https://calendly.com/gurkenglas/consultation

16 comments

Comments sorted by top scores.

comment by Filipe Marchesini (filipe-marchesini) · 2021-06-13T22:33:25.617Z · LW(p) · GW(p)

After reading this post, I decided to send a message to Gurkenglas. [LW · GW]
This was the best decision I made. I have been developing a mobile software for the last 120 days, and this is my first experience developing something this big. Sharing my screen on Discord, he was able to:
- Completely change my debugging workflow, which is likely to save me hundreds of hours in the long-term
- Teach me a new testing ritual
- Make it easier to identify useless pieces of code
- Refactor hundreds of lines with simple intuitions and good regex
- Teach me dozens of useful keyboard shortcuts and IDE features
- Give me some useful career advice

I wasn't expecting to level up that fast, but in retrospect it seems obvious that accepting a group invitation from a more experienced player would allow me to level up much faster and learn new tricks. Great learning experience.

Replies from: lsusr
comment by lsusr · 2021-06-15T20:26:00.688Z · LW(p) · GW(p)

I had a similar experience. Gurkenglas is legit.

comment by Viktor Rehnberg (viktor.rehnberg) · 2021-06-11T11:16:19.128Z · LW(p) · GW(p)

I am one of those people that have benefited from working with Gurkenglas this way.

For me in particular the main benefits have been two-fold.

  1. Becoming more aware of short comings in how I program. Especially noticing when something I'm doing a lot has a better solution, but I haven't gotten round to investigating alternatives because each individual time is faster to do the old way rather than learning a new way. Gurkenglas helped me get around to actually doing something about this.
  2. Math. It could be when you are doing something that feels too ad-hoc, Gurkenglas can help you work out a more canonical approach.

Now if I had seen this post before I had worked with Gurkenglas I would most probably not have reached out for mainly two reasons

  1. Reaching out to strangers is hard and I might not have felt that what I was doing would be worth taking up a whole other persons time.
  2. I would probably not know what I was missing. I would think that the way I was doing things were fine and there would be little to benefit from it.

If you are thinking something similar, I'm here to tell you that you should probably try it out anyway. The risk of trying and finding that it wasn't worth it is probably much lower than the risk of not trying and missing some good level up opportunities.

comment by time.less.ness · 2021-06-15T16:56:01.148Z · LW(p) · GW(p)

"Disclaimer" - I have no relationship with Gurkenglas outside the ~2hr session we just went through. But I got the feeling I should tout his skills to the community, so I'm doing it. He did not solicit my comment.

This was fun. We didn't do maths so much, because I don't have a maths problem. I have several major problems. We identified some of them.

Gurkenglas has a pretty good handle on looking at completely foreign code, grokking some high-level problems (need to refactor) and some low-level problems (useless conditionals) and even backing off and not fixing a low-level problem when it turns out it might just be idiomatic to the language (Golang and the omnipresent "if err != nil...") These are reasonably sophisticated habits/skills.

I got the impression he's pretty passionate about alignment and other AI-related topics, so if you've got an important AI project that needs someone who's willing to do whatever it takes to add value, schedule time on his Calendly and let's get this going!

comment by Nebu · 2021-06-11T18:05:38.873Z · LW(p) · GW(p)

as they code I notice nested for loops that could have been one matrix multiplication.

 

This seems like an odd choice for your primary example.

  • Is the primary concern that a sufficiently smart compiler could take your matrix multiplication and turn it into a vectorized instruction?
    • Is it only applicable in certain languages then? E.g. do JVM languages typically enable vectorized instruction optimizations?
  • Is the primary concern that a single matrix multiplication is more maintainable than nested for loops?
    • Is it only applicable in certain domains then (e.g. machine learning)? Most of my data isn't modelled as matrices, so would I need some nested for loops anyway to populate a matrix to enable this refactoring?

Is it perhaps worth writing a (short?) top level post with an worked out example of the refactoring you have in mind, and why matrix multiplication would be better than nested for loops?
 

Replies from: Gurkenglas, phil-scadden
comment by Gurkenglas · 2021-06-11T18:16:08.048Z · LW(p) · GW(p)

It's not my one trick, of course, but it illustrates my usefulness. It's more maintainable not just because it is shorter but also because it has decades of theory behind it. Drawing the connection unlocks inspiration from entire branches of math. And the speedups from standing on the shoulders of giants go far beyond the constant factors from vectorized instructions.

Replies from: Dustin
comment by Dustin · 2021-06-13T20:07:10.951Z · LW(p) · GW(p)

I'm not disagreeing with you (I don't think?), but just pointing out a mistaken lesson someone new to programming might draw from your comment.

it's more maintainable not just because it is shorter but also because it has decades of theory behind it

Being shorter is way down the list of things you should consider when you're thinking about how to make your code more maintainable.  In fact, longer code is often more maintainable.  As a trivial example, imagine a variable called x and the alternate name for it: seconds_since_midnight

I'm not sure there is a good rule of thumb wherein you say "shorter/longer is more maintainable".  

Replies from: philovivero
comment by philovivero · 2021-06-13T23:23:09.547Z · LW(p) · GW(p)

What about after the maddening 8-hour debug session where you finally realise they were storing a number representing seconds since noon in that variable?

Replies from: Dustin
comment by Dustin · 2021-06-14T00:39:52.703Z · LW(p) · GW(p)

It's good to keep in mind that whomever wrote the code is probably a freakin' liar!

comment by Phil Scadden (phil-scadden) · 2021-06-15T21:02:24.431Z · LW(p) · GW(p)

I had similar thought, but then most of the languages I use don't support matrix operations directly in the language anyway. Great believer in "tried and true" numerical analysis libraries though.

comment by philip_b (crabman) · 2021-06-11T11:38:18.084Z · LW(p) · GW(p)

Does your offer stand for learning math instead programming something? Some possible examples are:

  1. Solving exercises in the end of a chapter
  2. Given a chapter from a textbook, redoing it on my own for a more general case or for a slightly different case .
  3. Reading some proofs and understanding them.
  4. The whole loop of reading a chapter, understanding it, looking up things I don't understand, solving exercises, proving things I want to prove on my own, adding notes to my notes database.
Replies from: Gurkenglas
comment by Gurkenglas · 2021-06-11T11:47:08.889Z · LW(p) · GW(p)

Sure, I'll try it. I don't expect to be an order-of-magnitude power multiplier in that case, though.

comment by Kay Kozaronek (kay-kozaronek) · 2022-07-11T12:09:24.497Z · LW(p) · GW(p)

Hey Gurkenglas, are you still doing this? 

Replies from: Gurkenglas
comment by Gurkenglas · 2023-11-10T15:28:29.243Z · LW(p) · GW(p)

rereads comment section a year later

Whoops, I probably should have put a public reply here if I wanted anyone to ever book a call again ^^.

I'm still up for this.

comment by Josh Jacobson (joshjacobson) · 2021-06-12T03:30:44.810Z · LW(p) · GW(p)

Are you open to auditing existing math (vs. observing and commenting on real-time creation)?

Replies from: Gurkenglas
comment by Gurkenglas · 2021-06-12T08:31:53.820Z · LW(p) · GW(p)

Seems like less of a market niche, but link it!