Formula image to typst model TypLens-V1 released — avaliable on TypstPad

Hi everyone!

I’m happy to share that TypLens-V1 has been released and is now available to try at typstpad.com!

TypLens is a lightweight image-to-Typst model made to run in browsers that turns formulas into Typst code. When you find a formula in a paper or PDF, you can use a screenshot as a starting point instead of retyping the entire expression.

Examples (All results from typstpad.com)

cal( L ) _ ( upright( D P O ) ) ( pi _ ( theta ) ; pi _ ( upright( r e f ) ) ) = - bb( E ) _ ( ( x , y _ ( w ) , y _ ( l ) ) tilde cal( D ) ) lr( [ log sigma lr( ( beta log frac( pi _ ( theta ) ( y _ ( w ) divides x ) , pi _ ( upright( r e f ) ) ( y _ ( w ) divides x ) ) - beta log frac( pi _ ( theta ) ( y _ ( l ) divides x ) , pi _ ( upright( r e f ) ) ( y _ ( l ) divides x ) ) ) ) ] )

bold( mu ) _ ( theta ) ( bold( upright( x ) ) _ ( t ) , t ) = tilde( bold( mu ) ) _ ( t ) lr( ( bold( upright( x ) ) _ ( t ) , frac( 1 , sqrt( macron( alpha ) _ ( t ) ) ) lr( ( bold( upright( x ) ) _ ( t ) - sqrt( 1 - macron( alpha ) _ ( t ) ) thin bold( epsilon.alt ) _ ( theta ) ( bold( upright( x ) ) _ ( t ) ) ) ) ) ) = frac( 1 , sqrt( alpha _ ( t ) ) ) lr( ( bold( upright( x ) ) _ ( t ) - frac( beta _ ( t ) , sqrt( 1 - macron( alpha ) _ ( t ) ) ) thin bold( epsilon.alt ) _ ( theta ) ( bold( upright( x ) ) _ ( t ) , t ) ) )

mat( delim: #none , align: #center , L ( gamma , phi.alt ; alpha , beta ) = zws , log Gamma lr( ( display( sum _ ( j = 1 ) ^ ( k ) alpha _ ( j ) ) ) ) - display( sum _ ( k = 1 ) ^ ( k ) log Gamma ( alpha _ ( i ) ) ) zws ; zws , quad + display( sum _ ( k = 1 ) ^ ( k ) alpha _ ( i ) - 1 ) ) lr( [ Psi ( gamma _ ( i ) ) - Psi lr( ( display( sum _ ( j = 1 ) ^ ( k ) gamma _ ( j ) ) ) ) ] ) zws ; zws , quad + display( sum _ ( k = 1 ) ^ ( N ) sum _ ( k = 1 ) ^ ( k ) delta _ ( m ) lr( [ Psi ( gamma _ ( i ) ) - Psi lr( ( display( sum _ ( j = 1 ) ^ ( k ) gamma _ ( j ) ) ) ) ] ) ) zws ; zws , quad + display( sum _ ( n = 1 ) ^ ( N ) sum _ ( l = 1 ) ^ ( k ) sum _ ( l = 1 ) ^ ( N ) delta _ ( m ) w _ ( n ) ^ ( l ) log beta _ ( l j ) ) zws ; zws , quad - log Gamma lr( ( display( sum _ ( j = 1 ) ^ ( k ) gamma _ ( j ) ) ) ) + display( sum _ ( k = 1 ) ^ ( k ) log _ ( n ) Gamma ( gamma _ ( l ) ) ) zws ; zws , quad - display( sum _ ( k = 1 ) ^ ( k ) ( gamma _ ( l ) - 1 ) ) lr( [ Psi ( gamma _ ( l ) ) - Psi lr( ( display( sum _ ( j = 1 ) ^ ( k ) gamma _ ( j ) ) ) ) ] ) zws ; zws , quad - display( sum _ ( m = 1 ) ^ ( N ) sum _ ( l = 1 ) ^ ( k ) delta _ ( m i ) log phi.alt _ ( m i ) . ) )

Oops! This is a long formula and the model is making some mistakes.

Highlights

  • Browser-compatible inference with a relatively small, 29.4-million-parameter model.
  • MIT open-sourced, downloadable model weights in both full-precision FP32 (~118 MB) and compact INT8 (~34 MB) ONNX variants.

This is still an experimental release. Long expressions, subscripts, and subtle symbol or style differences can still cause mistakes, so please check the generated output, even when it compiles successfully.

Try it: https://typstpad.com
GitHub: GitHub - dbccccccc/TypLens · GitHub
Huggingface: dbcccc/TypLens · Hugging Face

I’d love to hear how it works with your formulas! Examples where recognition fails would be especially helpful—please share the formula image, the generated output, and the expected result here or in a GitHub issue.

Thanks for giving it a try!

1 Like