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

Tab-jumping #27

Open
torshepherd opened this issue Feb 8, 2025 · 8 comments
Open

Tab-jumping #27

torshepherd opened this issue Feb 8, 2025 · 8 comments

Comments

@torshepherd
Copy link

What would it take to add support for tab-jumping, a la Cursor? This makes tab completion significantly more useful.

I would imagine there's an API endpoint needed on the server side? Or just a different kind of response capability from the server? And then implement a visualization + jump implementation in the client?

@ggerganov
Copy link
Member

We need a way to determine the best position to jump to. My guess is that Cursor uses custom models that are trained specifically to do this prediction. But I have some ideas how to do it just based on the logprobs of the context around us.

@torshepherd
Copy link
Author

Is it a good task for a first issue? I'd love to try some stuff :) if you already have a branch in the works I'll hold off

@ggerganov
Copy link
Member

I don't think it is a very simple task. I would first do some experiments and explore some ideas about how to determine the jump - it's not very obvious. My thoughts are along detecting the logprob changes after accepting a suggestion and jump where the biggest change occurs. But the details are not clear to me yet. If this is a viable strategy, then we can find a way to do this efficiently by adding server-side caches to handle this.

I haven't started working on it, so feel free to experiment.

@Acters
Copy link

Acters commented Feb 11, 2025

We need a way to determine the best position to jump to. My guess is that Cursor uses custom models that are trained specifically to do this prediction. But I have some ideas how to do it just based on the logprobs of the context around us.

you are correct, Cursor AI has made a model for this specific purpose(that is much more improved over what they used to do, but not sure the specifics) https://www.cursor.com/blog/tab-update

but I imagine there is quite a bit of integration code in the main cursor app to make this model really shine.
the section The most useful copilot talks a little on what the goals for Cursor Tab system works. while the other sections are more or less self-explanatory.

I find when it comes to replicated/similar enough code segments, the Cursor tab will automatically suggest some really interesting stuff that I would need to copy-paste/multi-line edit for. Other times the Cursor tab seems to be able to realize I have changed my mind on the type the variable is or other edits that would make sure something new I put would work if compile(or for interpreted languages it will not really matter?) And ofcourse the main feature is that it will try to edit a section(like if I pull/paste a piece of code that is a template/structural) to include references and/or extra code that it would predict I need to add in.(especially if I leave a comment to direct it on more complex tasks/heavier edits)

I didn't explore too deeply but it seems nice feature to have. https://docs.cursor.com/tab/overview

@torshepherd
Copy link
Author

I would say that from my experience, Supermaven's tab jumping is probably both more feasible for an extension and much more responsive

@8times4
Copy link

8times4 commented Feb 13, 2025

AI moves fast, looks like Zed just added edit-prediction and open-sourced the model for it called Zeta, based on qwen 2.5 coder 7b, https://x.com/zeddotdev/status/1890120743603577082
I guess their implementation could be reimplemented here?

Edit: there is already a GGUF version here: https://huggingface.co/brittlewis12/zeta-GGUF

@ggerganov
Copy link
Member

ggerganov commented Feb 14, 2025

Cool, but from the model page and the blog post it is not clear to me how the jump prediction is found. Is there any additional technical information?

If I had to guess, it asks the LLM to rewrite a chunk of code given last few edits as a context in the prompt. And then maybe based on the diff between the current code and the generated code, it suggests the jumps.

Also not clear if the zeta model is only for jump prediction or if it still has FIM support. I suppose it does not have FIM support (or it's quality is degraded) because it seems the prompt template has changed to system/user/assistant. If that is the case, it would be big disadvantage because we would have to load 2 models - one for FIM (i.e. vanilla Qwen 2.5 Coder) and one for jump prediction (i.e. Zeta)

@Acters
Copy link

Acters commented Feb 15, 2025

Cool, but from the model page and the blog post it is not clear to me how the jump prediction is found. Is there any additional technical information?

If I had to guess, it asks the LLM to rewrite a chunk of code given last few edits as a context in the prompt. And then maybe based on the diff between the current code and the generated code, it suggests the jumps.

Also not clear if the zeta model is only for jump prediction or if it still has FIM support. I suppose it does not have FIM support (or it's quality is degraded) because it seems the prompt template has changed to system/user/assistant. If that is the case, it would be big disadvantage because we would have to load 2 models - one for FIM (i.e. vanilla Qwen 2.5 Coder) and one for jump prediction (i.e. Zeta)

I have a tool for helping "de obfuscate" code by simply only renaming only variables/functions/parameters. my logic of finding them require making use of the languages AST system to pull them out and ask the ai to rename it based on the code context which returns a json of the name to be replaced as ID and the new name as value. It isn't super good at finding everything but it is really useful.

why I mention it? well it is basically editing it but using AI to generate the new names. However, this is not the main goal of course. Instead, it is clear the zeta model has special tokens for this as seen in the main source code https://github.com/zed-industries/zed/blob/main/crates/zeta/src/zeta.rs#L861

there are some examples in the form of "fake completions" in the same file. https://github.com/zed-industries/zed/blob/main/crates/zeta/src/zeta.rs#L861

There is a lot more going on likely, but I am not well versed in rust code. So yes, it does seem like it is entirely a separate model that runs for this specific task of finding, and supplying edits. however this does not mean it is impossible to use a different model for this(but clearly a fine-tuned model performs better) as the documentation show it can use Github Copilot or SuperMaven https://github.com/zed-industries/zed/blob/79e3faffb2dce29463214d65b3659071c4c62647/docs/src/completions.md?plain=1#L6

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

No branches or pull requests

4 participants