jes notes .

2024-03-11

< 2024-03-10 2024-03-12 >

LLM tree search

I read something about using tree search to get better output from LLMs. I don't know what the other person's plan was, but I'd like to have a play. My plan is instead of taking (for example) the highest-probability token at each point, and then building a straight line like that, we'd take the N highest-probability "root" words, and recurse for M levels, and at the end of the M levels we'd work out which string has the highest probability overall, and output the root word that leads into that subtree, throw away all the other subtrees, evaluate the N highest-probability leaf words for the chosen subtree, choose the new root word that leads to the highest probability string, etc.

So after you've spun up the initial tree, generating a single token takes O(M^N) times as much work as before, i.e. you need to evaluate a new set of leaf nodes each time. My guess is you'd want to make M high and N small. Perhaps you'd even want to make N vary (i.e. try all the most likely tokens that add up to a probability in excess of some value, instead of always taking the same number of tokens).

Using Karpathy's Python GPT tutorial implementation, trained on my blog, before was:

``````co a rett
Qns no os a the 2 I it ror
wany cogen Thake ond she the measter a theas ungh mid ssacke leer mit't theat repttitidin sopeps tasit i ammoukeg enalr shim ofocks star efortwirig sthict tlend 20 yof dout sto prame. Is the we me ein fuatin of wire and Azeck rind Moveach cropps stoace stis forer ass poarinti4#in0%ar</p6><Cov>pth_ tobe thes vere on neee julure MOY "pes mar1% prouid. ":
6700 al with thant om soy the thao cake sros ime <le
``````

After, with N=2, M=6:

``````<r>_Iff="htorchtp eveitedsed I seateses. Thadgey she mistroses and to uto evesse ins to ide to menking withth is me the froas the to seter to hocore, end if tor se is the Be <a aref="htps://gitorend cacht af thing in s laklle at ant is that st's in soplilaced is en thasks thie
ind to thave the sebopot intide. The htho mine a
to thand lockige hefor" ind and tho tit heat he aves "taitare
sile ore laten</e>

<a href="hto the the the ome swo abl it prighing of the an I bit tholly owen with lis ther
``````

Not obvious that there's much improvement.

Machine design

I'm going to put all of the holes in the frame parts for: BK12, ballnut holders, HGR15, carriages.

• M4: 22mm length, 5mm outside diameter
• M6: 30mm length (plan to cut in half and turn to 14mm), 10mm outside diameter

The eBay listing says the outside diameters are "approximate", so I may have to measure them once they arrive.

It also says the M4x22mm ones are only "part threaded", if that is a problem I may have to tap them, could be very annoying. Possibly I'd rather get shorter bolts than tap 48 threaded inserts.

I've put in holes for the HGR15 rails on the X and Z axes (don't know spacing yet for Y), but I'm wondering if I actually shouldn't drill all these holes upfront, and instead drill only the 2 endpoints for one rail and 1 endpoint for the other. Then bolt the first rail in with the endpoints, and transfer & drill the actual observed hole positions for the rest of the first rail. Then bolt the second rail in with only one end point, and slider an indicator along to put the second end the same distance away, and then transfer & drill the actual observed hole positions for the rest of the second rail. That way I know I can get them parallel and make sure the holes line up.

The other option is to rely on the CNC router to drill the holes in the right place, and I can always widen the holes in the rails if I end up needing more adjustment, which I would expect not to. I think easier to do this and hope for the best.

Well I've got all the holes in place and so far no collisions.

Some of the X carriage holes will live under the Z axis rails:

But I think I can live with that. It does mean that the Z axis rails have to come off if I ever need to take the X axis carriages off.

What's more trouble: have the X carriage bolts underneath the Z rails? Or move the X carriages further apart so that the rail runs down the middle?

I think if I have room to do the latter I should do that. I think it's OK if the carriages overhang the plate, as long as the bolts go through the plate.

Plenty of room:

So the only remaining missing holes are the ones for the spindle clamp, for bolting the frame plates together, and the counterbores for the flange-headed bolts.

The spindle clamp is definitely going to cover the bolts of the lower Z carriages, but there's not a lot I can do about that:

If I'm taking those carriages off I'll need to re-tram the spindle clamp anyway, so I don't think that's a big deal.

According to the eBay listings for the bolts:

• M4: flange diameter 9.4mm, head depth including flange 2.2mm
• M5: flance diameter 11.8mm, head depth including flange 2.75mm

I'll go for counterbores of 11mm diameter 3mm depth, and 13mm diameter 4mm depth.

Counter-bores in place:

• motor mounts
• Y rail holes
• spindle clamp holes
• frame plate holes

Annoyingly all 3 motor mounts might have to be slightly different because they all ended up different distances away from the adjacent frame plates.

I had a look at the M8 flanged bolts I have. They only have 25mm of thread so are not going to be suitable for bolting frame plates together. I'll probably go for M6 flange-headed bolts with 40mm of thread.

< 2024-03-10 2024-03-12 >