feat: Implement Adaptive Sampling loop (Algorithm 2) for Online Mode#10
feat: Implement Adaptive Sampling loop (Algorithm 2) for Online Mode#10Mox301 wants to merge 1 commit intofacebookresearch:mainfrom
Conversation
|
Hi @Mox301! 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! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Summary
This PR implements the Adaptive Sampling logic described in Algorithm 2 and Appendix B.1 of the paper.
Previously, the$\beta \ge \tau$ ) before proceeding, ensuring the model stops generation early when a confident consensus is reached.
_deepthink_onlinemethod generated the entire trace budget in a single batch after warmup. This implementation updates the logic to generate traces iteratively, checking for consensus (Changes
deepconf/wrapper.py:_deepthink_onlineto replace bulk generation with awhileloop.consensus_threshold(default0.95) andadaptive_step_size(default1to strictly follow Appendix B.1 logic) to thedeepthinkinterface.Motivation
The paper describes "Online Thinking" as a dynamic process that halts trace generation once consensus is reached to save tokens. The previous implementation lacked this iterative check, generating the full
total_budgetregardless of consensus. This change aligns the codebase with the paper's efficiency claims (e.g., Figure 6).Test Plan
Verified using the existing
examples/example_online.py.