Steven Liu

stevhliu

AI & ML interests

None yet

Recent Activity

Articles

Organizations

stevhliu's activity

New activity in huggingface/documentation-images 23 days ago

cogvideox-images diffusers/pull/9578

2
#371 opened about 2 months ago by dmeck
updated a Space 3 months ago
New activity in diffusers/README 4 months ago

update org card

6
#3 opened 4 months ago by stevhliu
New activity in huggingface/cookbook-images 4 months ago
New activity in huggingface/cookbook-images 5 months ago

Upload colab-secrets.jpeg

#20 opened 5 months ago by lloydmeta
Reacted to m-ric's post with ๐Ÿš€ 6 months ago
view post
Post
1037
๐๐ž๐ฐ ๐ ๐ฎ๐ข๐๐ž ๐ข๐ง ๐จ๐ฎ๐ซ ๐Ž๐ฉ๐ž๐ง-๐’๐จ๐ฎ๐ซ๐œ๐ž ๐€๐ˆ ๐œ๐จ๐จ๐ค๐›๐จ๐จ๐ค: ๐™Ž๐™ฉ๐™ง๐™ช๐™˜๐™ฉ๐™ช๐™ง๐™š๐™™ ๐™œ๐™š๐™ฃ๐™š๐™ง๐™–๐™ฉ๐™ž๐™ค๐™ฃ! โœจ

Many use LLM use cases involve generating outputs with a specific structure.

โžก๏ธ For instance when using an LLM as a judge to evaluate another model's outputs, you need it to give you not only a score, but also the rationale for this score, and maybe a confidence level.
So you do not need only "score: 1", but more a dictionary like:
{
     "rationale": "The answer does not match the true answer at all."
     "score": 1,
     "confidence_level": 0.85
}


๐Ÿค” How to force your LLM to generate such a structured output?

๐Ÿ—๏ธ ๐—–๐—ผ๐—ป๐˜€๐˜๐—ฟ๐—ฎ๐—ถ๐—ป๐—ฒ๐—ฑ ๐—ฑ๐—ฒ๐—ฐ๐—ผ๐—ฑ๐—ถ๐—ป๐—ด is a great technique to generate structured output: you can specify a grammar (=set of rules) that the output should follow, and ๐—ฐ๐—ผ๐—ป๐˜€๐˜๐—ฟ๐—ฎ๐—ถ๐—ป๐—ฒ๐—ฑ ๐—ฑ๐—ฒ๐—ฐ๐—ผ๐—ฑ๐—ถ๐—ป๐—ด ๐˜๐—ต๐—ฒ๐—ป ๐—ณ๐—ผ๐—ฟ๐—ฐ๐—ฒ๐˜€ ๐˜๐—ต๐—ฒ ๐—ฑ๐—ฒ๐—ฐ๐—ผ๐—ฑ๐—ฒ๐—ฟ ๐˜๐—ผ ๐—ผ๐—ป๐—น๐˜† ๐—ฝ๐—ถ๐—ฐ๐—ธ ๐˜๐—ผ๐—ธ๐—ฒ๐—ป๐˜€ ๐˜๐—ต๐—ฎ๐˜ ๐—ฟ๐—ฒ๐˜€๐—ฝ๐—ฒ๐—ฐ๐˜ ๐˜†๐—ผ๐˜‚๐—ฟ ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ฎ๐—ฟ.

I've created a guide to show you how to use it, both via our Inference API and locally using ๐˜ฐ๐˜ถ๐˜ต๐˜ญ๐˜ช๐˜ฏ๐˜ฆ๐˜ด!

๐Ÿ‘‰ Read it here: https://huggingface.co/learn/cookbook/structured_generation

Thank you @stevhliu for your great help in improving it!