[HN Gopher] Show HN: Sort lines semantically using llm-sort
___________________________________________________________________
Show HN: Sort lines semantically using llm-sort
This is a small plugin I made for Simon Willison's llm utility.
You can do things like: cat names.txt | llm sort -q "Which one of
these names is best for a pet seagull?" cat books.txt | llm sort
-q "Which book is more related to basic vs. advanced CS topics?" I
see a lot of potential marrying LLMs with classic UNIX interfaces.
Author : vagozino
Score : 22 points
Date : 2025-02-11 03:25 UTC (1 days ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| gntousakis wrote:
| Great work!
| cratermoon wrote:
| cat spelling.txt | llm sort -q "how many times does the letter
| 'r' appear in the word 'strawberry'?" cat
| geology.txt | llm sort -q "which kind of rock is the best to eat,
| according to Berkeley geologists?" cat law-
| library.txt | llm sort -q "what legal precedents are best for my
| lawsuit vs Colombian airline Avianca?" cat
| adhesives.txt | llm sort -q "what glue is best for holding the
| cheese on my pizza?"
| scarface_74 wrote:
| Exactly, this entire idea is based on random probability.
|
| I know that's always the complaint with LLMs. But at least with
| the paid ChatGPT (the product, not the API), it has access to a
| Python runtime and web search built in so it could at least
| attempt to get the some of the answers right.
| MPSimmons wrote:
| O(n^f***)
| adamgordonbell wrote:
| Have you tried reading the probability of X being the token
| returned? then you will probably be get better answers and not
| need to compare every 2.
|
| Log probabilities of output tokens indicate the likelihood of
| each token occurring given the context.
| eterps wrote:
| So this is actual sorting (i.e. the same amount of lines appear
| in the output)?
|
| Otherwise it might be more or less the same as using
| https://github.com/TheR1D/shell_gpt ?
| noperator wrote:
| I published a nearly identical tool, referencing the same paper,
| a few weeks ago :) Although I implemented a listwise algorithm
| instead of pairwise as described in the paper; ends up being a
| lot faster.
|
| https://github.com/BishopFox/raink
|
| https://bishopfox.com/blog/raink-llms-document-ranking
| raink \ -f testdata/sentences.txt \ -r 10
| \ -s 10 \ -p 'Rank each of these items
| according to their relevancy to the concept of "time".' |
| jq -r '.[:10] | map(.value)[]' | nl
| 1 The train arrived exactly on time. 2 The old clock
| chimed twelve times. 3 The clock ticked steadily on
| the wall. 4 The bell rang, signaling the end of
| class. 5 The rooster crowed at the break of dawn.
| 6 She climbed to the top of the hill to watch the sunset.
| 7 He watched as the leaves fell one by one. 8 The
| stars twinkled brightly in the clear night sky. 9 He
| spotted a shooting star while stargazing. 10 She
| opened the curtains to let in the morning light.
___________________________________________________________________
(page generated 2025-02-12 23:02 UTC)