This page defines the data schema for the content industry — including articles, videos, audio, and images. Follow these specifications when uploading historical data and real-time data to Artificial Intelligence Recommendation (AIRec).
Data tables
AIRec requires three data tables for content industry scenes.
| Table | Purpose | Identity rule |
|---|---|---|
| Item table | All recent items available for recommendation. "Item" means content in this context. | item_id + item_type together uniquely identify an item |
| User table | All recently registered users | imei alone, or user_id + imei together, uniquely identify a user |
| Behavior table | Recent user behavior in the current scene | — |
Before uploading:
Items and users each have a quota limit. Deduplicate both tables before upload.
Provide behavior data from the last one to two weeks. If historical behavior data is unavailable (new scene or technical constraints), use the AIRec test data — expect up to two weeks of suboptimal results while the model accumulates real data.
Fill in as many optional fields as possible. The more complete your data, the better the recommendation results.
All fields listed in the tables below must be present in your MaxCompute table, even if optional fields are left blank. See CREATE TABLE statements for the full schema.
Item table
Each row represents one piece of content (article, video, audio, image, and so on).
| Field | Type | Required | Description | Valid values | Notes | Example |
|---|---|---|---|---|---|---|
| item_id | string | Required | Unique item ID | Custom | Letters and digits only; max 50 characters. item_id + item_type together identify an item. Record all item IDs for later reference. | 34513 |
| item_type | string | Required | Content type | image, article, video, shortvideo, item, recipe, audio | Uploaded data must match the declared type — mismatches disable mixed sorting. Contact support for additional types. | article |
| status | string | Required | Recommendation eligibility | 0, 1 | 1 = eligible; 0 = not eligible. Changes take effect immediately. | 1 |
| scene_id | string | Required | Scene ID | Custom | Use letters and digits (acronyms work well). Do not use colons (:). Do not use -102 (reserved — this is an internal value reserved by the system). For a single scene, use 1. Separate multiple scene IDs with commas (,). | a101,b102 |
| duration | string | Required for video; optional otherwise | Video length in seconds | Custom | Must be ≥ 0 and < 36,000. | 1000 |
| pub_time | string | Required | Publication time | UNIX timestamp (seconds) | Used to identify new items and support timeliness-based ranking. | 1520327038 |
| expire_time | string | Recommended | Expiration time | UNIX timestamp (seconds) | If the current server time exceeds this value, the item stops being recommended. If all items expire, the service cannot start. Leave blank for no expiration. If starting via data source import, this field cannot be blank — set it to a far-future timestamp. | 1520327038 |
| last_modify_time | string | Optional | Last modification time | UNIX timestamp (seconds) | Update this field after major content changes to treat the item as new, similar to pub_time. | 1520327038 |
| title | string | Recommended | Item title | Custom | Used for in-depth semantic analysis. Missing titles reduce algorithm coverage. We recommend that you set this field. | The Digital Era Provides the Greatest Opportunity |
| weight | string | Recommended | Item boost weight | 1, 100 | 100 = boosted (more likely to be recommended); 1 = standard. Keep boosted items at ≤ 10% of total items. Other values are invalid. Defaults to 1 if blank. | 1 |
| category_level | string | Recommended | Category depth level | Custom | Must match category_path depth. Mismatch disables discretization. | 3 |
| category_path | string | Recommended | Category hierarchy | Custom | Separate levels with underscores (_). Commas (,) and colons (:) are not allowed. Used in discretization policies. | 12_1024_56 |
| tags | string | Recommended | Content tags | Custom | Separate multiple tags with commas (,). Max 100 tags per item; max 50,000 tags per tag pool. If tags are sensitive business data, convert them to numeric codes before uploading. | digitalization,artificial intelligence,AI |
| author | string | Recommended | Author name(s) | Custom | Separate multiple authors with commas (,). Max 100 authors per item. Enables author-based discretization. | Tom |
| content | string | Optional | Body text or key excerpt | Custom | Max 5,000 characters. Used for semantic analysis. | — |
| channel | string | Recommended | Content channel (e.g., Economy) | Custom | One item belongs to exactly one channel. | — |
| organization | string | Optional | Organizations | Custom | Separate multiple values with commas (,). | — |
| pv_cnt | string | Optional | Exposures in the past month | Custom | Non-real-time data is acceptable. Useful during service startup when scene behavior data is sparse — supplement with data from other scenes. | 100000 |
| click_cnt | string | Optional | Clicks in the past month | Custom | Non-real-time data is acceptable. | 1000 |
| like_cnt | string | Optional | Likes in the past month | Custom | Non-real-time data is acceptable. | 100 |
| unlike_cnt | string | Optional | Dislikes in the past month | Custom | Non-real-time data is acceptable. | 100 |
| comment_cnt | string | Optional | Comments in the past month | Custom | Non-real-time data is acceptable. | 100 |
| collect_cnt | string | Optional | Favorites in the past month | Custom | Non-real-time data is acceptable. | 100 |
| share_cnt | string | Optional | Shares in the past month | Custom | Non-real-time data is acceptable. | 100 |
| download_cnt | string | Optional | Downloads in the past month | Custom | Non-real-time data is acceptable. | 100 |
| tip_cnt | string | Optional | Rewards in the past month | Custom | Non-real-time data is acceptable. | 100 |
| subscribe_cnt | string | Optional | Follows in the past month | Custom | Non-real-time data is acceptable. | 100 |
| source_id | string | Optional | Platform that published the item | Custom | For example, 1 for Taobao, 2 for Tmall. | 1 |
| country | string | Optional | Country code | ISO 3166-1 alpha-3 | — | CHN |
| city | string | Optional | City name | Custom | — | Hangzhou |
| features | string | Optional | String item characteristics | Custom | Separate multiple values with commas (,). Values should be descriptive. | — |
| num_features | string | Optional | Numeric item characteristics | Custom | Separate multiple values with commas (,). All items must have the same number of comma-separated values in this field. | — |
Sample data row (item table):
item_id,item_type,status,scene_id,pub_time,expire_time,title,tags,channel,weight,category_level,category_path
34513,article,1,"a101,b102",1520327038,1620000000,"The Digital Era Provides the Greatest Opportunity","digitalization,AI",economy,1,3,12_1024_56User table
Each row represents one user.
| Field | Type | Required | Description | Valid values | Notes | Example |
|---|---|---|---|---|---|---|
| user_id | string | Required for logged-on users | Unique user ID | Custom | Required for registered users. Uniquely identifies a user. | 1234567 |
| user_id_type | string | Optional | Account type | 1, 2, 3, 4 | 1 = app account; 2 = mobile phone number; 3 = WeChat account; 4 = other. | 2 |
| imei | string | Required for users who have not logged on | Device identifier | MD5 hash value | Android: MD5 hash of International Mobile Equipment Identity (IMEI). iOS: MD5 hash of Identifier for Advertisers (IDFA). Required for anonymous users. If the MAC address or device number is invalid, only the exposure blocking feature is retained. | 74f25e604e1a9dde7471fe2e25ae54d0 |
| third_user_name | string | Optional | Third-party username | Custom | — | jack |
| third_user_type | string | Optional | Third-party platform name | Custom | — | wechat |
| phone_md5 | string | Optional | MD5 hash of mobile number | 32-character string | — | d41d8cd98f00b204e9800998ecf8427e |
| gender | string | Optional | Gender | male, female, unknown | Use digits if gender data is sensitive: 0 = male, 1 = female, 2 = unknown. | male |
| age | string | Optional | Age | Custom | — | 22 |
| age_group | string | Optional | Age group | Custom | — | 20-25 |
| country | string | Optional | Country code | ISO 3166-1 alpha-3 | — | CHN |
| city | string | Optional | City name | Custom | — | Hangzhou |
| ip | string | Optional | Last logon IP address | Custom | — | 202.113.XX.XX |
| device_model | string | Optional | Device model | Custom | — | iphoneX |
| tags | string | Optional | User interest tags | Custom | Separate multiple tags with commas (,). Use tags to describe the user's interests. | football,fitness,outdoor |
| source | string | Optional | User acquisition source | Custom | — | Toutiao |
| content | string | Optional | User description | Custom | — | — |
| register_time | string | Optional | Registration time | UNIX timestamp (seconds) | — | 1520007038 |
| last_login_time | string | Optional | Last logon time | UNIX timestamp (seconds) | — | 1520017038 |
| last_modify_time | string | Optional | Last profile update time | UNIX timestamp (seconds) | — | 1520327038 |
| features | string | Optional | String user characteristics | Custom | Separate values with commas (,). Useful for customer portrait data. | — |
| num_features | string | Optional | Numeric user characteristics | Custom | Separate values with commas (,). All users must have the same number of comma-separated values. | — |
Identifying users:
Logged-on users: use
user_idAnonymous users: use
imeiMixed scenarios: use
user_idfor logged-on users andimeifor anonymous users
Make sure all user records are unique. When requesting recommendation results, specify the correct user identifier — otherwise personalized recommendations cannot be generated.
Behavior table
Each row represents one user interaction with an item.
| Field | Type | Required | Description | Valid values | Notes | Example |
|---|---|---|---|---|---|---|
| item_id | string | Required | Item ID | Custom | Must match item_id in the item table. | 34513 |
| item_type | string | Required | Item type | image, article, video, shortvideo, item, recipe, audio | Must match item_type in the item table. | image |
| bhv_type | string | Required | Behavior type | expose, click (and others — see behavior type table below) | expose and click entries are required. Click count must be less than expose count — a higher ratio signals abnormal data and prevents service startup. | expose |
| trace_id | string | Required | Recommendation engine source | Alibaba, selfhold | Alibaba = item recommended by AIRec; selfhold = item from a self-developed recommendation system. Used for A/B testing reports in the console. | Alibaba |
| trace_info | string | Required | Request tracking information | Custom | If trace_id is selfhold, set to 1. If trace_id is Alibaba, use the trace_info value returned in the recommendation result. | 1 |
| scene_id | string | Required | Scene where the behavior occurred | Custom | Must match one of the scene IDs in the item's scene_id field. Only one scene ID per behavior entry. If the scene cannot be determined, use -102. Default: 1. | a101 |
| bhv_time | string | Optional | Time of the behavior | UNIX timestamp (seconds) | Set to the time when the user performed the action. | 1520327038 |
| bhv_value | string | Required | Behavior detail | Custom | For expose, click, and share: set to 1. For stay: set to time spent in seconds. For other types, contact support. | 500 |
| user_id | string | Required for logged-on users | User ID | Custom | Must match user_id in the user table. Leave blank for anonymous users. | 1234567 |
| platform | string | Optional | Client platform | ios, android, h5 | — | ios |
| imei | string | Required for users who have not logged on | Device identifier | MD5 hash value (32 characters) | Required for anonymous users. | e2fcdb0f4dce45e35fe2823d797333ec |
| app_version | string | Optional | App version | Custom | — | 4.1.10 |
| net_type | string | Optional | Network type | 2G, 3G, 4G, WIFI | — | 4G |
| ip | string | Optional | Client IP address | Custom | — | 234.45.13.14 |
| login | string | Optional | Logon status | 0, 1 | 0 = not logged on; 1 = logged on. | 1 |
| report_src | string | Optional | Report source | 1, 2 | 1 = server; 2 = client. | 2 |
| device_model | string | Optional | Device model | Custom | — | iphoneX |
| longitude | string | Optional | Longitude | Custom | — | 128.4 |
| latitude | string | Optional | Latitude | Custom | — | 78.1 |
| module_id | string | Optional | Module ID | Custom | — | 114 |
| page_id | string | Optional | Page ID | Custom | — | 4 |
| position | string | Optional | Item position on the page | Custom | — | 5 |
| message_id | string | Optional | Unique behavior entry ID | Custom | If blank, the system deduplicates using item_id, item_type, user_id, imei, bhv_type, and bhv_time. | 5 |
Behavior types
| bhv_type | Description | Required |
|---|---|---|
| expose | Item shown to the user (impression) | Required — expose count must exceed click count |
| click | User clicked the item | Required |
| like | User liked the item | Optional |
| unlike | User disliked the item | Optional |
| comment | User commented on the item | Optional |
| collect | User favorited the item | Optional |
| stay | User stayed on the item page | Optional |
| share | User shared the item | Optional |
| download | User downloaded the item | Optional |
| tip | User rewarded the item | Optional |
| subscribe | The "follow" behavior on an item | Optional |
| dislike | User provided negative feedback | Optional — see Negative feedback |
| page_next | User turned to the next page | Optional — set bhv_value to 1 |
The number of click entries must always be less than the number of expose entries. A ratio of clicks ≥ exposures signals abnormal data and prevents service startup.
CREATE TABLE statements
Use these MaxCompute statements to create the tables required for starting an AIRec instance. Optional fields can be left blank, but all fields must be present in the schema.
--- Create a behavior table in the content industry.
DROP TABLE IF EXISTS behavior_table;
CREATE TABLE IF NOT EXISTS `behavior_table`
(
trace_id STRING COMMENT "Request tracking ID"
,trace_info STRING COMMENT "Request tracking information"
,platform STRING COMMENT "Client platform"
,device_model STRING COMMENT "Device model"
,imei STRING COMMENT "Device ID"
,app_version STRING COMMENT "App version number"
,net_type STRING COMMENT "Network type"
,longitude STRING COMMENT "Longitude"
,latitude STRING COMMENT "Latitude"
,ip STRING COMMENT "Client IP address"
,login STRING COMMENT "Whether the user has logged on"
,report_src STRING COMMENT "Source of the report"
,scene_id STRING COMMENT "Scene ID"
,user_id STRING COMMENT "User ID"
,item_id STRING COMMENT "Item ID"
,item_type STRING COMMENT "Type of the item"
,module_id STRING COMMENT "Module ID"
,page_id STRING COMMENT "Page ID"
,position STRING COMMENT "Position of the item"
,bhv_type STRING COMMENT "Behavior type"
,bhv_value STRING COMMENT "Behavior details"
,bhv_time STRING COMMENT "Time at which the behavior occurs"
)
PARTITIONED BY
(
ds STRING
)
LIFECYCLE 30
;
--- Create a user table in the content industry.
DROP TABLE IF EXISTS user_table;
CREATE TABLE IF NOT EXISTS `user_table`
(
user_id STRING COMMENT "Unique user ID"
,user_id_type STRING COMMENT "Registration type of the user"
,third_user_name STRING COMMENT "Name of the third-party user"
,third_user_type STRING COMMENT "Name of the third-party platform"
,phone_md5 STRING COMMENT "MD5 hash value of the mobile phone number of the user."
,imei STRING COMMENT "Device ID of the user"
,content STRING COMMENT "User content"
,gender STRING COMMENT "Gender"
,age STRING COMMENT "Age"
,age_group STRING COMMENT "Age group"
,country STRING COMMENT "Country"
,city STRING COMMENT "City"
,ip STRING COMMENT "Last logon IP address"
,device_model STRING COMMENT "Device model"
,register_time STRING COMMENT "Registration time"
,last_login_time STRING COMMENT "Last logon time"
,last_modify_time STRING COMMENT "Last modification time of user information"
,tags STRING COMMENT "User tags"
,source STRING COMMENT "Source of the user"
,features STRING COMMENT "Additional user characteristics, which are strings"
,num_features STRING COMMENT "Additional user characteristics, which are numerical values"
)
PARTITIONED BY
(
ds STRING
)
LIFECYCLE 30
;
--- Create an item table in the content industry.
DROP TABLE IF EXISTS item_table;
CREATE TABLE IF NOT EXISTS `item_table`
(
item_id STRING COMMENT "Unique ID of the item"
,item_type STRING COMMENT "Type of the item"
,title STRING COMMENT "Item title"
,content STRING COMMENT "Body part of the item"
,pub_time STRING COMMENT "Release time"
,status STRING COMMENT "Whether the item can be recommended"
,expire_time STRING COMMENT "Time at which the item expires"
,last_modify_time STRING COMMENT "Last modification time of the item information"
,scene_id STRING COMMENT "Scene ID"
,duration STRING COMMENT "Duration, in seconds"
,category_level STRING COMMENT "Category level"
,category_path STRING COMMENT "Category path"
,tags STRING COMMENT "Tags"
,channel STRING COMMENT "Channels"
,organization STRING COMMENT "Organizations"
,author STRING COMMENT "Authors"
,pv_cnt STRING COMMENT "Number of exposures"
,click_cnt STRING COMMENT "Number of clicks"
,like_cnt STRING COMMENT "Number of likes"
,unlike_cnt STRING COMMENT "Number of dislikes"
,comment_cnt STRING COMMENT "Number of comments"
,collect_cnt STRING COMMENT "Number of favorites"
,share_cnt STRING COMMENT "Number of shares"
,download_cnt STRING COMMENT "Number of downloads"
,tip_cnt STRING COMMENT "Number of rewards"
,subscribe_cnt STRING COMMENT "Number of follows"
,source_id STRING COMMENT "Item source"
,country STRING COMMENT "Country"
,city STRING COMMENT "City"
,features STRING COMMENT "Additional characteristics"
,num_features STRING COMMENT "Additional characteristics, which are numerical values"
,weight STRING COMMENT "Weight of the item, default value: 1"
)
PARTITIONED BY
(
ds STRING
)
LIFECYCLE 30
;What's next
Use scene IDs — learn how scene IDs map to pages and recommendation placements
Improve recommendation diversity using instance operation rules — configure discretization policies for category-based diversity
Negative feedback — use the
dislikebehavior type to suppress unwanted content