tianyang/spider2-aifunc huggingface dataset:
Database: PATENTS
Task: Which assignees (excluding DENSO CORP) have cited patents assigned to DENSO CORP, and what technology domains are their citations in? For each citing assignee and CPC subclass title combination, classify the CPC subclass title into exactly one of ['Automotive & Vehicles', 'Electronics & Circuits', 'Heating & Energy Systems', 'Manufacturing & Assembly', 'Other'] based on the technical description. Return only the top 10 results ranked by semantic similarity of the CPC subclass title to 'automotive and vehicle technology systems' (similarity scores rounded to 2 decimal places, with ties broken first by CPC subclass title alphabetically, then by citing assignee alphabetically, then by citation count descending), showing the citing assignee name (in uppercase), the classified technology domain, and the citation count. Consider only citations where both the cited DENSO patent and the citing patent have valid filing dates (filing_date > 0), use the CPC code marked with the "first" boolean flag set to true for each citing patent (taking the first by index if multiple exist), and match DENSO CORP exactly by name.
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: GITHUB_REPOS_DATE
Task: Which repository had the highest combined total of new forks, newly opened issues, and new watches in April 2022, among repositories whose license is an OSI-approved open source license, and what type of license does it have? To determine if a license is OSI-approved, evaluate whether the condition 'The following software license identifier represents an OSI-approved open source license: ' concatenated with the license identifier is true. Classify each approved license into exactly one of ['Permissive', 'Copyleft', 'Public Domain', 'Other'] based on the license identifier. Count forks as all ForkEvents, issues as IssuesEvents where the payload action is 'opened', and watches as WatchEvents where the payload action is 'started'. If there is a tie in combined total, rank by repository name alphabetically.
Required AI functions: AI_CLASSIFY, AI_FILTER
Database: GITHUB_REPOS
Task: From GitHub repository files with non-empty content, identify the 10 most frequently occurring programming languages based on file extensions. Filter to include only languages where the condition 'This is a programming language used for writing executable software code, not a markup language, stylesheet, or data serialization format: ' concatenated with the language name evaluates to true. Order by file count descending, with language name alphabetically as a tie-breaker.
Required AI functions: AI_FILTER
Database: GITHUB_REPOS
Task: What are the top 10 programming languages by file count from GitHub repository files with non-empty content (where content is not null and not an empty string), identified by file extension mapping (case-sensitive)? For each language, show the file count and a summary of typical file purposes, aggregated using the instruction 'Based on these file paths, identify the single primary purpose. Return exactly 3 words as: [verb]-ing [domain] [artifact]'. Languages are identified by extension: .py=Python, .js/.cjs=JavaScript, .java=Java, .c/.h=C, .cpp/.hpp/.c++/.h++=C++, .rb=Ruby, .go=Go, .rs=Rust, .php=PHP, .ts=TypeScript, .html/.htm=HTML, .css=CSS, .json=JSON, .xml=XML, .yml/.yaml=YAML, .sql=SQL, .sh/.bash=Shell, .cs=C#, .swift=Swift, .kt/.kts/.ktm=Kotlin, .scala=Scala, .m/.matlab=MATLAB, .r=R, .md/.markdown/.mdown=Markdown, .lua=Lua, .vue=Vue, .scss=SCSS, .sass=Sass, .ex/.exs=Elixir, .erl=Erlang, .hs=Haskell, .clj=Clojure, .lisp=Common Lisp, .d=D, .dart=Dart, .jl=Julia, .groovy=Groovy, .hx=Haxe, .asm/.nasm=Assembly, Dockerfile/.dockerfile=Dockerfile, .ps1/.psd1/.psm1=PowerShell. Files not matching these extensions are excluded. Order by file count descending, then by language name alphabetically for ties. Join sample_files and sample_contents on the id column.
Required AI functions: AI_AGG
Database: LONDON
Task: What are the annual percentage shares (rounded to two decimal places) of the top 5 minor crime categories that are most semantically similar to 'theft and property-related offenses', considering only categories where the condition 'This crime category involves theft, burglary, or property damage: ' concatenated with the category name evaluates to true? Show the year, minor category, and its percentage share of London's total crimes for that year, ordered by year and then alphabetically by category name.
Required AI functions: AI_FILTER, AI_SIMILARITY
Database: OPEN_IMAGES
Task: From the Open Images dataset, take the first 75 images (ordered by image_id ascending) that have titles longer than 5 characters, and classify each image's title into exactly one of ['Cat', 'Dog', 'Bird', 'Other Animal', 'Non-Animal']. For each classification category (excluding any NULL classifications), provide the count of distinct image URLs and aggregate the titles using the instruction 'List the 3 most common themes in these image titles, formatted as: Theme1; Theme2; Theme3'. Order results by count descending, then by category name alphabetically for any ties.
Required AI functions: AI_AGG, AI_CLASSIFY
Database: GITHUB_REPOS
Task: Analyze Python source files from the GitHub repos data to find modules most relevant to data processing. For Python files (ending in '.py'), extract the base module name (the first part before any dot) from lines matching 'import X' or 'from X import ...' patterns. Count occurrences of each unique module, then return the top 5 modules ranked by semantic similarity to 'data processing, analysis, and scientific computing' in descending order, with ties broken by occurrence count descending, then alphabetically by module name. Return three columns: language (which will be 'Python'), module_name, and occurrence_count.
Required AI functions: AI_SIMILARITY
Database: CMS_DATA
Task: Among healthcare providers in 2014 that are classified as 'Hospital' from the categories ['Hospital', 'Medical Center', 'Clinic', 'Surgical Center', 'Other'] based on their provider name, which one has the highest combined average cost for both outpatient and inpatient services? The combined average cost is calculated as the sum of the simple average of inpatient average_total_payments and the simple average of outpatient average_total_payments. Only include providers that have records in both the INPATIENT_CHARGES_2014 and OUTPATIENT_CHARGES_2014 tables. To optimize performance, first identify the top 200 providers by combined cost, then classify those to find Hospitals. In case of ties in combined cost, rank by semantic similarity to 'comprehensive medical and surgical hospital' in descending order.
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: CMS_DATA
Task: Which healthcare provider has the highest sum of average inpatient cost and average outpatient cost in 2014, considering only providers that offer both service types and using simple averages of total payments (not weighted by service volume)? The combined cost should be calculated as: (average inpatient payment) + (average outpatient payment). For this top provider, also:
1. Identify their primary medical specialty by aggregating the DRG definitions using the instruction: 'Based on these DRG (diagnosis-related group) definitions, identify the primary medical specialty of this healthcare facility. Return the specialty as a single term like: Orthopedics, Cardiology, Oncology, etc.'
2. Extract the facility type from the provider name using the extraction question: 'What type of healthcare facility is this based on the name? Return one of: Hospital, Medical Center, Surgery Center, Clinic, or Other'

Return the provider name, state, combined cost (the sum of the two averages), primary specialty, and facility type.
Required AI functions: AI_AGG, AI_EXTRACT
Database: NOAA_DATA_PLUS
Task: What are the top 5 zip codes in the United States located in counties that have experienced the most hail storm events over the past 3 years (2022-2024), using historic storms data (excluding the hail reports table)? For each zip code, extract the primary place name from the city field using the extraction question 'What is the first or most prominent place name mentioned in this list?' and classify the area into exactly one of ['Urban/Metropolitan', 'Suburban', 'Rural/Small Town', 'Mixed'] based on the city field content. Match events to zip codes by joining on county name (where county zone type is 'C') and state code. Return the zip code, extracted primary place name, area classification, and hail event count. Order by event count descending, then by area classification alphabetically, then by zip code ascending to break ties.
Required AI functions: AI_CLASSIFY, AI_EXTRACT
Database: PATENTSVIEW
Task: Among U.S. patents in CPC category 'inventional' with group_id in ('G06F', 'H01L', 'H04L'), find patents that have both backward citations within 1 year before the application date and forward citations within 1 year after the application date. A backward citation is "within 1 year before" if the cited patent's application date falls within the 1-year period before the citing patent's application date. A forward citation is "within N years after" if the citing patent's application date falls within N years after the cited patent's application date. From these, classify each patent's technology domain into exactly one of ['Medical Devices', 'Computing Hardware', 'Telecommunications', 'Power Systems', 'Other'] based on the patent title, and keep only patents classified as 'Medical Devices' or 'Power Systems'. Among the remaining patents, identify the one with the most distinct backward citations (within 1 year before application). If there is a tie in backward citation count, use semantic similarity to 'battery circuits and power management systems' as a tiebreaker (higher similarity ranks first). Return the patent_id, patent_number, title, application date, backward citation count (distinct citations within 1 year before), forward citation count (within 1 year after), forward citation count (within 3 years after), and the technology domain classification. Limit to 1 result.
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: PATENTS_GOOGLE
Task: From the publications dataset, first identify the top six families with the most publications whose family_id is not '-1', with ties broken by family_id ascending. Then, using the abs_and_emb table (joined on publication_number), retrieve each of those families' IDs alongside every non-empty abstract associated with their publications. Classify each abstract into exactly one of ['Medical/Pharmaceutical', 'Mechanical/Engineering', 'Chemical/Materials', 'Electronics/Computing', 'Other'] based on the abstract content, and filter to only those classified as 'Medical/Pharmaceutical'. From the filtered results, return the top 15 abstracts ranked by semantic similarity to 'drug delivery systems and therapeutic compounds', with ties broken by family_id ascending then abstract text ascending. Show the family_id and abstract.
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: GITHUB_REPOS
Task: Among the first 100 readme.md files (ordered by file ID) in repositories that do not use any programming language whose name (case-insensitively) includes 'python', what proportion contain a copyright notice? Identify files with copyright notices by evaluating whether the condition 'This readme file contains a copyright notice or copyright statement: ' concatenated with the file content is true.
Required AI functions: AI_FILTER
Database: GITHUB_REPOS
Task: From the first 30 GitHub repository files with content where the binary field is either null or false (ordered by id ascending), keep only those where the condition 'This content is programming source code or technical configuration: ' concatenated with the first 300 characters evaluates to true. Classify each remaining file into exactly one of ['Source Code', 'Configuration', 'Documentation', 'Script', 'Other'] based on the first 500 characters of content. Then, for each line within these files, categorize the line as 'trailing' if it ends with a space or tab character (after removing carriage returns), as 'Space' if it starts with a space character (after removing carriage returns), or as 'Other' if neither condition applies. Report the total weighted occurrences (using the copies field, defaulting to 1 if null) for each combination of file category and line type, ordered alphabetically by file category, then by total occurrences descending within each category, then alphabetically by line type as a tie-breaker.
Required AI functions: AI_CLASSIFY, AI_FILTER
Database: GITHUB_REPOS
Task: For each line type category in GitHub repository files—where 'trailing' means lines ending with a space or tab character, 'Space' means lines starting with a space character, and 'Other' means lines meeting neither condition—report the total weighted occurrence count (weighted by file copies). For the 'Space' and 'Other' categories, sample up to 50 representative lines (between 20 and 200 characters, ordered by length descending then alphabetically by line text for deterministic selection) and aggregate them using the instruction: 'Identify the 3 most common types of programming constructs or patterns found in these code lines. Format as: [Pattern1]; [Pattern2]; [Pattern3]'. For the 'trailing' category, which consists of whitespace-only lines, report 'Whitespace-only lines (tabs/spaces)' as the pattern description. Include files where the binary flag is FALSE or NULL, and exclude files with NULL content. Order results alphabetically by category.
Required AI functions: AI_AGG
Database: GEO_OPENSTREETMAP_WORLDPOP
Task: Based on the most recent 1km population grid data in Singapore before January 2023, use ST_ENVELOPE to aggregate all population grid centroids into a bounding region, then identify hospitals from OpenStreetMap's planet layer (layer_code in (2110, 2120)) that fall within this region using ST_INTERSECTS. Filter to only facilities where the condition 'This is a hospital or medical facility that provides inpatient care: ' concatenated with the layer_name evaluates to true. Considering only grid cells with population greater than zero, calculate the distance from each grid cell centroid to its nearest such facility. What is the population of the single populated grid cell that is farthest from any of these filtered facilities?
Required AI functions: AI_FILTER
Database: PYPI
Task: Among the top 150 most downloaded PyPI packages with GitHub repositories, which 3 packages have summaries with semantic similarity greater than 0.35 to 'data processing and numerical computation library', are classified as 'Data & Scientific' from the categories ['Data & Scientific', 'Development & Build', 'Other'] based on their package summary, and have the highest download counts? For packages with multiple versions, use only the most recent version based on upload time. Extract GitHub URLs from project metadata (checking both home_page and project_urls), clean them by removing unnecessary paths like '/issues', '/pull', '/blob', and '/tree' to keep only the main repository URL. Return only the cleaned GitHub repository URLs (without quotation marks).
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: GITHUB_REPOS
Task: Among the top 50 non-binary Swift files (identified by file ID from the SAMPLE_FILES table joined with SAMPLE_CONTENTS on ID) most semantically similar to 'iOS menu navigation component for mobile apps', which repository contains the file with the highest copy count? If there is a tie in copy count, select the repository that comes first alphabetically. Return only the repository name.
Required AI functions: AI_SIMILARITY
Database: GITHUB_REPOS
Task: Which repository contains the most copied non-binary Swift file among those classified as 'Library' or 'Language/Compiler' projects? Join SAMPLE_FILES and SAMPLE_CONTENTS tables on file ID, and use repo_name from SAMPLE_FILES. Classify each repository by extracting project_type from its name using the question 'What type of project is this based on the repository name? Choose exactly one: Language/Compiler, Application, Library, Other', then filter to repositories where project_type is 'Library' or 'Language/Compiler'.
Required AI functions: AI_EXTRACT
Database: CRYPTO
Task: Among the top 20 Ethereum addresses by successful transaction count (receipt_status = 1) initiated before September 1, 2021 UTC, find those that satisfy the condition 'This address represents a major institutional-scale Ethereum operation based on very high transaction volume and mining reward activity: {activity_description}' where activity_description is 'Address initiated {tx_count} successful transactions and {receives mining rewards/does not receive mining rewards}', and are classified as either 'Extremely High Activity' or 'High Activity' from ['Extremely High Activity', 'High Activity', 'Moderate Activity', 'Low Activity'] based on 'This Ethereum address initiated {tx_count} transactions before September 2021'.

Select the one with the highest transaction count (ties broken alphabetically by address), and calculate its final Ether balance prior to September 1, 2021 UTC including: incoming transfers from successful traces (status = 1, trace_type in 'call'/'create'/'suicide'/'genesis', excluding call_type 'delegatecall'/'callcode'/'staticcall'), minus outgoing transfers (same criteria but trace_type in 'call'/'create'/'suicide'), plus miner rewards (trace_type = 'reward'), minus gas fees paid (receipt_gas_used × receipt_effective_gas_price for successful transactions initiated), plus gas fees received as block miner.

Return the address (lowercase), activity level classification, and final balance in Ether (Wei ÷ 10^18), rounded to 6 decimal places.
Required AI functions: AI_CLASSIFY, AI_FILTER
Database: THELOOK_ECOMMERCE
Task: Generate a monthly report for each product category where orders have a status of 'Complete' (from the ORDERS table) and were delivered before the year 2022, grouping by the month and year of delivery based on ORDER_ITEMS.delivered_at. Only include categories that satisfy the condition 'The product category represents fashion apparel or accessories that are typically visible when worn, not underwear or intimate apparel: {category}' (where {category} is the category name).

For each included category, classify it into exactly one of ['Fashion & Apparel', 'Accessories & Footwear', 'Intimate & Basics', 'Active & Outerwear'] based on the category name. Then calculate the total revenue (sum of sale_price), the total number of completed orders (count of distinct order_id), and compute the month-over-month percentage growth for both revenue and orders (rounded to 2 decimal places) by comparing each month's totals to the previous month's within the same category. Also show the total cost (from product costs), total profit (revenue minus total cost), and the profit-to-cost ratio (rounded to 4 decimal places) for each month.

Order results by business segment classification, then by category alphabetically, then by year and month chronologically.
Required AI functions: AI_CLASSIFY, AI_FILTER
Database: THELOOK_ECOMMERCE
Task: Using order data through the end of 2022 (including all orders regardless of status), for each cohort defined by the month of their first purchase, calculate the percentage of users who made a purchase in each of the first, second, third, and fourth months since their initial purchase (where "first month" is the month of their initial purchase). Round percentages to 2 decimal places.

Additionally, classify each cohort's retention health into exactly one of ['Strong Retention', 'Moderate Retention', 'Weak Retention', 'Very Weak Retention'] based on a description formatted as 'Month 2: {pct2}%, Month 3: {pct3}%, Month 4: {pct4}%' where the percentages reflect repeat purchase rates in months 2-4.

Also calculate the semantic similarity of each cohort's retention pattern (formatted as 'Retention rates: {pct2}% in month 2, {pct3}% in month 3, {pct4}% in month 4') to the benchmark 'Retention rates: 10% in month 2, 8% in month 3, 6% in month 4'.

Return the cohort month, the four monthly percentages, and the retention classification, ordered first by retention classification alphabetically, then by similarity to the healthy benchmark descending (most similar first, with similarity rounded to 2 decimal places for ordering purposes), then by cohort month chronologically.
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: THELOOK_ECOMMERCE
Task: For each month prior to January 2024, identify the product that achieved the highest total profit (calculated as the sum of sale_price minus the product's cost) across all order items regardless of status. If multiple products tie for highest profit in a month, select the one with the alphabetically first product name, then the lowest product_id. From these monthly top-profit products, show only those classified as 'Outerwear' based on product name using the categories ['Outerwear', 'Activewear', 'Formal Wear', 'Casual Wear', 'Other']. Report the month (as the first day of the month), product_id, product name, total cost rounded to 2 decimal places, total profit rounded to 2 decimal places, and assigned category. Order results by semantic similarity to 'premium winter jacket' rounded to 2 decimal places (most similar first), with ties broken first by product name alphabetically ascending, then by month chronologically ascending, then by product_id ascending.
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: THELOOK_ECOMMERCE
Task: For the 'Sleep & Lounge' category in 2023, create a month-by-month financial report showing the month (as the first day of each month in YYYY-MM-DD format), total sales, total cost sourced from the PRODUCTS table, number of complete orders, total profit, profit-to-cost ratio (rounded to 4 decimal places), and a performance classification. Classify each month's performance into exactly one of ['Strong Performance', 'Moderate Performance', 'Weak Performance'] based on a description formatted as 'Monthly metrics: profit-to-cost ratio of {ratio rounded to 2 decimals}, with {order count} complete orders'. Order results by semantic similarity between this same formatted description and the reference text 'excellent high-performing month with profit-to-cost ratio above 1.1 and more than 60 complete orders' (most similar first), with month date ascending as a tiebreaker. Only include orders where status is 'Complete' and creation date falls within the year 2023. Join orders to order items and then to products to obtain cost and category information.
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: THELOOK_ECOMMERCE
Task: Among users registered between January 1, 2019, and April 30, 2022 (inclusive), first identify the oldest and youngest ages in the dataset. Then, for users at these extreme ages only, classify each user's traffic source into exactly one of ['Organic', 'Paid', 'Social', 'Other'] based on the traffic_source field, and calculate semantic similarity of their country to 'United States or major English-speaking country'. For users who are classified as 'Organic' AND have country similarity above 0.5, calculate the difference between the count of users at the oldest age and the count of users at the youngest age, computed as (oldest age count minus youngest age count).
Required AI functions: AI_CLASSIFY, AI_SIMILARITY