Chapter 22

layers/seqmix — mixer contract

github.com/openfluke/welvet/layers/seqmix


Why it exists

Attention, SSM, linear attn, and conv mixers must not be accidental forks of mha. Naming the contract keeps packages honest.

What it is

KindAttention | KindSSM | KindLinearAttn | KindConvMix and Contract{Kind,DModel,MaxT}. No compute here.

Go example

examples/22-seqmix/main.go

Run:cd welvet/examples/22-seqmix && source ../env.sh && go run .
package main

import (
	"fmt"

	"github.com/openfluke/welvet/layers/seqmix"
)

func main() {
	c := seqmix.Contract{Kind: seqmix.KindAttention, DModel: 64, MaxT: 2048}
	fmt.Println(c.Kind.String()) // attention
}

Output

exit 0 · last run via go run .

attention