Add FinQA Environment for Financial QA Benchmarking#329
Add FinQA Environment for Financial QA Benchmarking#329bhavishya-pohani wants to merge 5 commits intometa-pytorch:mainfrom
Conversation
…ference script
- Add /tools endpoint to expose tool schemas in OpenAI function calling format
- Auto-generate tool schemas from function docstrings (tool_schema.py)
- Add download_data.sh to fetch data from HuggingFace - Fix reward computation for multi-value answers (multiple \boxed{} values)
- Add comprehensive tests for reward matching
- Remove unused imports, clean up dead code
- Update README with download instructions
|
Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
Greptile OverviewGreptile SummaryAdds FinQA environment for evaluating LLMs on financial question-answering using SEC 10-K filing data. The environment follows OpenEnv architecture patterns correctly with client-server separation, reward computation in the server, and tool-based interaction model. Key Changes:
Architecture Alignment:
Issues Found:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Agent
participant Client as FinQAEnv<br/>(HTTP Client)
participant Server as FastAPI Server
participant Env as FinQAEnvironment
participant Tools as FinQATools
participant Rewards as Reward System
Agent->>Client: from_docker_image("finqa-env:latest")
Client->>Server: Start Docker container
Server-->>Client: base_url
Agent->>Client: reset()
Client->>Server: POST /reset
Server->>Env: reset()
Env->>Env: Load next question from shuffled dataset
Env-->>Server: FinQAObservation(question, company, tools)
Server-->>Client: JSON response
Client-->>Agent: StepResult(observation, reward=None, done=False)
loop Until answer submitted or max_steps
Agent->>Client: step(FinQAAction(tool_name, tool_args))
Client->>Server: POST /step {tool_name, tool_args}
Server->>Env: step(action)
alt Tool is get_descriptions/get_table_info/sql_query
Env->>Tools: execute_tool(tool_name, tool_args)
Tools->>Tools: Load data from JSON files
Tools->>Tools: Execute SQL in-memory (sqlite3)
Tools-->>Env: (result_string, is_final=False)
Env-->>Server: FinQAObservation(tool_result, done=False)
else Tool is submit_answer
Env->>Tools: execute_tool("submit_answer", {answer})
Tools-->>Env: (confirmation, is_final=True)
Env->>Rewards: compute_reward(submitted, ground_truth)
Rewards->>Rewards: Parse numbers (%, fractions, LaTeX)
Rewards->>Rewards: Compare with 1% tolerance + 1.0 abs diff
Rewards-->>Env: 1.0 (correct) or 0.0 (incorrect)
Env-->>Server: FinQAObservation(result, done=True, reward)
end
Server-->>Client: JSON response
Client-->>Agent: StepResult(observation, reward, done)
end
Agent->>Server: GET /tools
Server-->>Agent: OpenAI tool schemas (auto-generated from docstrings)
|
…numbers, add fixes & tests for multiple numbers in labels
|
Nice Env. Have you also deployed it to the HF hub, and updated the environments page |
Summary
Adds FinQA environment for evaluating LLMs on financial question-answering tasks using SEC 10-K filing data.
Features
get_descriptions,get_table_info,sql_query,submit_answerdownload_data.shTest Plan