Skip to content
  • Hjem
  • Seneste
  • Etiketter
  • Populære
  • Verden
  • Bruger
  • Grupper
Temaer
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Kollaps
FARVEL BIG TECH
  1. Forside
  2. Ikke-kategoriseret
  3. I've seen people claiming - with a straight face - that mechanical refactoring is a good use-case for LLM-based tools.

I've seen people claiming - with a straight face - that mechanical refactoring is a good use-case for LLM-based tools.

Planlagt Fastgjort Låst Flyttet Ikke-kategoriseret
42 Indlæg 19 Posters 68 Visninger
  • Ældste til nyeste
  • Nyeste til ældste
  • Most Votes
Svar
  • Svar som emne
Login for at svare
Denne tråd er blevet slettet. Kun brugere med emne behandlings privilegier kan se den.
  • csepp@merveilles.townC csepp@merveilles.town

    @gabrielesvelto Or when sed fails you can often write a quick script in Python (or your language of choice).
    For real tho I would love to have a dependable refactoring tool that understands syntax, probably something based on Tree Sitter, but I haven't been able to get any working.

    gabrielesvelto@mas.toG This user is from outside of this forum
    gabrielesvelto@mas.toG This user is from outside of this forum
    gabrielesvelto@mas.to
    wrote sidst redigeret af
    #4

    @csepp several fancy IDEs already have extremely sophisticate refactoring tools that understand the language syntax, e.g.: https://www.jetbrains.com/help/idea/refactoring-source-code.html

    csepp@merveilles.townC crazyeddie@mastodon.socialC 2 Replies Last reply
    0
    • gabrielesvelto@mas.toG gabrielesvelto@mas.to

      I've seen people claiming - with a straight face - that mechanical refactoring is a good use-case for LLM-based tools. Well, sed was developed in 1974 and - according to Wikipedia - first shipped in UNIX version 7 in 1979. On modern machines it can process files at speeds of several GB/s and will not randomly introduce errors while processing them. It doesn't cost billions, a subscription or internet access. It's there on your machine, fully documented. What are we even talking about?

      elrohir@mastodon.galE This user is from outside of this forum
      elrohir@mastodon.galE This user is from outside of this forum
      elrohir@mastodon.gal
      wrote sidst redigeret af
      #5

      @gabrielesvelto This parallels the discourse that says "LLMs are useful to automatically send template emails dozens of times a day". My Brother In Ohm, email templates have existed for decades at a fraction of the cost of a single token. You are just Dunning-Krügering yourself into thinking that the idea has just been solved today because you had never paid any attention to this problem until the day you wanted to search for an use case for a toy that you want to have an excuse for buying.

      1 Reply Last reply
      0
      • gabrielesvelto@mas.toG gabrielesvelto@mas.to

        I've seen people claiming - with a straight face - that mechanical refactoring is a good use-case for LLM-based tools. Well, sed was developed in 1974 and - according to Wikipedia - first shipped in UNIX version 7 in 1979. On modern machines it can process files at speeds of several GB/s and will not randomly introduce errors while processing them. It doesn't cost billions, a subscription or internet access. It's there on your machine, fully documented. What are we even talking about?

        aurisc4@floss.socialA This user is from outside of this forum
        aurisc4@floss.socialA This user is from outside of this forum
        aurisc4@floss.social
        wrote sidst redigeret af
        #6

        @gabrielesvelto I've been presented a case where changes were quite trivial across many repos, but making those changes still required taking context into account. LLM was helpful.
        But...
        that same presentation showed logs of tool admitting of doing forced push when it was from the start specifically instructed not to do forced pushes.

        Feels like we need sandboxed dev environments where these tools could not do dangerous things, as they themselves are bad at this.

        gabrielesvelto@mas.toG 1 Reply Last reply
        0
        • dain@hachyderm.ioD dain@hachyderm.io

          @gabrielesvelto to be fair I'd much more trust Claude to write the sed regexes than myself... but it's inexcusable to brute force that kind of string replacement work directly with an LLM!

          randamumaki@mstdn.socialR This user is from outside of this forum
          randamumaki@mstdn.socialR This user is from outside of this forum
          randamumaki@mstdn.social
          wrote sidst redigeret af
          #7

          @dain @gabrielesvelto https://regex-generator.olafneumann.org

          dain@hachyderm.ioD 1 Reply Last reply
          0
          • gabrielesvelto@mas.toG gabrielesvelto@mas.to

            @csepp several fancy IDEs already have extremely sophisticate refactoring tools that understand the language syntax, e.g.: https://www.jetbrains.com/help/idea/refactoring-source-code.html

            csepp@merveilles.townC This user is from outside of this forum
            csepp@merveilles.townC This user is from outside of this forum
            csepp@merveilles.town
            wrote sidst redigeret af
            #8

            @gabrielesvelto Yup, those are also pretty great.
            Personally, I needed to refactor some C++ code that didn't fit any simple regex, so I ended up writing a Lua script to do it and did the rest of it by hand.
            The only way I could find to reliably automate it would have been to write a custom clang-tidy pass, which didn't seem worth the effort.
            I still wouldn't use an LLM for it, but I do wish there was an easier way to load the code model in a scripting language. To automate the refactor I did I would have needed to track arguments that are passed through variables or that come from function parameters, access non-C++ files (move strings to YAML), rewrite various forms of string concatenation to format strings, etc.

            crazyeddie@mastodon.socialC 1 Reply Last reply
            0
            • aurisc4@floss.socialA aurisc4@floss.social

              @gabrielesvelto I've been presented a case where changes were quite trivial across many repos, but making those changes still required taking context into account. LLM was helpful.
              But...
              that same presentation showed logs of tool admitting of doing forced push when it was from the start specifically instructed not to do forced pushes.

              Feels like we need sandboxed dev environments where these tools could not do dangerous things, as they themselves are bad at this.

              gabrielesvelto@mas.toG This user is from outside of this forum
              gabrielesvelto@mas.toG This user is from outside of this forum
              gabrielesvelto@mas.to
              wrote sidst redigeret af
              #9

              @aurisc4 I've done a mix of grep and send a lot of times to add context. If more sophisticate refactoring is needed there are tools that understand the syntax of practically any language in existence and can be used for direct manipulation of the ASTs. Every problem where the input is machine-readable can be solved in a faster, cheaper and more reliable way using tools that process the data directly rather than passing through a (very large) neural network.

              1 Reply Last reply
              0
              • gabrielesvelto@mas.toG gabrielesvelto@mas.to

                I've seen people claiming - with a straight face - that mechanical refactoring is a good use-case for LLM-based tools. Well, sed was developed in 1974 and - according to Wikipedia - first shipped in UNIX version 7 in 1979. On modern machines it can process files at speeds of several GB/s and will not randomly introduce errors while processing them. It doesn't cost billions, a subscription or internet access. It's there on your machine, fully documented. What are we even talking about?

                apgarcia@fosstodon.orgA This user is from outside of this forum
                apgarcia@fosstodon.orgA This user is from outside of this forum
                apgarcia@fosstodon.org
                wrote sidst redigeret af
                #10

                @gabrielesvelto fun fact: the speed of sed comes from the fact that it leverages FSM-based matching under the hood. So, I say: FSM FTW!

                1 Reply Last reply
                0
                • gabrielesvelto@mas.toG gabrielesvelto@mas.to

                  I've seen people claiming - with a straight face - that mechanical refactoring is a good use-case for LLM-based tools. Well, sed was developed in 1974 and - according to Wikipedia - first shipped in UNIX version 7 in 1979. On modern machines it can process files at speeds of several GB/s and will not randomly introduce errors while processing them. It doesn't cost billions, a subscription or internet access. It's there on your machine, fully documented. What are we even talking about?

                  fourlastor@androiddev.socialF This user is from outside of this forum
                  fourlastor@androiddev.socialF This user is from outside of this forum
                  fourlastor@androiddev.social
                  wrote sidst redigeret af
                  #11

                  @gabrielesvelto I don't think the comparison is entirely fair tho. Both sed and syntax tree based editing are really powerful (and I use both when it makes sense), but if you need to do a one off migration you might be spending hours trying to figure out how to make it work right, while an llm will do a good enough job where you need to review the changes and fix a few mistakes, usually at the first try, without you having to actively spend time on it.

                  gabrielesvelto@mas.toG crazyeddie@mastodon.socialC 2 Replies Last reply
                  0
                  • fourlastor@androiddev.socialF fourlastor@androiddev.social

                    @gabrielesvelto I don't think the comparison is entirely fair tho. Both sed and syntax tree based editing are really powerful (and I use both when it makes sense), but if you need to do a one off migration you might be spending hours trying to figure out how to make it work right, while an llm will do a good enough job where you need to review the changes and fix a few mistakes, usually at the first try, without you having to actively spend time on it.

                    gabrielesvelto@mas.toG This user is from outside of this forum
                    gabrielesvelto@mas.toG This user is from outside of this forum
                    gabrielesvelto@mas.to
                    wrote sidst redigeret af
                    #12

                    @fourlastor what about the time spent setting up the LLM, sandboxing it and then reviewing all the changes? What about the risk of the code containing prompt-injections that might be designed to introduce vulnerabilities or simply take over your machine or credentials for a state-sponsored attacker to use? What about the reliance on a single closed-source paid-for commercial tool? Those are a lot of disadvantages to make up for.

                    fourlastor@androiddev.socialF 1 Reply Last reply
                    0
                    • randamumaki@mstdn.socialR randamumaki@mstdn.social

                      @dain @gabrielesvelto https://regex-generator.olafneumann.org

                      dain@hachyderm.ioD This user is from outside of this forum
                      dain@hachyderm.ioD This user is from outside of this forum
                      dain@hachyderm.io
                      wrote sidst redigeret af
                      #13

                      @RandamuMaki @gabrielesvelto oh, that expression builder in the second step is really nice! wish it would then do match testing on more lines in further steps like how regex101 does

                      1 Reply Last reply
                      0
                      • gabrielesvelto@mas.toG gabrielesvelto@mas.to

                        @fourlastor what about the time spent setting up the LLM, sandboxing it and then reviewing all the changes? What about the risk of the code containing prompt-injections that might be designed to introduce vulnerabilities or simply take over your machine or credentials for a state-sponsored attacker to use? What about the reliance on a single closed-source paid-for commercial tool? Those are a lot of disadvantages to make up for.

                        fourlastor@androiddev.socialF This user is from outside of this forum
                        fourlastor@androiddev.socialF This user is from outside of this forum
                        fourlastor@androiddev.social
                        wrote sidst redigeret af
                        #14

                        @gabrielesvelto answering in order:

                        >what about the time spent setting up the LLM, sandboxing it and then reviewing all the changes?

                        This for what I'm working on is usually between 30 and 40 minutes, start to end (minus the time that the LLM takes to do its own work in its own git subtree, while I do other stuff). For context, claude doesn't commit, I review the changes locally (git is blacklisted). In my case this is been pretty stable on 100-150 tasks where I did the same kind of migration

                        fourlastor@androiddev.socialF 1 Reply Last reply
                        0
                        • fourlastor@androiddev.socialF fourlastor@androiddev.social

                          @gabrielesvelto answering in order:

                          >what about the time spent setting up the LLM, sandboxing it and then reviewing all the changes?

                          This for what I'm working on is usually between 30 and 40 minutes, start to end (minus the time that the LLM takes to do its own work in its own git subtree, while I do other stuff). For context, claude doesn't commit, I review the changes locally (git is blacklisted). In my case this is been pretty stable on 100-150 tasks where I did the same kind of migration

                          fourlastor@androiddev.socialF This user is from outside of this forum
                          fourlastor@androiddev.socialF This user is from outside of this forum
                          fourlastor@androiddev.social
                          wrote sidst redigeret af
                          #15

                          @gabrielesvelto prompt-injections

                          The project is closed source, and we don't have places where we randomly include text files, if someone IN THE COMPANY manages to introduce malicious code, imho they'd just infect gradle instead of hoping on someone running an LLM to trigger something (other than devs having access to only what they need). State sponsored hackers specifically are really not in my list of things I can defend from, be it from LLMs or whatever introduced attacks

                          fourlastor@androiddev.socialF gabrielesvelto@mas.toG 2 Replies Last reply
                          0
                          • fourlastor@androiddev.socialF fourlastor@androiddev.social

                            @gabrielesvelto prompt-injections

                            The project is closed source, and we don't have places where we randomly include text files, if someone IN THE COMPANY manages to introduce malicious code, imho they'd just infect gradle instead of hoping on someone running an LLM to trigger something (other than devs having access to only what they need). State sponsored hackers specifically are really not in my list of things I can defend from, be it from LLMs or whatever introduced attacks

                            fourlastor@androiddev.socialF This user is from outside of this forum
                            fourlastor@androiddev.socialF This user is from outside of this forum
                            fourlastor@androiddev.social
                            wrote sidst redigeret af
                            #16

                            @gabrielesvelto What about the reliance on a single closed-source paid-for commercial tool

                            On this I 100% agree, you shouldn't RELY on it. I am confident that I can make the same changes myself (in some cases I did because it was clearly less time consuming than making an LLM do that), if tomorrow these tools disappear I am sure I will be comfortable working without them (as I do for example for my OSS/hobby work, where I can't really justify paying for the subscription)

                            fourlastor@androiddev.socialF 1 Reply Last reply
                            0
                            • gabrielesvelto@mas.toG gabrielesvelto@mas.to

                              I've seen people claiming - with a straight face - that mechanical refactoring is a good use-case for LLM-based tools. Well, sed was developed in 1974 and - according to Wikipedia - first shipped in UNIX version 7 in 1979. On modern machines it can process files at speeds of several GB/s and will not randomly introduce errors while processing them. It doesn't cost billions, a subscription or internet access. It's there on your machine, fully documented. What are we even talking about?

                              gundersen@mastodon.socialG This user is from outside of this forum
                              gundersen@mastodon.socialG This user is from outside of this forum
                              gundersen@mastodon.social
                              wrote sidst redigeret af
                              #17

                              @gabrielesvelto the developers of TypeScript have decided not to implement refactoring tools because the refactoring can be done by LLMs...

                              1 Reply Last reply
                              0
                              • gabrielesvelto@mas.toG gabrielesvelto@mas.to

                                I've seen people claiming - with a straight face - that mechanical refactoring is a good use-case for LLM-based tools. Well, sed was developed in 1974 and - according to Wikipedia - first shipped in UNIX version 7 in 1979. On modern machines it can process files at speeds of several GB/s and will not randomly introduce errors while processing them. It doesn't cost billions, a subscription or internet access. It's there on your machine, fully documented. What are we even talking about?

                                hipsterelectron@circumstances.runH This user is from outside of this forum
                                hipsterelectron@circumstances.runH This user is from outside of this forum
                                hipsterelectron@circumstances.run
                                wrote sidst redigeret af
                                #18

                                @gabrielesvelto i spent the last week using sed to produce an entire module system for a prototype. lovely piece of software that expands the meaning of structured data. not at all perfect but if we're comparing it to statistical approaches it at least has the benefit of determinism

                                1 Reply Last reply
                                0
                                • fourlastor@androiddev.socialF fourlastor@androiddev.social

                                  @gabrielesvelto What about the reliance on a single closed-source paid-for commercial tool

                                  On this I 100% agree, you shouldn't RELY on it. I am confident that I can make the same changes myself (in some cases I did because it was clearly less time consuming than making an LLM do that), if tomorrow these tools disappear I am sure I will be comfortable working without them (as I do for example for my OSS/hobby work, where I can't really justify paying for the subscription)

                                  fourlastor@androiddev.socialF This user is from outside of this forum
                                  fourlastor@androiddev.socialF This user is from outside of this forum
                                  fourlastor@androiddev.social
                                  wrote sidst redigeret af
                                  #19

                                  @gabrielesvelto a counter example: one migration I needed to make was to migrate java serializable to parcelable. That was a GREAT candidate to be worked on by modifying the syntax tree. I created a small throw away plugin in intellij which did the work, removed the extension, added the annotation and ran on thousands of files in a few seconds.Imho trying to find the most appropiate tool for the task at hand is important, and having an all-or-nothing mentality (on either side) isn't constructive

                                  1 Reply Last reply
                                  0
                                  • gabrielesvelto@mas.toG gabrielesvelto@mas.to

                                    I've seen people claiming - with a straight face - that mechanical refactoring is a good use-case for LLM-based tools. Well, sed was developed in 1974 and - according to Wikipedia - first shipped in UNIX version 7 in 1979. On modern machines it can process files at speeds of several GB/s and will not randomly introduce errors while processing them. It doesn't cost billions, a subscription or internet access. It's there on your machine, fully documented. What are we even talking about?

                                    adingbatponder@fosstodon.orgA This user is from outside of this forum
                                    adingbatponder@fosstodon.orgA This user is from outside of this forum
                                    adingbatponder@fosstodon.org
                                    wrote sidst redigeret af
                                    #20

                                    @gabrielesvelto For fun I tried writing rust code with claude code. The code took an age to compile when it worked (do we call it build?). The project took months and so the code got large & was slow to build. Claude was able to refactor it (after it worked) to build 10 times faster. That is not mechanical as you mention... but was really challenging. Mechanical refactors it does 100 times better still of course, because it seds too yes, but it can check the new syntax & test build each change.

                                    gabrielesvelto@mas.toG 1 Reply Last reply
                                    0
                                    • csepp@merveilles.townC csepp@merveilles.town

                                      @gabrielesvelto Or when sed fails you can often write a quick script in Python (or your language of choice).
                                      For real tho I would love to have a dependable refactoring tool that understands syntax, probably something based on Tree Sitter, but I haven't been able to get any working.

                                      keithpjolley@discuss.systemsK This user is from outside of this forum
                                      keithpjolley@discuss.systemsK This user is from outside of this forum
                                      keithpjolley@discuss.systems
                                      wrote sidst redigeret af
                                      #21

                                      @csepp @gabrielesvelto tbf, in all likelyhood it wouldn't be `sed` that fails. it would be the inputs to `sed` that failed - garbage in, garbage out.

                                      1 Reply Last reply
                                      0
                                      • gabrielesvelto@mas.toG gabrielesvelto@mas.to

                                        I've seen people claiming - with a straight face - that mechanical refactoring is a good use-case for LLM-based tools. Well, sed was developed in 1974 and - according to Wikipedia - first shipped in UNIX version 7 in 1979. On modern machines it can process files at speeds of several GB/s and will not randomly introduce errors while processing them. It doesn't cost billions, a subscription or internet access. It's there on your machine, fully documented. What are we even talking about?

                                        P This user is from outside of this forum
                                        P This user is from outside of this forum
                                        patricus@gts.posix.live
                                        wrote sidst redigeret af
                                        #22

                                        @gabrielesvelto not really, it is not on my computer.

                                        1 Reply Last reply
                                        0
                                        • fourlastor@androiddev.socialF fourlastor@androiddev.social

                                          @gabrielesvelto I don't think the comparison is entirely fair tho. Both sed and syntax tree based editing are really powerful (and I use both when it makes sense), but if you need to do a one off migration you might be spending hours trying to figure out how to make it work right, while an llm will do a good enough job where you need to review the changes and fix a few mistakes, usually at the first try, without you having to actively spend time on it.

                                          crazyeddie@mastodon.socialC This user is from outside of this forum
                                          crazyeddie@mastodon.socialC This user is from outside of this forum
                                          crazyeddie@mastodon.social
                                          wrote sidst redigeret af
                                          #23

                                          @fourlastor @gabrielesvelto It's not a use sed or use LLM scenario here.

                                          Sed isn't a refactoring tool. There are plenty of actual refactoring tools that don't use LLMs. I was using them before LLMs were invented and no, fucking sed isn't the same thing. I'm rather hoping that wasn't actually a serious comparison 😛

                                          Mechanical refactors are deterministic algorithms. If the conversation is about sticking AI in that it's probably nonsense and you can leave without fearing you'll miss anything

                                          1 Reply Last reply
                                          0
                                          Svar
                                          • Svar som emne
                                          Login for at svare
                                          • Ældste til nyeste
                                          • Nyeste til ældste
                                          • Most Votes


                                          • Log ind

                                          • Har du ikke en konto? Tilmeld

                                          • Login or register to search.
                                          Powered by NodeBB Contributors
                                          Graciously hosted by data.coop
                                          • First post
                                            Last post
                                          0
                                          • Hjem
                                          • Seneste
                                          • Etiketter
                                          • Populære
                                          • Verden
                                          • Bruger
                                          • Grupper