Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add New Rule Builder: Tactic Generator #70

Closed
wants to merge 37 commits into from
Closed

Add New Rule Builder: Tactic Generator #70

wants to merge 37 commits into from

Conversation

yangky11
Copy link

@yangky11 yangky11 commented Oct 7, 2023

This PR adds a new rule builder, allowing the user to tag an MVarID -> MetaM (Array (String × Float)) as a "tactic generator". For example,

@[aesop unsafe 80% tactic]
def x : MVarId → MetaM (Array (String × Float)) := fun _ => do
  return #[("rw [Nat.add_comm b]", 0.5), ("rw [Nat.add_assoc]", 0.9), ("rw [Nat.add_comm]", 0.8)]

Here the scores (0.5, 0.9, 0.8) are "probability modifiers". They are multiplied to the success probabilities during proof search.

Please see the new AesopTest/TacGen.lean file for a complete use case.

The user is free to make the tactic generator arbitrarily complex (e.g., using LLMs).

Peiyang-Song and others added 30 commits September 12, 2023 08:56
Kaiyu lean infer dev
add detection for hidden sorry/admit
@JLimperg
Copy link
Collaborator

JLimperg commented Oct 9, 2023

Hey Kaiyu! Thanks for the nice PR. I've made various changes (hopefully improvements), but didn't want to clobber your master branch, so I've pushed them here:

https://github.com/JLimperg/aesop/tree/aesop-llm

Could you look at these to check whether anything seems wrong to you?

@yangky11
Copy link
Author

yangky11 commented Oct 9, 2023

Hi @JLimperg, thank you for the changes; they look great to me. I'll try to integrate it with LLMs and do more testing. I'll post an update later.

@yangky11
Copy link
Author

yangky11 commented Oct 9, 2023

Hi Jannis, I see you're also working on the script builder (not in this PR). How far are we from always being able to produce a proof script whenever the aesop tactic succeeds? The script builder is important for LLM-aesop to become useful, because LLMs may not generate the same set of tactic suggestions every time. It's important for the user to be able to replace the aesop tactic with the actual tactics found during proof search.

@yangky11
Copy link
Author

yangky11 commented Oct 9, 2023

I have tested https://github.com/JLimperg/aesop/tree/aesop-llm in the dev branch of LeanInfer: https://github.com/lean-dojo/LeanInfer/blob/dev/LeanInferTests/Aesop.lean. It works great!

I plan to integrate this feature into the next release of LeanInfer, which will probably come out later this month (together with ongoing improvements in the speed and quality of tactic generation).

A minor question: The 100% here doesn't really play any role (since the probabilities are produced by the model)? If so, can we get rid of it?

@JLimperg
Copy link
Collaborator

JLimperg commented Oct 9, 2023

How far are we from always being able to produce a proof script whenever the aesop tactic succeeds?

Producing a functioning script is not so difficult and should already work, apart from small bugs. E.g. in AesopTest.List, there's only one Aesop call that doesn't produce a functioning script. If you do set_option aesop.check.script true, Aesop will check whether the generated script would solve the goal.

What I'm currently working on is making these scripts more idiomatic (no weird tactics, proper structure, etc.). This is, as it turns out, quite annoying.

I have tested https://github.com/JLimperg/aesop/tree/aesop-llm in the dev branch of LeanInfer: https://github.com/lean-dojo/LeanInfer/blob/dev/LeanInferTests/Aesop.lean. It works great!

Nice, happy to hear! I'll merge this into Aesop master then.

A minor question: The 100% here doesn't really play any role (since the probabilities are produced by the model)? If so, can we get rid of it?

I could maybe special-case TacGen rules. Will see.

@JLimperg
Copy link
Collaborator

Closing this PR since the aesop-llm changes are now in master.

@JLimperg JLimperg closed this Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants