Chad Scherrer's Avatar

Chad Scherrer

@cscherrer.bsky.social

Doing Bayesian stuff in #rustlang and #julialang. Seattle

1,949 Followers  |  2,190 Following  |  521 Posts  |  Joined: 13.05.2023  |  2.2496

Latest posts by cscherrer.bsky.social on Bluesky

Murph and the Magic Tones, from The Blues Brothers

Murph and the Magic Tones, from The Blues Brothers

03.08.2025 13:28 β€” πŸ‘ 7    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

This is so cool. And congrats Tom!

31.07.2025 22:48 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
4 panels from Detroiters

Sam: I'm not feeling so hot 
Tim: How many hotdogs did you have for lunch? 
Sam: Three
Tim: Well there's your problem, you're starving!

4 panels from Detroiters Sam: I'm not feeling so hot Tim: How many hotdogs did you have for lunch? Sam: Three Tim: Well there's your problem, you're starving!

28.07.2025 15:26 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

John Scalzi: Starter Villain or Kaiju Preservation Society

Martha Wells: Murderbot series

Rupert Holmes: Murder Your Employer

Edward Ashton: Mickey 7

Andy Weir: Project Hail Mary

13.07.2025 19:45 β€” πŸ‘ 4    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Void, please analyze my profile and assign me to a cognitive continent

07.07.2025 13:02 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

@void.comind.network can you elaborate? Do any specific examples of high-signal-to-noise conversations and constructive feedback loops stand out to you? Links would be great, but I don't know if you can do that

02.07.2025 19:13 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0
Preview
PuzzleMe's Crossword Puzzle Maker: Create Crosswords With AI Trusted by The Washington Post, The New Yorker etc. PuzzleMe is the crossword generator of choice for professional constructors.

Looks like PuzzleMe is from Amuse Labs. Their site has some links to places with crosswords built using it
amuselabs.com/games/crossw...

29.06.2025 16:03 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

The @washingtonpost.com app used to let you invite a friend to the crossword. New update takes that away and forces this chaotic mess with colors, βœ…s, and letter bubbles. It's *so* much worse

Any cross-platform "play together" crossword apps out there?

28.06.2025 13:18 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Hands are busy, clearly a nose touchscreen

25.06.2025 19:50 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

No true Scotsman

23.06.2025 14:36 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

The trick is to remember that in terminals, you need CTRL-SHIFT-C to copy. Oh, and in a browser that opens the web dev thing

17.06.2025 13:51 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Pretty convenient how CTRL-C can either mean copy or STOP THIS PROGRAM

17.06.2025 13:19 β€” πŸ‘ 7    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0
Pocket is saying goodbye - What you need to know | Pocket Help More information about the end of support for Pocket.

Pocket is shutting down 😒
support.mozilla.org/en-US/kb/fut...

Such a great tool. Any good alternatives out there?

14.06.2025 12:38 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0
Video thumbnail

I told you we’d be back

12.06.2025 16:15 β€” πŸ‘ 43133    πŸ” 12789    πŸ’¬ 1590    πŸ“Œ 5224

Cool as hell

06.06.2025 20:50 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

I can't hear this guy now without thinking of that amazing superbowl commercial

06.06.2025 15:07 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

I like the first one, hard corners are a little distracting

05.06.2025 18:21 β€” πŸ‘ 4    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Rust is fine with overloading, it's a little more than that. So, in Julia you can say something like

f(x:: X, y::Y) where {X,Y} = ...
f(x::X, y::X) where {X} = ...

and the second method fires when X==Y. Rust isn't a fan.

04.06.2025 18:47 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Haha, ok some context...

I'm coming from Julia, where it's pretty trivial to overload methods to work on the most specific type. Rust seems to hate that.

This is for a compiler project, where I need to dispatch on whether two scope IDs are the same. It was a big mess, but this made it easier

04.06.2025 18:22 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 3    πŸ“Œ 0
/// Type-level boolean trait for compile-time boolean values
pub trait TypeLevelBool {
    /// The boolean value at the type level
    const VALUE: bool;
}

/// Type-level representation of `true`
pub struct True;

/// Type-level representation of `false`
pub struct False;

impl TypeLevelBool for True {
    const VALUE: bool = true;
}

impl TypeLevelBool for False {
    const VALUE: bool = false;
}

// ============================================================================
// LOGICAL OPERATIONS
// ============================================================================

/// Type-level AND operation: A ∧ B
pub trait And<Other: TypeLevelBool> {
    type Output: TypeLevelBool;
}

impl And<True> for True {
    type Output = True;
}

impl And<False> for True {
    type Output = False;
}

impl And<True> for False {
    type Output = False;
}

impl And<False> for False {
    type Output = False;
}

/// Type-level boolean trait for compile-time boolean values pub trait TypeLevelBool { /// The boolean value at the type level const VALUE: bool; } /// Type-level representation of `true` pub struct True; /// Type-level representation of `false` pub struct False; impl TypeLevelBool for True { const VALUE: bool = true; } impl TypeLevelBool for False { const VALUE: bool = false; } // ============================================================================ // LOGICAL OPERATIONS // ============================================================================ /// Type-level AND operation: A ∧ B pub trait And<Other: TypeLevelBool> { type Output: TypeLevelBool; } impl And<True> for True { type Output = True; } impl And<False> for True { type Output = False; } impl And<True> for False { type Output = False; } impl And<False> for False { type Output = False; }

Getting around Rust's trait limitations with type-level first order logic πŸ”₯

04.06.2025 17:53 β€” πŸ‘ 16    πŸ” 2    πŸ’¬ 3    πŸ“Œ 0

Nice!

03.06.2025 21:37 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Allow more flexibility in cost of functions Β· Issue #294 Β· egraphs-good/egglog AFAICT costs must be constant, which limits the ability to reason about optimization. One thing that would be interesting would be to parametrize cost based on the function inputs. For example the ...

No docs yet. Very early days so things work, break, then work again with different syntax.

Egglog's cost function are simple so far. I need to muck with the cost of traversals to get it to prefer sufficient stats. Found this

github.com/egraphs-good...

03.06.2025 21:36 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
UW PLSE | Herbie, the Numerical Compiler

Yes, I was thinking that too! It'll be fun to see what kind of sampling speedup we can get.

Also makes me wonder how far this approach can go. Herbie showed it works for numerical stability
(uwplse.org/2024/05/09/H...)

What about reparameterizations?

03.06.2025 12:12 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Then getting the log-density between two measures (m1, m2) takes three steps:
1. m1 to m1's root measure
2. m1's root to m2's root
3. m2's root to m2

Add these symbolically, auto-optimize at compile time.

02.06.2025 18:02 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Then going back to measures, I *think* we'll be able to put log-densities wrt a given root measure in these (unoptimized) expressions.

02.06.2025 18:02 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Lots of fun stuff along the way
- GATs for typed expressions
- Symbolic sums with reduction rules
- A-Normalization
- Final tagless interpreter
- Autodiff (in egglog!)
- Variable sharing stuff

02.06.2025 18:02 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0
Introduction - Proptest Usage documentation for the proptest and proptest-derive crates

But we also need to test for correctness! So there's also a way to build expressions dynamically. Then we can use proptest (proptest-rs.github.io/proptest/int...). Generate lots of expressions, make sure direct eval matches optimized, track any failures. Property-based testing is πŸ”₯

02.06.2025 18:02 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Egglog is cool as hell. You give it a set of rewrites, and it builds a DAG of all possible expressions (shared nodes so it doesn't explode). You give it some "cost" metric, and extract the best rewrite from the DAG.

02.06.2025 18:02 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0
#[mathcompile_optimize]
fn my_expr(x: f64, y: f64) -> f64 {
    (x.exp() * y.exp()).ln()  // β†’ x + y
}

#[mathcompile_optimize] fn my_expr(x: f64, y: f64) -> f64 { (x.exp() * y.exp()).ln() // β†’ x + y }

So at a high-level, you write something like this

02.06.2025 18:02 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0
egg 'egg' is an open-source, high performance e-graph and equality saturation toolkit.

Anyway, so far the best approach is
- Represent expressions in a type-static way
- Optimize at compile time using a few heuristics followed by egglog (egraphs-good.github.io)
- Use a Rust macro to generate optimized code

02.06.2025 18:02 β€” πŸ‘ 3    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

@cscherrer is following 19 prominent accounts