تنظيم صفحاتك في مجموعات يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
تركّز هذه الوحدة على البحث شبه العشوائي.
ما هي أهمية استخدام البحث شبه العشوائي؟
يُفضّل استخدام البحث شبه العشوائي (استنادًا إلى تسلسلات ذات اختلاف منخفض) بدلاً من أدوات التحسين الأكثر تعقيدًا في العلبة السوداء عند استخدامه كجزء من عملية تحسين متكرّرة تهدف إلى زيادة الإحصاءات إلى أقصى حدّ في ما يتعلّق بمشكلة التحسين (ما يُشار إليه باسم "مرحلة الاستكشاف"). إنّ التحسين باستخدام نظرية بايزي والأدوات المشابهة هي أكثر ملاءمةً لمرحلة الاستغلال. يمكن اعتبار البحث شبه العشوائي المستنِد إلى تسلسلات ذات اختلاف منخفض تم نقلها عشوائيًا "بحثًا متقطّعًا للشبكة بترتيب عشوائي"، لأنّه يستكشف بشكل موحّد، ولكنه عشوائي، مساحة بحث معيّنة وينشر نقاط البحث أكثر من البحث العشوائي.
تشمل مزايا البحث شبه العشوائي مقارنةً بأدوات تحسين الأداء الأكثر تعقيدًا في علب سوداء (مثل التحسين باستخدام نظرية بايزي والخوارزميات التطورية) ما يلي:
إنّ أخذ عيّنات من مساحة البحث بشكل غير تكيُّفي يجعل من الممكن تغيير هدف الضبط في التحليل البعدي بدون إعادة إجراء التجارب. على سبيل المثال، نريد عادةً العثور على أفضل تجربة من حيث خطأ التحقّق الذي تم تحقيقه في أيّ مرحلة من مراحل التدريب. ومع ذلك، فإنّ طبيعة البحث شبه العشوائي غير التكيُّفية تجعل من الممكن العثور على أفضل تجربة استنادًا إلى خطأ التحقّق النهائي أو خطأ التدريب أو أي مقياس تقييمبديل بدون إعادة تشغيل أي تجارب.
يتصرّف البحث شبه العشوائي بطريقة متّسقة وقابلة للتكرار إحصائيًا. من المفترض أن يكون من الممكن إعادة إنتاج دراسة من ستة أشهر حتى إذا تغيّر تنفيذ خوارزمية البحث، ما دام يحافظ على خصائص التوحيد نفسها. في حال استخدام برامج تحسين متقدمة مستندة إلى نظرية بايزي، قد يتغيّر التنفيذ بطريقة مهمة بين الإصدارات، ما يجعل من الصعب جدًا إعادة إجراء عملية بحث قديمة. لا يمكن دائمًا الرجوع إلى عملية تنفيذ قديمة (على سبيل المثال، إذا كانت أداة التحسين تعمل كخدمة).
إنّ استكشافه الموحّد لمساحة البحث يسهّل عملية التفكير في النتائج وما قد تشير إليه عن مساحة البحث. على سبيل المثال، إذا كانت أفضل نقطة في مسار البحث شبه العشوائي تقع على حدود مساحة البحث، فهذا إشارة جيدة (ولكن ليست أكيدة) تشير إلى أنّه يجب تغيير حدود مساحة البحث. ومع ذلك، قد تكون خوارزمية التحسين التكيُّفية للصندوق الأسود قد تجاهلت وسط مساحة البحث بسبب بعض التجارب المبكرة غير المحظوظة، حتى لو كانت تحتوي على نقاط جيدة بالقدر نفسه، لأنّه هو هذا النوع تحديدًا من عدم التناسق الذي تحتاج خوارزمية التحسين الجيدة إلى استخدامه لتسريع عملية البحث.
إنّ إجراء أعداد مختلفة من التجارب بشكل موازٍ بدلاً من إجراءها بشكل تسلسلي لا يؤدي إلى نتائج مختلفة إحصائيًا عند استخدام البحث شبه العشوائي (أو خوارزميات البحث غير التكيُّفية الأخرى)، على عكس الخوارزميات التكيُّفية.
قد لا تتعامل خوارزميات البحث الأكثر تعقيدًا دائمًا مع نقاط التحسين غير القابلة للتنفيذ بشكل صحيح، خاصةً إذا لم يتم تصميمها مع وضع تعديل المَعلمات الفائقة لشبكة عصبية في الاعتبار.
إنّ البحث شبه العشوائي بسيط ويعمل بشكلٍ جيد بشكلٍ خاص عند تنفيذ العديد من تجارب الضبط بالتوازي. وفقًا لإحدى القصص1، من الصعب جدًا أن تتفوّق الخوارزمية التكيُّفية على أسلوب البحث شبه العشوائي الذي يمتلك ميزانية تبلغ ضعف ميزانيتها، خاصةً عندما يكون من الضروري تنفيذ العديد من التجارب بالتوازي (وبالتالي، تكون هناك فرص قليلة جدًا لاستخدام نتائج التجارب السابقة عند إطلاق تجارب جديدة). بدون خبرة في التحسين باستخدام نظرية بايزي وطرق التحسين المتقدّمة الأخرى للصندوق الأسود، قد لا تحقّق المزايا التي يمكن أن تقدّمها، بوجهٍ عام. من الصعب تقييم أداء خوارزميات التحسين المتقدّمة التي تعمل في علب سوداء في شروط ضبط تعلُّم الآلة الواقعية. وهي مجال نشط جدًا من الأبحاث الحالية، وتشكل الالتقاطات المعقدة بعض المخاطر التي تواجه المستخدمين غير المتمرّسين. يمكن للخبراء في هذه الطرق الحصول على نتائج جيدة، ولكن في حالات التوازي العالي، تميل مساحة البحث والميزانية إلى أن تكون أكثر أهمية.
ومع ذلك، إذا كانت موارد الحوسبة تتيح فقط إجراء عدد صغير من التجارب بالتوازي وكان بإمكانك إجراء العديد من التجارب بالتسلسل، يصبح التحسين الباييزي أكثر جاذبية على الرغم من أنّه يجعل من الصعب تفسير نتائج الضبط.
إذا لم تكن خوارزمية البحث شبه العشوائي المستندة إلى تسلسل منخفض التباين متوفرة، يمكن استبدال البحث الموحّد شبه العشوائي بدلاً من ذلك، على الرغم من أنّ هذا من المرجّح أن يكون أقل فعالية قليلاً. في حالة استخدام سمة واحدة أو سمتَين، يُعدّ البحث في الشبكة مقبولًا أيضًا، ولكن ليس في السمات الأعلى. (راجِع Bergstra & Bengio, 2012).
كم عدد التجارب المطلوبة للحصول على نتائج جيدة باستخدام البحث شبه العشوائي؟
لا تتوفّر طريقة لتحديد عدد التجارب اللازمة للحصول على نتائج باستخدام البحث شبه العشوائي بشكل عام، ولكن يمكنك الاطّلاع على أمثلة محدّدة. كما يوضّح الشكل 3، يمكن أن يؤدي عدد التجارب في الدراسة إلى التأثير بشكل كبير في النتائج:
الشكل 3: ResNet-50 تم ضبطه على ImageNet من خلال 100 تجربة. باستخدام ميزة "بدء التشغيل السريع"، تمّت محاكاة مبالغ مختلفة من ميزانية الضبط. يتمّ رسم الرسوم البيانية المربّعة لأفضل الأداء لكلّ ميزانية تجريبية.
يُرجى ملاحظة ما يلي بشأن الشكل 3:
تكون نطاقات الشريحة الربعية أكبر بكثير عند تحليل عيّنات من 6 تجارب مقارنةً بتحليل عيّنات من 20 تجربة.
حتى مع إجراء 20 تجربة، من المرجّح أن يكون الفرق بين دراسات الحظ السعيد والحظ السيئ أكبر من التباين المعتاد بين عمليات إعادة التدريب لهذا النموذج على بذور عشوائية مختلفة، باستخدام مَعلمات متغيرة ثابتة، التي قد تبلغ هذه المعالجة حوالي 0.1% +/- عند معدل خطأ التحقق من الصحة الذي يبلغ حوالي 23%.
أشار كلّ من "بن ريتش" و"كيفن جاميسون" إلى مدى فعالية البحث العشوائي الذي يستخدم ميزانية مضاعفة كخط أساس (يقدّم مقال Hyperband حججًا مشابهة)، ولكن من الممكن بالتأكيد العثور على مساحات بحث ومشاكل تتفوق فيها تقنيات التحسين الباييزي الحديث على البحث العشوائي الذي يستخدم ميزانية مضاعفة. ومع ذلك، في تجربتنا، يصبح من الصعب جدًا التفوق على البحث العشوائي بميزانية مضاعفة في وضع التوازُن العالي، لأنّ تحسين "البيزيانية" لا يملك فرصة لمراقبة نتائج التجارب السابقة. ↩
تاريخ التعديل الأخير: 2025-07-27 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","easyToUnderstand","thumb-up"],["ساعَدني المحتوى في حلّ مشكلتي.","solvedMyProblem","thumb-up"],["غير ذلك","otherUp","thumb-up"]],[["لا يحتوي على المعلومات التي أحتاج إليها.","missingTheInformationINeed","thumb-down"],["الخطوات معقدة للغاية / كثيرة جدًا.","tooComplicatedTooManySteps","thumb-down"],["المحتوى قديم.","outOfDate","thumb-down"],["ثمة مشكلة في الترجمة.","translationIssue","thumb-down"],["مشكلة في العيّنات / التعليمات البرمجية","samplesCodeIssue","thumb-down"],["غير ذلك","otherDown","thumb-down"]],["تاريخ التعديل الأخير: 2025-07-27 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eQuasi-random search, akin to "jittered, shuffled grid search," offers consistent exploration of hyperparameter search spaces, aiding in insightful analysis and reproducibility.\u003c/p\u003e\n"],["\u003cp\u003eIts non-adaptive nature enables flexible post hoc analysis without rerunning experiments, unlike adaptive methods like Bayesian optimization.\u003c/p\u003e\n"],["\u003cp\u003eWhile Bayesian optimization excels with sequential trials, quasi-random search shines in high-parallelism scenarios, often outperforming adaptive methods with double its budget.\u003c/p\u003e\n"],["\u003cp\u003eQuasi-random search facilitates easier interpretation of results and identification of potential search space boundary issues.\u003c/p\u003e\n"],["\u003cp\u003eAlthough the required number of trials varies depending on the problem, studies show significant impact on results, highlighting the importance of adequate budget allocation.\u003c/p\u003e\n"]]],[],null,["# Quasi-random search\n\nThis unit focuses on quasi-random search.\n\nWhy use quasi-random search?\n----------------------------\n\nQuasi-random search (based on low-discrepancy sequences) is our preference\nover fancier blackbox optimization tools when used as part of an iterative\ntuning process intended to maximize insight into the tuning problem (what\nwe refer to as the \"exploration phase\"). Bayesian optimization and similar\ntools are more appropriate for the exploitation phase.\nQuasi-random search based on randomly shifted low-discrepancy sequences can\nbe thought of as \"jittered, shuffled grid search\", since it uniformly, but\nrandomly, explores a given search space and spreads out the search points\nmore than random search.\n\nThe advantages of quasi-random search over more sophisticated blackbox\noptimization tools (e.g. Bayesian optimization, evolutionary algorithms)\ninclude:\n\n- Sampling the search space non-adaptively makes it possible to change the tuning objective in post hoc analysis without rerunning experiments. For example, we usually want to find the best trial in terms of validation error achieved at any point in training. However, the non-adaptive nature of quasi-random search makes it possible to find the best trial based on final validation error, training error, or some alternative evaluation metric without rerunning any experiments.\n- Quasi-random search behaves in a consistent and statistically reproducible way. It should be possible to reproduce a study from six months ago even if the implementation of the search algorithm changes, as long as it maintains the same uniformity properties. If using sophisticated Bayesian optimization software, the implementation might change in an important way between versions, making it much harder to reproduce an old search. It isn't always possible to roll back to an old implementation (e.g. if the optimization tool is run as a service).\n- Its uniform exploration of the search space makes it easier to reason about the results and what they might suggest about the search space. For example, if the best point in the traversal of quasi-random search is at the boundary of the search space, this is a good (but not foolproof) signal that the search space bounds should be changed. However, an adaptive blackbox optimization algorithm might have neglected the middle of the search space because of some unlucky early trials even if it happens to contain equally good points, since it is this exact sort of non-uniformity that a good optimization algorithm needs to employ to speed up the search.\n- Running different numbers of trials in parallel versus sequentially does not produce statistically different results when using quasi-random search (or other non-adaptive search algorithms), unlike with adaptive algorithms.\n- More sophisticated search algorithms may not always handle infeasible points correctly, especially if they aren't designed with neural network hyperparameter tuning in mind.\n- Quasi-random search is simple and works especially well when many tuning trials are running in parallel. Anecdotally^[1](#fn1)^, it is very hard for an adaptive algorithm to beat a quasi-random search that has 2X its budget, especially when many trials need to be run in parallel (and thus there are very few chances to make use of previous trial results when launching new trials). Without expertise in Bayesian optimization and other advanced blackbox optimization methods, you might not achieve the benefits they are, in principle, capable of providing. It is hard to benchmark advanced blackbox optimization algorithms in realistic deep learning tuning conditions. They are a very active area of current research, and the more sophisticated algorithms come with their own pitfalls for inexperienced users. Experts in these methods are able to get good results, but in high-parallelism conditions the search space and budget tend to matter a lot more.\n\nThat said, if your computational resources only allow a small number of\ntrials to run in parallel and you can afford to run many trials in sequence,\nBayesian optimization becomes much more attractive despite making your\ntuning results harder to interpret.\n\nWhere can I find an implementation of quasi-random search?\n----------------------------------------------------------\n\n[Open-Source Vizier](https://github.com/google/vizier) has\n[an implementation of quasi-random\nsearch](https://github.com/google/vizier/blob/main/vizier/_src/algorithms/designers/quasi_random.py).\nSet `algorithm=\"QUASI_RANDOM_SEARCH\"` in [this Vizier usage\nexample](https://oss-vizier.readthedocs.io/en/latest/guides/user/running_vizier.html).\nAn alternative implementation exists [in this hyperparameter sweeps\nexample](https://github.com/mlcommons/algorithmic-efficiency/blob/main/algorithmic_efficiency/halton.py).\nBoth of these implementations generate a Halton sequence for a given search\nspace (intended to implement a shifted, scrambled Halton sequence as\nrecommended in\n[Critical Hyper-Parameters: No Random, No\nCry](https://arxiv.org/abs/1706.03200).\n\nIf a quasi-random search algorithm based on a low-discrepancy sequence is not\navailable, it is possible to substitute pseudo random uniform search instead,\nalthough this is likely to be slightly less efficient. In 1-2 dimensions,\ngrid search is also acceptable, although not in higher dimensions. (See\n[Bergstra \\& Bengio, 2012](https://www.jmlr.org/papers/v13/bergstra12a.html)).\n\nHow many trials are needed to get good results with quasi-random search?\n------------------------------------------------------------------------\n\nThere is no way to determine how many trials are needed to get\nresults with quasi-random search in general, but you can look at\nspecific examples. As Figure 3 shows, the number of trials in a study can\nhave a substantial impact on the results:\n\n**Figure 3:** ResNet-50 tuned on ImageNet with 100 trials.\nUsing bootstrapping, different amounts of tuning budget were simulated.\nBox plots of the best performances for each trial budget are plotted.\n\n\u003cbr /\u003e\n\nNotice the following about Figure 3:\n\n- The interquartile ranges when 6 trials were sampled are much larger than when 20 trials were sampled.\n- Even with 20 trials, the difference between especially lucky and unlucky studies are likely larger than the typical variation between retrains of this model on different random seeds, with fixed hyperparameters, which for this workload might be around +/- 0.1% on a validation error rate of \\~23%.\n\n*** ** * ** ***\n\n1. Ben Recht and Kevin Jamieson\n [pointed out](http://www.argmin.net/2016/06/20/hypertuning/) how strong\n 2X-budget random search is as a baseline (the\n [Hyperband paper](https://jmlr.org/papers/volume18/16-558/16-558.pdf)\n makes similar arguments), but it is certainly possible to find search\n spaces and problems where state-of-the-art Bayesian optimization\n techniques crush random search that has 2X the budget. However, in our\n experience beating 2X-budget random search gets much harder in the\n high-parallelism regime since Bayesian optimization has no opportunity to\n observe the results of previous trials. [↩](#fnref1)"]]