Hi everyone, I've pushed code to inspect the data ...
# proj-codescout
q
Hi everyone, I've pushed code to inspect the data from the localization step of Agentless. I've attached example outputs at the end of this message. The paper says they got 32% on SWE-Bench Lite using GPT-4o. Here are some more metrics on % of Correct Location: 1. Line: 35.3% 2. Function: 52% 3. File: 69.7% Do we want to create a reward by comparing our model's output to the localization step of Agentless? Or am I missing something here? I ask this because I’m confused if we want to use their data as the ground truth as opposed to the patch in SWE-Bench itself? i.e despite their 69.7% accuracy on files found do we want to use that as the ground truth search space(assuming it is broader) for our model’s tool results?
Copy code
$ python agentless_localization.py --input_file agentless_swebench_lite/edit_location_samples/loc_outputs.jsonl --num_samples 2

Instance ID: django__django-10914

Found Files:
        django/core/files/storage.py
        django/conf/global_settings.py
        django/core/files/uploadhandler.py
        django/core/files/uploadedfile.py
        docs/conf.py
        django/core/files/temp.py

Found Related Locs:

        File Path: django/core/files/storage.py
        Related Locs:
                class: FileSystemStorage

        File Path: django/conf/global_settings.py
        Related Locs:
                variable: FILE_UPLOAD_PERMISSIONS

        File Path: django/core/files/uploadhandler.py
        Related Locs:


Found Edit Locs:

        Edit Location Set #1:
                File: django/core/files/storage.py
                        function: FileSystemStorage._save
                        line: 260
                File: django/conf/global_settings.py
                        line: 307
                File: django/core/files/uploadhandler.py
                        (no specific location)

        Edit Location Set #2:
                File: django/core/files/storage.py
                        function: FileSystemStorage._save
                        line: 260
                File: django/conf/global_settings.py
                        line: 307
                File: django/core/files/uploadhandler.py
                        (no specific location)

        Edit Location Set #3:
                File: django/conf/global_settings.py
                        line: 307
                File: django/core/files/storage.py
                        line: 260
                File: django/core/files/uploadhandler.py
                        (no specific location)

        Edit Location Set #4:
                File: django/core/files/storage.py
                        function: FileSystemStorage._save
                        line: 260
                File: django/conf/global_settings.py
                        line: 307
                File: django/core/files/uploadhandler.py
                        (no specific location)

================================================================================

Instance ID: astropy__astropy-14182

Found Files:
        astropy/io/ascii/rst.py
        astropy/io/ascii/ui.py
        astropy/io/ascii/core.py
        astropy/io/ascii/connect.py
        astropy/table/connect.py
        astropy/table/row.py
        astropy/table/table.py

Found Related Locs:

        File Path: astropy/io/ascii/rst.py
        Related Locs:
                class: RST
                class: SimpleRSTHeader
                class: SimpleRSTData

        File Path: astropy/io/ascii/ui.py
        Related Locs:
                function: get_writer
                function: write

        File Path: astropy/io/ascii/core.py
        Related Locs:
                function: _get_writer

Found Edit Locs:

        Edit Location Set #1:
                File: astropy/io/ascii/rst.py
                        class: RST
                        line: 60
                File: astropy/io/ascii/ui.py
                        function: get_writer
                        line: 864
                        function: write
                        line: 974
                File: astropy/io/ascii/core.py
                        function: _get_writer
                        line: 1814

        Edit Location Set #2:
                File: astropy/io/ascii/rst.py
                        class: RST
                        line: 60
                File: astropy/io/ascii/ui.py
                        function: get_writer
                        line: 864
                File: astropy/io/ascii/core.py
                        function: _get_writer
                        line: 1814

        Edit Location Set #3:
                File: astropy/io/ascii/core.py
                        line: 1814
                File: astropy/io/ascii/rst.py
                        class: RST
                        function: __init__
                        line: 60
                File: astropy/io/ascii/ui.py
                        (no specific location)

        Edit Location Set #4:
                File: astropy/io/ascii/rst.py
                        class: RST
                        line: 60
                File: astropy/io/ascii/core.py
                        function: _get_writer
                        line: 1814
                File: astropy/io/ascii/ui.py
                        function: get_writer
                        line: 901
b
I would love to know what other's think about this, but personally I feel it is better to start with ground truth patches simply because it is easier to setup and doesn't have the overhead of us having to run agentless localization (using some proprietary model) on the entire training dataset (for eg: from SWE-Gym). Also if you were to use Agentless' outputs during training, how do you differentiate between additional context being irrelevant/useless or being a broader relevant version that's useful to fix the bug?
s
Yes, I think just the gold patch locations is a good starting point. Then, as was suggested in the meeting, the next improvement would be to include the paths in the trajectories of successful runs.
l
Yeah, agree with the above! To clarify, the reason why I suggested Agentless is because they have evaluation code for localization, so we could use the evaluation code to evaluate and calculate rewards for our own model’s outputs. Some next things to try out: 1. Run the agentless evaluation code to evaluate some trajectories here: https://github.com/SWE-bench/experiments/tree/main/evaluation/verified 2. Try running OpenHands on SWE-bench and then evaluate the localization quality of the resulting patches: https://github.com/All-Hands-AI/benchmarks
👍 3
q
Cool will look into this next 👍
Thank you for the clarification!
p
https://github.com/OpenAutoCoder/Agentless • 🙀 Localization: Agentless employs a hierarchical process to first localize the fault to specific files, then to relevant classes or functions, and finally to fine-grained edit locations Am I the only one who sees a risk of pigeonholing ourselves into a "what are the files/functions/lines *for this bug*" situation instead of, "what context do we need to build this new feature?" Is there a benchmark for the latter?
l
I agree that we don’t want to forget the big picture, but as I mentioned at the meeting, it’s usually a good idea to get something working first and then expand on it later
👍 1
q
I only found 1 function to check the localization output
check_contains_valid_loc
which returns a Boolean. It checks if at least one location predicted by the model like file path, lines of text, class name, and function name exists in the repo. They use python's AST package to precompute the classes, methods and functions for the target repos in SWE-Bench and check for existence. Is this what we're looking for @limited-student-10747? Here's the link to the function A thing to note is they filter out non python files and test files
Example values for the function args
Copy code
file_to_locs = {
    "django/db/models.py": [
        "class: Model\nfunction: Model.save\nline: 100"
    ]
}

structure = {
    "path/to/file.py": {
        "classes": [...],      # list of class info dicts
        "functions": [...],    # list of function info dicts
        "text": [...]          # list of lines of code
    }
}
c
nod agree on using GT patches since it would allow us to scale to way more datasets that only have gt patches available (eg swe-gym, swe-fixer, etc) What would be the expected output for the model we want to train?
maybe smth like: 1. localization model output:
list of (file name, line number/range)
2. groundtruth (GT) label: golden patch -> parsed to
list of (file name, line number/range)
3. metric: we compare the model output & gt label w/ F-measure?
q
yup and to get the output we would use tool calls
Once we observe improvements on this one reward function we can add more like proximity to the GT locations using the repo structure and AST
That's my proposal
Initially we can just have sequential tool calls with a limit then we can move towards parallel tool calls
What does everyone think about this?
c
to get the output we would use tool calls
would swe-grep actually outputs "text", or just a list of code snippet though 🤔
Yep i guess it is just "files" and "line ranges"
get the output we would use tool calls
maybe a "FinishTool" that accepts a
list of (file name, line number/range)
would suffice here
q
I need to confirm but my suspicion based on their blog and using their playground is that it is given a task from a main agent and performs parallel tool calls iteratively until it’s confident it has the locations or reaches max limit
nod 1
The finish tool idea is definitely interesting
c
yeah, so i'd envision it will work like this: 1. problem statement as input 2. model perform up to 4 turns of tool calling with read/grep/glob, each turn w/ parallel fn call (up to 8) 3. sends a finish action with
list of (file name, line number/range)
-> we take this for eval
q
Yup
And initially we check whether the outputs exists in the ground truth patch from SWE bench
We can add more partial rewards too
c